Package org.springframework.ai.mistralai
Class MistralAiChatOptions
java.lang.Object
org.springframework.ai.mistralai.MistralAiChatOptions
- All Implemented Interfaces:
ChatOptions,ModelOptions,StructuredOutputChatOptions,ToolCallingChatOptions
public class MistralAiChatOptions
extends Object
implements ToolCallingChatOptions, StructuredOutputChatOptions
Options for the Mistral AI Chat API.
- Since:
- 0.8.1
- Author:
- Ricken Bazolo, Christian Tzolov, Thomas Vitale, Alexandros Pappas, Jason Smith, Sebastien Deleuze
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic class -
Field Summary
Fields inherited from interface org.springframework.ai.model.tool.ToolCallingChatOptions
DEFAULT_TOOL_EXECUTION_ENABLED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMistralAiChatOptions(String model, @Nullable Double temperature, @Nullable Double topP, @Nullable Integer maxTokens, @Nullable Boolean safePrompt, @Nullable Integer randomSeed, @Nullable MistralAiApi.ChatCompletionRequest.ResponseFormat responseFormat, @Nullable List<String> stop, @Nullable Double frequencyPenalty, @Nullable Double presencePenalty, @Nullable Integer n, @Nullable List<MistralAiApi.FunctionTool> tools, @Nullable MistralAiApi.ChatCompletionRequest.ToolChoice toolChoice, @Nullable List<ToolCallback> toolCallbacks, @Nullable Set<String> toolNames, @Nullable Boolean internalToolExecutionEnabled, @Nullable Map<String, Object> toolContext) -
Method Summary
Modifier and TypeMethodDescriptionstatic MistralAiChatOptions.Builderbuilder()copy()Returns a copy of thisChatOptions.booleanstatic MistralAiChatOptionsfromOptions(MistralAiChatOptions fromOptions) Returns the frequency penalty to use for the chat.@Nullable BooleanWhether theChatModelis responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.@Nullable IntegerReturns the maximum number of tokens to use for the chat.getModel()Returns the model to use for the chat.@Nullable IntegergetN()@Nullable StringReturns the presence penalty to use for the chat.@Nullable IntegergetStop()Returns the stop sequences to use for the chat.@Nullable DoubleReturns the temperature to use for the chat.ToolCallbacks to be registered with the ChatModel.Get the configured tool context.Names of the tools to register with the ChatModel.@Nullable List<MistralAiApi.FunctionTool> getTools()@Nullable IntegergetTopK()Returns the top K to use for the chat.getTopP()Returns the top P to use for the chat.inthashCode()mutate()Returns a newChatOptions.Builderinitialized with the values of thisChatOptions.voidsetFrequencyPenalty(Double frequencyPenalty) voidsetInternalToolExecutionEnabled(@Nullable Boolean internalToolExecutionEnabled) Set whether theChatModelis responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.voidsetMaxTokens(@Nullable Integer maxTokens) voidvoidvoidsetOutputSchema(String outputSchema) voidsetPresencePenalty(Double presencePenalty) voidsetRandomSeed(@Nullable Integer randomSeed) voidsetResponseFormat(@Nullable MistralAiApi.ChatCompletionRequest.ResponseFormat responseFormat) voidsetSafePrompt(Boolean safePrompt) voidvoidsetStopSequences(List<String> stopSequences) voidsetTemperature(@Nullable Double temperature) voidsetToolCallbacks(List<ToolCallback> toolCallbacks) Set the ToolCallbacks to be registered with the ChatModel.voidsetToolChoice(@Nullable MistralAiApi.ChatCompletionRequest.ToolChoice toolChoice) voidsetToolContext(Map<String, Object> toolContext) Set the tool context values as map.voidsetToolNames(Set<String> toolNames) Set the names of the tools to register with the ChatModel.voidsetTools(@Nullable List<MistralAiApi.FunctionTool> tools) void
-
Constructor Details
-
MistralAiChatOptions
public MistralAiChatOptions() -
MistralAiChatOptions
protected MistralAiChatOptions(String model, @Nullable Double temperature, @Nullable Double topP, @Nullable Integer maxTokens, @Nullable Boolean safePrompt, @Nullable Integer randomSeed, @Nullable MistralAiApi.ChatCompletionRequest.ResponseFormat responseFormat, @Nullable List<String> stop, @Nullable Double frequencyPenalty, @Nullable Double presencePenalty, @Nullable Integer n, @Nullable List<MistralAiApi.FunctionTool> tools, @Nullable MistralAiApi.ChatCompletionRequest.ToolChoice toolChoice, @Nullable List<ToolCallback> toolCallbacks, @Nullable Set<String> toolNames, @Nullable Boolean internalToolExecutionEnabled, @Nullable Map<String, Object> toolContext)
-
-
Method Details
-
builder
-
fromOptions
-
getModel
Description copied from interface:ChatOptionsReturns the model to use for the chat.- Specified by:
getModelin interfaceChatOptions- Returns:
- the model to use for the chat
-
setModel
-
getMaxTokens
Description copied from interface:ChatOptionsReturns the maximum number of tokens to use for the chat.- Specified by:
getMaxTokensin interfaceChatOptions- Returns:
- the maximum number of tokens to use for the chat
-
setMaxTokens
-
getSafePrompt
-
setSafePrompt
-
getRandomSeed
-
setRandomSeed
-
getResponseFormat
-
setResponseFormat
public void setResponseFormat(@Nullable MistralAiApi.ChatCompletionRequest.ResponseFormat responseFormat) -
getStopSequences
Description copied from interface:ChatOptionsReturns the stop sequences to use for the chat.- Specified by:
getStopSequencesin interfaceChatOptions- Returns:
- the stop sequences to use for the chat
-
setStopSequences
-
getStop
-
setStop
-
getTools
-
setTools
-
getToolChoice
-
setToolChoice
-
getTemperature
Description copied from interface:ChatOptionsReturns the temperature to use for the chat.- Specified by:
getTemperaturein interfaceChatOptions- Returns:
- the temperature to use for the chat
-
setTemperature
-
getTopP
Description copied from interface:ChatOptionsReturns the top P to use for the chat.- Specified by:
getTopPin interfaceChatOptions- Returns:
- the top P to use for the chat
-
setTopP
-
getFrequencyPenalty
Description copied from interface:ChatOptionsReturns the frequency penalty to use for the chat.- Specified by:
getFrequencyPenaltyin interfaceChatOptions- Returns:
- the frequency penalty to use for the chat
-
setFrequencyPenalty
-
getPresencePenalty
Description copied from interface:ChatOptionsReturns the presence penalty to use for the chat.- Specified by:
getPresencePenaltyin interfaceChatOptions- Returns:
- the presence penalty to use for the chat
-
setPresencePenalty
-
getN
-
setN
-
getToolCallbacks
Description copied from interface:ToolCallingChatOptionsToolCallbacks to be registered with the ChatModel.- Specified by:
getToolCallbacksin interfaceToolCallingChatOptions
-
setToolCallbacks
Description copied from interface:ToolCallingChatOptionsSet the ToolCallbacks to be registered with the ChatModel.- Specified by:
setToolCallbacksin interfaceToolCallingChatOptions
-
getToolNames
Description copied from interface:ToolCallingChatOptionsNames of the tools to register with the ChatModel.- Specified by:
getToolNamesin interfaceToolCallingChatOptions
-
setToolNames
Description copied from interface:ToolCallingChatOptionsSet the names of the tools to register with the ChatModel.- Specified by:
setToolNamesin interfaceToolCallingChatOptions
-
getInternalToolExecutionEnabled
Description copied from interface:ToolCallingChatOptionsWhether theChatModelis responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.- Specified by:
getInternalToolExecutionEnabledin interfaceToolCallingChatOptions
-
setInternalToolExecutionEnabled
Description copied from interface:ToolCallingChatOptionsSet whether theChatModelis responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.- Specified by:
setInternalToolExecutionEnabledin interfaceToolCallingChatOptions
-
getTopK
Description copied from interface:ChatOptionsReturns the top K to use for the chat.- Specified by:
getTopKin interfaceChatOptions- Returns:
- the top K to use for the chat
-
getToolContext
Description copied from interface:ToolCallingChatOptionsGet the configured tool context.- Specified by:
getToolContextin interfaceToolCallingChatOptions- Returns:
- the tool context map.
-
setToolContext
Description copied from interface:ToolCallingChatOptionsSet the tool context values as map.- Specified by:
setToolContextin interfaceToolCallingChatOptions- Parameters:
toolContext- as map
-
getOutputSchema
- Specified by:
getOutputSchemain interfaceStructuredOutputChatOptions
-
setOutputSchema
- Specified by:
setOutputSchemain interfaceStructuredOutputChatOptions
-
copy
Description copied from interface:ChatOptionsReturns a copy of thisChatOptions.- Specified by:
copyin interfaceChatOptions- Returns:
- a copy of this
ChatOptions
-
mutate
Description copied from interface:ChatOptionsReturns a newChatOptions.Builderinitialized with the values of thisChatOptions. Concrete ChatOptions classes must override this to return the most concrete builder implementation.- Specified by:
mutatein interfaceChatOptions
-
hashCode
public int hashCode() -
equals
-