Package org.springframework.ai.mistralai
Class MistralAiChatClient
java.lang.Object
org.springframework.ai.model.function.AbstractFunctionCallSupport<MistralAiApi.ChatCompletionMessage,MistralAiApi.ChatCompletionRequest,org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion>>
org.springframework.ai.mistralai.MistralAiChatClient
- All Implemented Interfaces:
ChatClient
,StreamingChatClient
,ModelClient<Prompt,
,ChatResponse> StreamingModelClient<Prompt,
ChatResponse>
public class MistralAiChatClient
extends AbstractFunctionCallSupport<MistralAiApi.ChatCompletionMessage,MistralAiApi.ChatCompletionRequest,org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion>>
implements ChatClient, StreamingChatClient
- Since:
- 0.8.1
- Author:
- Ricken Bazolo, Christian Tzolov
-
Field Summary
Fields inherited from class org.springframework.ai.model.function.AbstractFunctionCallSupport
functionCallbackContext, functionCallbackRegister, IS_RUNTIME_CALL
-
Constructor Summary
ConstructorDescriptionMistralAiChatClient
(MistralAiApi mistralAiApi) MistralAiChatClient
(MistralAiApi mistralAiApi, MistralAiChatOptions options) MistralAiChatClient
(MistralAiApi mistralAiApi, MistralAiChatOptions options, FunctionCallbackContext functionCallbackContext, org.springframework.retry.support.RetryTemplate retryTemplate) -
Method Summary
Modifier and TypeMethodDescriptionExecutes a method call to the AI model.protected org.springframework.http.ResponseEntity
<MistralAiApi.ChatCompletion> protected MistralAiApi.ChatCompletionRequest
doCreateToolResponseRequest
(MistralAiApi.ChatCompletionRequest previousRequest, MistralAiApi.ChatCompletionMessage responseMessage, List<MistralAiApi.ChatCompletionMessage> conversationHistory) protected MistralAiApi.ChatCompletionMessage
doGetToolResponseMessage
(org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion> chatCompletion) protected List
<MistralAiApi.ChatCompletionMessage> protected boolean
isToolFunctionCall
(org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion> chatCompletion) reactor.core.publisher.Flux
<ChatResponse> Executes a method call to the AI model.Methods inherited from class org.springframework.ai.model.function.AbstractFunctionCallSupport
callWithFunctionSupport, getFunctionCallbackRegister, handleFunctionCallbackConfigurations, handleFunctionCallOrReturn, resolveFunctionCallbacks
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.ChatClient
call
Methods inherited from interface org.springframework.ai.chat.StreamingChatClient
stream
-
Constructor Details
-
MistralAiChatClient
-
MistralAiChatClient
-
MistralAiChatClient
public MistralAiChatClient(MistralAiApi mistralAiApi, MistralAiChatOptions options, FunctionCallbackContext functionCallbackContext, org.springframework.retry.support.RetryTemplate retryTemplate)
-
-
Method Details
-
call
Description copied from interface:ModelClient
Executes a method call to the AI model.- Specified by:
call
in interfaceChatClient
- Specified by:
call
in interfaceModelClient<Prompt,
ChatResponse> - Parameters:
prompt
- the request object to be sent to the AI model- Returns:
- the response from the AI model
-
stream
Description copied from interface:StreamingModelClient
Executes a method call to the AI model.- Specified by:
stream
in interfaceStreamingChatClient
- Specified by:
stream
in interfaceStreamingModelClient<Prompt,
ChatResponse> - Parameters:
prompt
- the request object to be sent to the AI model- Returns:
- the streaming response from the AI model
-
doCreateToolResponseRequest
protected MistralAiApi.ChatCompletionRequest doCreateToolResponseRequest(MistralAiApi.ChatCompletionRequest previousRequest, MistralAiApi.ChatCompletionMessage responseMessage, List<MistralAiApi.ChatCompletionMessage> conversationHistory) - Specified by:
doCreateToolResponseRequest
in classAbstractFunctionCallSupport<MistralAiApi.ChatCompletionMessage,
MistralAiApi.ChatCompletionRequest, org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion>>
-
doGetUserMessages
protected List<MistralAiApi.ChatCompletionMessage> doGetUserMessages(MistralAiApi.ChatCompletionRequest request) - Specified by:
doGetUserMessages
in classAbstractFunctionCallSupport<MistralAiApi.ChatCompletionMessage,
MistralAiApi.ChatCompletionRequest, org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion>>
-
doGetToolResponseMessage
protected MistralAiApi.ChatCompletionMessage doGetToolResponseMessage(org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion> chatCompletion) - Specified by:
doGetToolResponseMessage
in classAbstractFunctionCallSupport<MistralAiApi.ChatCompletionMessage,
MistralAiApi.ChatCompletionRequest, org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion>>
-
doChatCompletion
protected org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion> doChatCompletion(MistralAiApi.ChatCompletionRequest request) - Specified by:
doChatCompletion
in classAbstractFunctionCallSupport<MistralAiApi.ChatCompletionMessage,
MistralAiApi.ChatCompletionRequest, org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion>>
-
isToolFunctionCall
protected boolean isToolFunctionCall(org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion> chatCompletion) - Specified by:
isToolFunctionCall
in classAbstractFunctionCallSupport<MistralAiApi.ChatCompletionMessage,
MistralAiApi.ChatCompletionRequest, org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion>>
-