All Superinterfaces:
Prototype.Api
All Known Implementing Classes:
OpenAiChatModelConfig.BuilderBase.OpenAiChatModelConfigImpl

public interface OpenAiChatModelConfig extends Prototype.Api
Configuration for the OpenAI chat model, OpenAiChatModel. Provides methods for setting up and managing properties related to OpenAI chat API requests.
See Also:
  • Field Details

  • Method Details

    • builder

      Create a new fluent API builder to customize configuration.
      Returns:
      a new builder
    • builder

      Create a new fluent API builder from an existing instance.
      Parameters:
      instance - an existing instance used as a base for the builder
      Returns:
      a builder based on an instance
    • create

      static OpenAiChatModelConfig create(Config config)
      Create a new instance from configuration.
      Parameters:
      config - used to configure the new instance
      Returns:
      a new instance configured from configuration
    • create

      static OpenAiChatModelConfig create()
      Create a new instance with default values.
      Returns:
      a new instance
    • maxRetries

      Optional<Integer> maxRetries()
      The maximum number of retries for failed API requests.
      Returns:
      an Optional containing the maximum number of retries
    • temperature

      Optional<Double> temperature()
      The sampling temperature to use, between 0 and 2. Higher values make the output more random, while lower values make it more focused and deterministic.
      Returns:
      an Optional containing the sampling temperature
    • topP

      Optional<Double> topP()
      The nucleus sampling value, where the model considers the results of the tokens with top_p probability mass.
      Returns:
      an Optional containing the nucleus sampling value
    • stop

      List<String> stop()
      The list of sequences where the API will stop generating further tokens.
      Returns:
      the list of stop sequences
    • maxTokens

      Optional<Integer> maxTokens()
      The maximum number of tokens to generate in the completion.
      Returns:
      an Optional containing the maximum number of tokens
    • maxCompletionTokens

      Optional<Integer> maxCompletionTokens()
      The maximum number of tokens allowed for the model's response.
      Returns:
      an Optional containing the maximum number of completion tokens
    • presencePenalty

      Optional<Double> presencePenalty()
      The presence penalty, between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, encouraging the model to use new words.
      Returns:
      an Optional containing the presence penalty
    • frequencyPenalty

      Optional<Double> frequencyPenalty()
      The frequency penalty, between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line.
      Returns:
      an Optional containing the frequency penalty
    • logitBias

      Map<String,Integer> logitBias()
      LogitBias adjusts the likelihood of specific tokens appearing in a model's response. A map of token IDs to bias values (-100 to 100). Positive values increase the chance of the token, while negative values reduce it, allowing fine control over token preferences in the output.
      Returns:
      a logitBias map
    • responseFormat

      Optional<String> responseFormat()
      The format in which the model should return the response.
      Returns:
      an Optional containing the response format
    • strictJsonSchema

      Optional<Boolean> strictJsonSchema()
      Whether to enforce a strict JSON schema for the model's output.
      Returns:
      an Optional containing true if strict JSON schema is enforced, false otherwise
    • seed

      Optional<Integer> seed()
      The seed for the random number generator used by the model.
      Returns:
      an Optional containing the seed
    • user

      Optional<String> user()
      The user ID associated with the API requests.
      Returns:
      an Optional containing the user ID
    • strictTools

      Optional<Boolean> strictTools()
      Whether to enforce strict validation of tools used by the model.
      Returns:
      an Optional containing true if strict tools are enforced, false otherwise
    • parallelToolCalls

      Optional<Boolean> parallelToolCalls()
      Whether to allow parallel calls to tools.
      Returns:
      an Optional containing true if parallel tool calls are allowed, false otherwise
    • tokenizer

      Optional<dev.langchain4j.model.Tokenizer> tokenizer()
      Tokenizer to use.
      Returns:
      an Optional containing the tokenizer
    • enabled

      boolean enabled()
      If set to false (default), OpenAI model will not be available even if configured.
      Returns:
      whether OpenAI model is enabled, defaults to false
    • baseUrl

      Optional<String> baseUrl()
      The base URL for the OpenAI API.
      Returns:
      the base URL
    • apiKey

      Optional<String> apiKey()
      The API key used to authenticate requests to the OpenAI API.
      Returns:
      an Optional containing the API key
    • logRequests

      Optional<Boolean> logRequests()
      Whether to log API requests.
      Returns:
      an Optional containing true if requests should be logged, false otherwise
    • logResponses

      Optional<Boolean> logResponses()
      Whether to log API responses.
      Returns:
      an Optional containing true if responses should be logged, false otherwise
    • customHeaders

      Map<String,String> customHeaders()
      A map containing custom headers.
      Returns:
      custom headers map
    • timeout

      Optional<Duration> timeout()
      The timeout setting for API requests.
      Returns:
      the timeout setting in Duration.parse(java.lang.CharSequence) format
    • proxy

      Optional<Proxy> proxy()
      Proxy to use.
      Returns:
      an Optional containing HTTP proxy to use
    • organizationId

      Optional<String> organizationId()
      The ID of the organization for API requests.
      Returns:
      organization ID
    • modelName

      Optional<String> modelName()
      The model name to use (e.g., "gpt-3.5-turbo").
      Returns:
      the model name