Record Class LlmProviderConfig

java.lang.Object
java.lang.Record
com.agentforge4j.bootstrap.LlmProviderConfig
Record Components:
provider - non-blank provider id
apiKeyReference - optional credential reference for this layer (never a raw value in a toString)
baseUrl - optional base URL; null requires the static factory preset or an explicit caller value
defaultModel - optional default model; null requires the static factory preset or an explicit caller value
connectTimeout - optional connect timeout; null requires the static factory preset or an explicit caller value
options - provider-specific option key/values; never null (empty when none)

public record LlmProviderConfig(String provider, LlmSecretReference apiKeyReference, String baseUrl, String defaultModel, Duration connectTimeout, Map<String,String> options) extends Record
Immutable configuration for a single LLM provider, used by AgentForge4jBootstrap.Builder.withLlmProvider(LlmProviderConfig).

Construct via the per-provider static factory methods, supplying the credential and any provider-specific options the provider requires:


 LlmProviderConfig config = LlmProviderConfig.openai()
     .defaults()
     .apiKey("sk-...")
     .option("request.timeout", "PT30S")
     .build();
 

All fields except provider are nullable/empty. A null apiKeyReference means "no credential configured at this layer." A null baseUrl or defaultModel does not fall back to a default supplied by the provider module itself — the provider client requires a non-blank base URL and default model at construction time and has no fallback of its own. A null value here means either the per-provider static factory already populated a recommended preset (see openai(), claude(), etc.) or, for deployment-specific providers such as azureOpenAi(), openAiCompatible(), and bedrock(), that the caller must supply one explicitly before LlmProviderConfig.ProviderBuilder.build(). options carries provider-specific settings (keyed in the canonical dotted form, e.g. request.timeout, auth.header.name) consumed via LlmProviderOptions.

  • Constructor Details

  • Method Details

    • toString

      public String toString()
      Renders without exposing credentials: apiKeyReference already redacts itself, and only option keys are shown because an option value may carry a provider secret. Replaces the record's generated toString, which would print option values verbatim.
      Specified by:
      toString in class Record
      Returns:
      a secret-safe string representation
    • openai

      public static LlmProviderConfig.ProviderBuilder openai()
      Returns a builder pre-populated with OpenAI defaults.
      Returns:
      builder for OpenAI configuration
    • claude

      public static LlmProviderConfig.ProviderBuilder claude()
      Returns a builder pre-populated with Anthropic Claude defaults.
      Returns:
      builder for Claude configuration
    • ollama

      public static LlmProviderConfig.ProviderBuilder ollama()
      Returns a builder pre-populated with Ollama defaults.
      Returns:
      builder for Ollama configuration
    • vllm

      public static LlmProviderConfig.ProviderBuilder vllm()
      Returns a builder pre-populated with vLLM defaults.
      Returns:
      builder for vLLM configuration
    • gemini

      public static LlmProviderConfig.ProviderBuilder gemini()
      Returns a builder pre-populated with Google Gemini defaults.
      Returns:
      builder for Gemini configuration
    • mistral

      public static LlmProviderConfig.ProviderBuilder mistral()
      Returns a builder pre-populated with Mistral defaults.
      Returns:
      builder for Mistral configuration
    • azureOpenAi

      public static LlmProviderConfig.ProviderBuilder azureOpenAi()
      Returns a builder for Azure OpenAI. baseUrl and defaultModel are null by default — both are deployment-specific and must be set by the caller.
      Returns:
      builder for Azure OpenAI configuration
    • openAiCompatible

      public static LlmProviderConfig.ProviderBuilder openAiCompatible()
      Returns a builder for any OpenAI-compatible endpoint. baseUrl and defaultModel are null by default — both are deployment-specific and must be set by the caller.
      Returns:
      builder for OpenAI-compatible configuration
    • bedrock

      public static LlmProviderConfig.ProviderBuilder bedrock()
      Returns a builder for AWS Bedrock. baseUrl and defaultModel are null by default — both are deployment-specific and must be set by the caller.
      Returns:
      builder for Bedrock configuration
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • provider

      public String provider()
      Returns the value of the provider record component.
      Returns:
      the value of the provider record component
    • apiKeyReference

      public LlmSecretReference apiKeyReference()
      Returns the value of the apiKeyReference record component.
      Returns:
      the value of the apiKeyReference record component
    • baseUrl

      public String baseUrl()
      Returns the value of the baseUrl record component.
      Returns:
      the value of the baseUrl record component
    • defaultModel

      public String defaultModel()
      Returns the value of the defaultModel record component.
      Returns:
      the value of the defaultModel record component
    • connectTimeout

      public Duration connectTimeout()
      Returns the value of the connectTimeout record component.
      Returns:
      the value of the connectTimeout record component
    • options

      public Map<String,String> options()
      Returns the value of the options record component.
      Returns:
      the value of the options record component