Package org.springframework.ai.zhipuai
Class ZhiPuAiChatModel
java.lang.Object
org.springframework.ai.chat.model.AbstractToolCallSupport
org.springframework.ai.zhipuai.ZhiPuAiChatModel
- All Implemented Interfaces:
ChatModel
,StreamingChatModel
,Model<Prompt,
,ChatResponse> StreamingModel<Prompt,
ChatResponse>
public class ZhiPuAiChatModel
extends AbstractToolCallSupport
implements ChatModel, StreamingChatModel
- Since:
- 1.0.0 M1
- Author:
- Geng Rong, Alexandros Pappas
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionfinal org.springframework.retry.support.RetryTemplate
The retry template used to retry the ZhiPuAI API calls.Fields inherited from class org.springframework.ai.chat.model.AbstractToolCallSupport
functionCallbackRegister, functionCallbackResolver, IS_RUNTIME_CALL
-
Constructor Summary
ConstructorDescriptionZhiPuAiChatModel
(ZhiPuAiApi zhiPuAiApi) Creates an instance of the ZhiPuAiChatModel.ZhiPuAiChatModel
(ZhiPuAiApi zhiPuAiApi, ZhiPuAiChatOptions options) Initializes an instance of the ZhiPuAiChatModel.ZhiPuAiChatModel
(ZhiPuAiApi zhiPuAiApi, ZhiPuAiChatOptions options, FunctionCallbackResolver functionCallbackResolver, List<FunctionCallback> toolFunctionCallbacks, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) Initializes a new instance of the ZhiPuAiChatModel.ZhiPuAiChatModel
(ZhiPuAiApi zhiPuAiApi, ZhiPuAiChatOptions options, FunctionCallbackResolver functionCallbackResolver, org.springframework.retry.support.RetryTemplate retryTemplate) Initializes an instance of the ZhiPuAiChatModel. -
Method Summary
Modifier and TypeMethodDescriptionExecutes a method call to the AI model.void
setObservationConvention
(ChatModelObservationConvention observationConvention) reactor.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
-
Field Details
-
retryTemplate
public final org.springframework.retry.support.RetryTemplate retryTemplateThe retry template used to retry the ZhiPuAI API calls.
-
-
Constructor Details
-
ZhiPuAiChatModel
Creates an instance of the ZhiPuAiChatModel.- Parameters:
zhiPuAiApi
- The ZhiPuAiApi instance to be used for interacting with the ZhiPuAI Chat API.- Throws:
IllegalArgumentException
- if zhiPuAiApi is null
-
ZhiPuAiChatModel
Initializes an instance of the ZhiPuAiChatModel.- Parameters:
zhiPuAiApi
- The ZhiPuAiApi instance to be used for interacting with the ZhiPuAI Chat API.options
- The ZhiPuAiChatOptions to configure the chat model.
-
ZhiPuAiChatModel
public ZhiPuAiChatModel(ZhiPuAiApi zhiPuAiApi, ZhiPuAiChatOptions options, FunctionCallbackResolver functionCallbackResolver, org.springframework.retry.support.RetryTemplate retryTemplate) Initializes an instance of the ZhiPuAiChatModel.- Parameters:
zhiPuAiApi
- The ZhiPuAiApi instance to be used for interacting with the ZhiPuAI Chat API.options
- The ZhiPuAiChatOptions to configure the chat model.functionCallbackResolver
- The function callback resolver.retryTemplate
- The retry template.
-
ZhiPuAiChatModel
public ZhiPuAiChatModel(ZhiPuAiApi zhiPuAiApi, ZhiPuAiChatOptions options, FunctionCallbackResolver functionCallbackResolver, List<FunctionCallback> toolFunctionCallbacks, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) Initializes a new instance of the ZhiPuAiChatModel.- Parameters:
zhiPuAiApi
- The ZhiPuAiApi instance to be used for interacting with the ZhiPuAI Chat API.options
- The ZhiPuAiChatOptions to configure the chat model.functionCallbackResolver
- The function callback resolver.toolFunctionCallbacks
- The tool function callbacks.retryTemplate
- The retry template.observationRegistry
- The ObservationRegistry used for instrumentation.
-
-
Method Details
-
call
Description copied from interface:Model
Executes a method call to the AI model. -
getDefaultOptions
- Specified by:
getDefaultOptions
in interfaceChatModel
-
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
-