- All Known Implementing Classes:
AbstractHttpLlmClient,FakeLlmClient,RetryingLlmClient
public interface LlmClient
Executes LLM requests for a single registered provider (for example OpenAI, Ollama, or Claude).
Implementations are typically instantiated and managed by a discovery mechanism provided by a
consuming module. Each client instance is bound to one provider id returned by
getProviderName().
-
Method Summary
Modifier and TypeMethodDescriptionexecute(LlmExecutionRequest request) Executes an LLM request and returns the response.Returns the provider id this client executes against (lowercase, such as"openai").default LlmRetryPolicyThe retry policy this client requests, ornullif it has none.
-
Method Details
-
getProviderName
String getProviderName()Returns the provider id this client executes against (lowercase, such as"openai").- Returns:
- non-blank provider id
-
execute
Executes an LLM request and returns the response.- Parameters:
request- provider id, prompts, and optional model override for this call- Returns:
- execution response containing model output and optional token usage
- Throws:
LlmInvocationException- if the request fails due to network issues, invalid responses, or provider-specific errors
-
getRetryPolicy
The retry policy this client requests, ornullif it has none. Callers that need a policy either way should fall back toLlmRetryPolicy.defaults()on anullreturn.- Returns:
- the requested retry policy, or
nullwhen this client has none
-