Package org.springframework.ai.openaisdk
Class OpenAiSdkChatModel.Builder
java.lang.Object
org.springframework.ai.openaisdk.OpenAiSdkChatModel.Builder
- Enclosing class:
OpenAiSdkChatModel
Builder for creating
OpenAiSdkChatModel instances.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newOpenAiSdkChatModelinstance.observationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry) Sets the observation registry for metrics and tracing.openAiClient(com.openai.client.OpenAIClient openAiClient) Sets the synchronous OpenAI client.openAiClientAsync(com.openai.client.OpenAIClientAsync openAiClientAsync) Sets the asynchronous OpenAI client.options(OpenAiSdkChatOptions options) Sets the chat options.toolCallingManager(ToolCallingManager toolCallingManager) Sets the tool calling manager.toolExecutionEligibilityPredicate(ToolExecutionEligibilityPredicate toolExecutionEligibilityPredicate) Sets the predicate to determine tool execution eligibility.
-
Method Details
-
openAiClient
Sets the synchronous OpenAI client.- Parameters:
openAiClient- the synchronous client- Returns:
- this builder
-
openAiClientAsync
public OpenAiSdkChatModel.Builder openAiClientAsync(com.openai.client.OpenAIClientAsync openAiClientAsync) Sets the asynchronous OpenAI client.- Parameters:
openAiClientAsync- the asynchronous client- Returns:
- this builder
-
options
Sets the chat options.- Parameters:
options- the chat options- Returns:
- this builder
-
toolCallingManager
Sets the tool calling manager.- Parameters:
toolCallingManager- the tool calling manager- Returns:
- this builder
-
observationRegistry
public OpenAiSdkChatModel.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 OpenAiSdkChatModel.Builder toolExecutionEligibilityPredicate(ToolExecutionEligibilityPredicate toolExecutionEligibilityPredicate) Sets the predicate to determine tool execution eligibility.- Parameters:
toolExecutionEligibilityPredicate- the predicate- Returns:
- this builder
-
build
Builds a newOpenAiSdkChatModelinstance.- Returns:
- the configured chat model
-