Class OpenAiChatModel.Builder

java.lang.Object
org.springframework.ai.openai.OpenAiChatModel.Builder
Enclosing class:
OpenAiChatModel

public static final class OpenAiChatModel.Builder extends Object
Builder for creating OpenAiChatModel instances.
  • Method Details

    • openAiClient

      public OpenAiChatModel.Builder openAiClient(com.openai.client.OpenAIClient openAiClient)
      Sets the synchronous OpenAI client.
      Parameters:
      openAiClient - the synchronous client
      Returns:
      this builder
    • openAiClientAsync

      public OpenAiChatModel.Builder openAiClientAsync(com.openai.client.OpenAIClientAsync openAiClientAsync)
      Sets the asynchronous OpenAI client.
      Parameters:
      openAiClientAsync - the asynchronous client
      Returns:
      this builder
    • options

      public OpenAiChatModel.Builder options(OpenAiChatOptions options)
      Sets the chat options.
      Parameters:
      options - the chat options
      Returns:
      this builder
    • toolCallingManager

      public OpenAiChatModel.Builder toolCallingManager(ToolCallingManager toolCallingManager)
      Sets the tool calling manager.
      Parameters:
      toolCallingManager - the tool calling manager
      Returns:
      this builder
    • observationRegistry

      public OpenAiChatModel.Builder observationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry)
      Sets the observation registry for metrics and tracing.
      Parameters:
      observationRegistry - the observation registry
      Returns:
      this builder
    • toolExecutionEligibilityPredicate

      public OpenAiChatModel.Builder toolExecutionEligibilityPredicate(ToolExecutionEligibilityPredicate toolExecutionEligibilityPredicate)
      Sets the predicate to determine tool execution eligibility.
      Parameters:
      toolExecutionEligibilityPredicate - the predicate
      Returns:
      this builder
    • build

      public OpenAiChatModel build()
      Builds a new OpenAiChatModel instance.
      Returns:
      the configured chat model