Class LLMOverrides.Builder

java.lang.Object
com.tnsai.integration.scop.LLMOverrides.Builder
Enclosing class:
LLMOverrides

public static final class LLMOverrides.Builder extends Object
Names each field instead of relying on the positional record constructor.
  • Method Details

    • provider

      public LLMOverrides.Builder provider(String provider)
      Parameters:
      provider - provider name, e.g. OPENAI; matched case-insensitively against LLMSpec.Provider and stored upper-cased
      Throws:
      LLMConfigurationException - if it names no known provider. An overlay may name only what an annotation could have named: the provider selects the transport, and an unknown string would silently choose one rather than fail.
    • model

      public LLMOverrides.Builder model(String model)
      Parameters:
      model - model identifier, e.g. gpt-4o-mini
      Throws:
      LLMConfigurationException - if blank. Blank is not "unset": it would win the merge and then read as absent downstream, which for model means the resolution fails while blaming the annotations.
    • temperature

      public LLMOverrides.Builder temperature(double temperature)
      Parameters:
      temperature - sampling temperature; 0.0 is a legitimate value
      Throws:
      LLMConfigurationException - if it is negative or not finite. 1e400 parses to Infinity rather than failing, and would only surface later as an unserialisable request body.
    • maxTokens

      public LLMOverrides.Builder maxTokens(int maxTokens)
      Parameters:
      maxTokens - response token ceiling; 0 is a legitimate value meaning "let the provider decide" — the Core SPI path, the OpenAI-compatible request body and Gemini all omit the field for it. It does not mean that on the Anthropic HTTP path, which substitutes a fixed ceiling because the Anthropic API requires the field; see TAN-6204.
      Throws:
      LLMConfigurationException - if it is negative
    • endpoint

      public LLMOverrides.Builder endpoint(String endpoint)
      Parameters:
      endpoint - full chat-completions URL
      Throws:
      LLMConfigurationException - if blank. Blank is not "unset": it would win the merge and then read as absent downstream, which for model means the resolution fails while blaming the annotations.
    • apiKeyEnv

      public LLMOverrides.Builder apiKeyEnv(String apiKeyEnv)
      Parameters:
      apiKeyEnv - name of the environment variable holding the API key
      Throws:
      LLMConfigurationException - if blank. Blank is not "unset": it would win the merge and then read as absent downstream, which for model means the resolution fails while blaming the annotations.
    • build

      public LLMOverrides build()
      Builds the overlay.