Class RetryingLlmClient

java.lang.Object
com.agentforge4j.llm.RetryingLlmClient
All Implemented Interfaces:
LlmClient

public final class RetryingLlmClient extends Object implements LlmClient
Wraps an LLM client with retry logic for transient failures (decorrelated jitter backoff).
  • Constructor Details

  • Method Details

    • getProviderName

      public String getProviderName()
      Description copied from interface: LlmClient
      Returns the provider id this client executes against (lowercase, such as "openai").
      Specified by:
      getProviderName in interface LlmClient
      Returns:
      non-blank provider id
    • getRetryPolicy

      public LlmRetryPolicy getRetryPolicy()
      Description copied from interface: LlmClient
      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.
      Specified by:
      getRetryPolicy in interface LlmClient
      Returns:
      the requested retry policy, or null when this client has none
    • execute

      public LlmExecutionResponse execute(LlmExecutionRequest request)
      Description copied from interface: LlmClient
      Executes an LLM request and returns the response.
      Specified by:
      execute in interface LlmClient
      Parameters:
      request - provider id, prompts, and optional model override for this call
      Returns:
      execution response containing model output and optional token usage