Class AzureOpenAiChatModel
java.lang.Object
org.springframework.ai.chat.model.AbstractToolCallSupport
org.springframework.ai.azure.openai.AzureOpenAiChatModel
- All Implemented Interfaces:
ChatModel
,StreamingChatModel
,Model<Prompt,
,ChatResponse> StreamingModel<Prompt,
ChatResponse>
ChatModel
implementation for Microsoft Azure AI backed by
OpenAIClient
.- Since:
- 1.0.0
- Author:
- Mark Pollack, Ueibin Kim, John Blum, Christian Tzolov, Grogdunn, Benoit Moussaud, Thomas Vitale, luocongqiu, timostark, Soby Chacko, Jihoon Kim
- See Also:
-
ChatModel
OpenAIClient
-
Field Summary
Fields inherited from class org.springframework.ai.chat.model.AbstractToolCallSupport
functionCallbackContext, functionCallbackRegister, IS_RUNTIME_CALL
-
Constructor Summary
ConstructorDescriptionAzureOpenAiChatModel
(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder) AzureOpenAiChatModel
(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options) AzureOpenAiChatModel
(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options, FunctionCallbackContext functionCallbackContext) AzureOpenAiChatModel
(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options, FunctionCallbackContext functionCallbackContext, List<FunctionCallback> toolFunctionCallbacks) AzureOpenAiChatModel
(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options, FunctionCallbackContext functionCallbackContext, List<FunctionCallback> toolFunctionCallbacks, io.micrometer.observation.ObservationRegistry observationRegistry) -
Method Summary
Modifier and TypeMethodDescriptionExecutes a method call to the AI model.static ChatResponseMetadata
from
(com.azure.ai.openai.models.ChatCompletions chatCompletions, PromptMetadata promptFilterMetadata) void
setObservationConvention
(ChatModelObservationConvention observationConvention) Use the provided convention for reporting observation datareactor.core.publisher.Flux<ChatResponse>
Executes a method call to the AI model.Methods inherited from class org.springframework.ai.chat.model.AbstractToolCallSupport
buildToolCallConversation, executeFunctions, getFunctionCallbackRegister, handleToolCalls, isProxyToolCalls, isToolCall, isToolCall, resolveFunctionCallbacks, runtimeFunctionCallbackConfigurations
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.ai.chat.model.StreamingChatModel
stream, stream
-
Constructor Details
-
AzureOpenAiChatModel
public AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder) -
AzureOpenAiChatModel
public AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options) -
AzureOpenAiChatModel
public AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options, FunctionCallbackContext functionCallbackContext) -
AzureOpenAiChatModel
public AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options, FunctionCallbackContext functionCallbackContext, List<FunctionCallback> toolFunctionCallbacks) -
AzureOpenAiChatModel
public AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options, FunctionCallbackContext functionCallbackContext, List<FunctionCallback> toolFunctionCallbacks, io.micrometer.observation.ObservationRegistry observationRegistry)
-
-
Method Details
-
from
public static ChatResponseMetadata from(com.azure.ai.openai.models.ChatCompletions chatCompletions, PromptMetadata promptFilterMetadata) -
getDefaultOptions
- Specified by:
getDefaultOptions
in interfaceChatModel
-
call
Description copied from interface:Model
Executes a method call to the AI model. -
stream
Description copied from interface:StreamingModel
Executes a method call to the AI model.- Specified by:
stream
in interfaceChatModel
- Specified by:
stream
in interfaceStreamingChatModel
- Specified by:
stream
in interfaceStreamingModel<Prompt,
ChatResponse> - Parameters:
prompt
- the request object to be sent to the AI model- Returns:
- the streaming response from the AI model
-
setObservationConvention
Use the provided convention for reporting observation data- Parameters:
observationConvention
- The provided convention
-