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
ConstructorsConstructorDescriptionMistralAiChatClient(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.ChatCompletionRequestdoCreateToolResponseRequest(MistralAiApi.ChatCompletionRequest previousRequest, MistralAiApi.ChatCompletionMessage responseMessage, List<MistralAiApi.ChatCompletionMessage> conversationHistory) protected MistralAiApi.ChatCompletionMessagedoGetToolResponseMessage(org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion> chatCompletion) protected List<MistralAiApi.ChatCompletionMessage>protected booleanisToolFunctionCall(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, resolveFunctionCallbacksMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.chat.ChatClient
callMethods 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:ModelClientExecutes a method call to the AI model.- Specified by:
callin interfaceChatClient- Specified by:
callin 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:StreamingModelClientExecutes a method call to the AI model.- Specified by:
streamin interfaceStreamingChatClient- Specified by:
streamin 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:
doCreateToolResponseRequestin classAbstractFunctionCallSupport<MistralAiApi.ChatCompletionMessage,MistralAiApi.ChatCompletionRequest, org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion>>
-
doGetUserMessages
protected List<MistralAiApi.ChatCompletionMessage> doGetUserMessages(MistralAiApi.ChatCompletionRequest request) - Specified by:
doGetUserMessagesin 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:
doGetToolResponseMessagein 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:
doChatCompletionin classAbstractFunctionCallSupport<MistralAiApi.ChatCompletionMessage,MistralAiApi.ChatCompletionRequest, org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion>>
-
isToolFunctionCall
protected boolean isToolFunctionCall(org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion> chatCompletion) - Specified by:
isToolFunctionCallin classAbstractFunctionCallSupport<MistralAiApi.ChatCompletionMessage,MistralAiApi.ChatCompletionRequest, org.springframework.http.ResponseEntity<MistralAiApi.ChatCompletion>>
-