Package org.springframework.ai.moonshot
Class MoonshotChatModel
java.lang.Object
org.springframework.ai.chat.model.AbstractToolCallSupport
org.springframework.ai.moonshot.MoonshotChatModel
- All Implemented Interfaces:
ChatModel
,StreamingChatModel
,Model<Prompt,
,ChatResponse> StreamingModel<Prompt,
ChatResponse>
public class MoonshotChatModel
extends AbstractToolCallSupport
implements ChatModel, StreamingChatModel
- Author:
- Geng Rong
-
Field Summary
Fields inherited from class org.springframework.ai.chat.model.AbstractToolCallSupport
functionCallbackContext, functionCallbackRegister, IS_RUNTIME_CALL
-
Constructor Summary
ConstructorDescriptionMoonshotChatModel
(MoonshotApi moonshotApi) Initializes a new instance of the MoonshotChatModel.MoonshotChatModel
(MoonshotApi moonshotApi, MoonshotChatOptions options) Initializes a new instance of the MoonshotChatModel.MoonshotChatModel
(MoonshotApi moonshotApi, MoonshotChatOptions options, FunctionCallbackContext functionCallbackContext, List<FunctionCallback> toolFunctionCallbacks, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) Initializes a new instance of the MoonshotChatModel.MoonshotChatModel
(MoonshotApi moonshotApi, MoonshotChatOptions options, FunctionCallbackContext functionCallbackContext, org.springframework.retry.support.RetryTemplate retryTemplate) Initializes a new instance of the MoonshotChatModel. -
Method Summary
Modifier and TypeMethodDescriptionExecutes a method call to the AI model.createRequest
(Prompt prompt, boolean stream) Accessible for testing.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
-
Constructor Details
-
MoonshotChatModel
Initializes a new instance of the MoonshotChatModel.- Parameters:
moonshotApi
- The Moonshot instance to be used for interacting with the Moonshot Chat API.
-
MoonshotChatModel
Initializes a new instance of the MoonshotChatModel.- Parameters:
moonshotApi
- The Moonshot instance to be used for interacting with the Moonshot Chat API.options
- The MoonshotChatOptions to configure the chat client.
-
MoonshotChatModel
public MoonshotChatModel(MoonshotApi moonshotApi, MoonshotChatOptions options, FunctionCallbackContext functionCallbackContext, org.springframework.retry.support.RetryTemplate retryTemplate) Initializes a new instance of the MoonshotChatModel.- Parameters:
moonshotApi
- The Moonshot instance to be used for interacting with the Moonshot Chat API.options
- The MoonshotChatOptions to configure the chat client.functionCallbackContext
- The function callback context.retryTemplate
- The retry template.
-
MoonshotChatModel
public MoonshotChatModel(MoonshotApi moonshotApi, MoonshotChatOptions options, FunctionCallbackContext functionCallbackContext, List<FunctionCallback> toolFunctionCallbacks, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) Initializes a new instance of the MoonshotChatModel.- Parameters:
moonshotApi
- The Moonshot instance to be used for interacting with the Moonshot Chat API.options
- The MoonshotChatOptions to configure the chat client.functionCallbackContext
- The function callback context.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
-
createRequest
Accessible for testing. -
setObservationConvention
-