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, Ilayaperumal Gopinathan, Alexandros Pappas
- See Also:
-
ChatModelOpenAIClient
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class org.springframework.ai.chat.model.AbstractToolCallSupport
functionCallbackRegister, functionCallbackResolver, IS_RUNTIME_CALL -
Constructor Summary
ConstructorsConstructorDescriptionAzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder) Deprecated.AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options) Deprecated.AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options, FunctionCallbackResolver functionCallbackResolver) Deprecated.AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options, FunctionCallbackResolver functionCallbackResolver, List<FunctionCallback> toolFunctionCallbacks) Deprecated.AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options, FunctionCallbackResolver functionCallbackResolver, List<FunctionCallback> toolFunctionCallbacks, io.micrometer.observation.ObservationRegistry observationRegistry) Deprecated.AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions defaultOptions, ToolCallingManager toolCallingManager, io.micrometer.observation.ObservationRegistry observationRegistry) -
Method Summary
Modifier and TypeMethodDescriptionstatic AzureOpenAiChatModel.Builderbuilder()Executes a method call to the AI model.static ChatResponseMetadatafrom(com.azure.ai.openai.models.ChatCompletions chatCompletions, PromptMetadata promptFilterMetadata) static ChatResponseMetadatafrom(com.azure.ai.openai.models.ChatCompletions chatCompletions, PromptMetadata promptFilterMetadata, com.azure.ai.openai.models.CompletionsUsage usage) static ChatResponseMetadatafrom(com.azure.ai.openai.models.ChatCompletions chatCompletions, PromptMetadata promptFilterMetadata, Usage usage) static ChatResponseMetadatafrom(ChatResponse chatResponse, Usage usage) internalCall(Prompt prompt, ChatResponse previousChatResponse) reactor.core.publisher.Flux<ChatResponse>internalStream(Prompt prompt, ChatResponse previousChatResponse) voidsetObservationConvention(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, runtimeFunctionCallbackConfigurationsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.chat.model.StreamingChatModel
stream, stream
-
Constructor Details
-
AzureOpenAiChatModel
@Deprecated public AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder) Deprecated. -
AzureOpenAiChatModel
@Deprecated public AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options) Deprecated. -
AzureOpenAiChatModel
@Deprecated public AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options, FunctionCallbackResolver functionCallbackResolver) Deprecated. -
AzureOpenAiChatModel
@Deprecated public AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options, @Nullable FunctionCallbackResolver functionCallbackResolver, @Nullable List<FunctionCallback> toolFunctionCallbacks) Deprecated. -
AzureOpenAiChatModel
@Deprecated public AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions options, @Nullable FunctionCallbackResolver functionCallbackResolver, @Nullable List<FunctionCallback> toolFunctionCallbacks, io.micrometer.observation.ObservationRegistry observationRegistry) Deprecated. -
AzureOpenAiChatModel
public AzureOpenAiChatModel(com.azure.ai.openai.OpenAIClientBuilder openAIClientBuilder, AzureOpenAiChatOptions defaultOptions, ToolCallingManager toolCallingManager, io.micrometer.observation.ObservationRegistry observationRegistry)
-
-
Method Details
-
from
public static ChatResponseMetadata from(com.azure.ai.openai.models.ChatCompletions chatCompletions, PromptMetadata promptFilterMetadata, Usage usage) -
from
public static ChatResponseMetadata from(com.azure.ai.openai.models.ChatCompletions chatCompletions, PromptMetadata promptFilterMetadata) -
from
public static ChatResponseMetadata from(com.azure.ai.openai.models.ChatCompletions chatCompletions, PromptMetadata promptFilterMetadata, com.azure.ai.openai.models.CompletionsUsage usage) -
from
-
getDefaultOptions
- Specified by:
getDefaultOptionsin interfaceChatModel
-
call
Description copied from interface:ModelExecutes a method call to the AI model. -
internalCall
-
stream
Description copied from interface:StreamingModelExecutes a method call to the AI model.- Specified by:
streamin interfaceChatModel- Specified by:
streamin interfaceStreamingChatModel- Specified by:
streamin interfaceStreamingModel<Prompt,ChatResponse> - Parameters:
prompt- the request object to be sent to the AI model- Returns:
- the streaming response from the AI model
-
internalStream
public reactor.core.publisher.Flux<ChatResponse> internalStream(Prompt prompt, ChatResponse previousChatResponse) -
setObservationConvention
Use the provided convention for reporting observation data- Parameters:
observationConvention- The provided convention
-
builder
-