Interface LlmClient

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 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

      default LlmRetryPolicy getRetryPolicy()
      The retry policy this client requests, or null if it has none. Callers that need a policy either way should fall back to LlmRetryPolicy.defaults() on a null return.
      Returns:
      the requested retry policy, or null when this client has none