Class OllamaChatOptions
java.lang.Object
org.springframework.ai.ollama.api.OllamaChatOptions
- All Implemented Interfaces:
ChatOptions,ModelOptions,StructuredOutputChatOptions,ToolCallingChatOptions
public class OllamaChatOptions
extends Object
implements ToolCallingChatOptions, StructuredOutputChatOptions
Helper class for creating strongly-typed Ollama options.
- Since:
- 0.8.0
- Author:
- Christian Tzolov, Thomas Vitale, Ilayaperumal Gopinathan, Nicolas Krier, Sebastien Deleuze
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOllamaChatOptions(@Nullable Boolean useNUMA, @Nullable Integer numCtx, @Nullable Integer numBatch, @Nullable Integer numGPU, @Nullable Integer mainGPU, @Nullable Boolean lowVRAM, @Nullable Boolean f16KV, @Nullable Boolean logitsAll, @Nullable Boolean vocabOnly, @Nullable Boolean useMMap, @Nullable Boolean useMLock, @Nullable Integer numThread, @Nullable Integer numKeep, @Nullable Integer seed, @Nullable Integer numPredict, @Nullable Integer topK, @Nullable Double topP, @Nullable Double minP, @Nullable Float tfsZ, @Nullable Float typicalP, @Nullable Integer repeatLastN, @Nullable Double temperature, @Nullable Double repeatPenalty, @Nullable Double presencePenalty, @Nullable Double frequencyPenalty, @Nullable Integer mirostat, @Nullable Float mirostatTau, @Nullable Float mirostatEta, @Nullable Boolean penalizeNewline, @Nullable List<String> stop, @Nullable String model, @Nullable Object format, @Nullable String keepAlive, @Nullable Boolean truncate, @Nullable ThinkOption thinkOption, @Nullable List<ToolCallback> toolCallbacks, @Nullable Map<String, Object> toolContext) -
Method Summary
Modifier and TypeMethodDescriptionstatic OllamaChatOptions.Builderbuilder()A builder to create a newToolCallingChatOptionsinstance.booleanfilterNonSupportedFields(Map<String, Object> options) Filter out the non-supported fields from the options.@Nullable BooleangetF16KV()@Nullable Object@Nullable DoubleReturns the frequency penalty to use for the chat.@Nullable String@Nullable Boolean@Nullable Boolean@Nullable Integer@Nullable IntegerReturns the maximum number of tokens to use for the chat.@Nullable DoublegetMinP()@Nullable Integer@Nullable Float@Nullable FloatgetModel()Returns the model to use for the chat.@Nullable Integer@Nullable Integer@Nullable Integer@Nullable Integer@Nullable Integer@Nullable Integer@Nullable String@Nullable Boolean@Nullable DoubleReturns the presence penalty to use for the chat.@Nullable Integer@Nullable Double@Nullable IntegergetSeed()getStop()Returns the stop sequences to use for the chat.@Nullable DoubleReturns the temperature to use for the chat.@Nullable FloatgetTfsZ()@Nullable ThinkOption@Nullable List<ToolCallback>ToolCallbacks to be registered with the ChatModel.Get the configured tool context.@Nullable IntegergetTopK()Returns the top K to use for the chat.@Nullable DoublegetTopP()Returns the top P to use for the chat.@Nullable Boolean@Nullable Float@Nullable Boolean@Nullable Boolean@Nullable Boolean@Nullable BooleaninthashCode()mutate()Returns a newToolCallingChatOptions.Builderinitialized with the values of thisToolCallingChatOptions.toMap()Convert theOllamaChatOptionsobject to aMapof key/value pairs.
-
Constructor Details
-
OllamaChatOptions
protected OllamaChatOptions(@Nullable Boolean useNUMA, @Nullable Integer numCtx, @Nullable Integer numBatch, @Nullable Integer numGPU, @Nullable Integer mainGPU, @Nullable Boolean lowVRAM, @Nullable Boolean f16KV, @Nullable Boolean logitsAll, @Nullable Boolean vocabOnly, @Nullable Boolean useMMap, @Nullable Boolean useMLock, @Nullable Integer numThread, @Nullable Integer numKeep, @Nullable Integer seed, @Nullable Integer numPredict, @Nullable Integer topK, @Nullable Double topP, @Nullable Double minP, @Nullable Float tfsZ, @Nullable Float typicalP, @Nullable Integer repeatLastN, @Nullable Double temperature, @Nullable Double repeatPenalty, @Nullable Double presencePenalty, @Nullable Double frequencyPenalty, @Nullable Integer mirostat, @Nullable Float mirostatTau, @Nullable Float mirostatEta, @Nullable Boolean penalizeNewline, @Nullable List<String> stop, @Nullable String model, @Nullable Object format, @Nullable String keepAlive, @Nullable Boolean truncate, @Nullable ThinkOption thinkOption, @Nullable List<ToolCallback> toolCallbacks, @Nullable Map<String, Object> toolContext)
-
-
Method Details
-
builder
Description copied from interface:ToolCallingChatOptionsA builder to create a newToolCallingChatOptionsinstance.- Returns:
- Returns a new
ChatOptions.Builder.
-
filterNonSupportedFields
Filter out the non-supported fields from the options.- Parameters:
options- The options to filter.- Returns:
- The filtered options.
-
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
-
getFormat
-
getKeepAlive
-
getUseNUMA
-
getNumCtx
-
getNumBatch
-
getNumGPU
-
getMainGPU
-
getLowVRAM
-
getF16KV
-
getLogitsAll
-
getVocabOnly
-
getUseMMap
-
getUseMLock
-
getNumThread
-
getNumKeep
-
getSeed
-
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
-
getNumPredict
-
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
-
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
-
getMinP
-
getTfsZ
-
getTypicalP
-
getRepeatLastN
-
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
-
getRepeatPenalty
-
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
-
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
-
getMirostat
-
getMirostatTau
-
getMirostatEta
-
getPenalizeNewline
-
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
-
getStop
-
getTruncate
-
getThinkOption
-
getToolCallbacks
Description copied from interface:ToolCallingChatOptionsToolCallbacks to be registered with the ChatModel.- Specified by:
getToolCallbacksin interfaceToolCallingChatOptions
-
getToolContext
Description copied from interface:ToolCallingChatOptionsGet the configured tool context.- Specified by:
getToolContextin interfaceToolCallingChatOptions- Returns:
- the tool context map.
-
getOutputSchema
- Specified by:
getOutputSchemain interfaceStructuredOutputChatOptions
-
toMap
Convert theOllamaChatOptionsobject to aMapof key/value pairs.- Returns:
- The
Mapof key/value pairs.
-
mutate
Description copied from interface:ToolCallingChatOptionsReturns a newToolCallingChatOptions.Builderinitialized with the values of thisToolCallingChatOptions. Narrows the return type ofChatOptions.mutate()so generic tool calling code can chain methods without casting.- Specified by:
mutatein interfaceChatOptions- Specified by:
mutatein interfaceStructuredOutputChatOptions- Specified by:
mutatein interfaceToolCallingChatOptions
-
equals
-
hashCode
public int hashCode()
-