Class OllamaOptions
java.lang.Object
org.springframework.ai.ollama.api.OllamaOptions
- All Implemented Interfaces:
ChatOptions
,EmbeddingOptions
,ModelOptions
,ToolCallingChatOptions
Helper class for creating strongly-typed Ollama options.
- Since:
- 0.8.0
- Author:
- Christian Tzolov, Thomas Vitale, Ilayaperumal Gopinathan
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.springframework.ai.model.tool.ToolCallingChatOptions
DEFAULT_TOOL_EXECUTION_ENABLED
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OllamaOptions.Builder
builder()
A builder to create a newToolCallingChatOptions
instance.copy()
Returns a copy of thisChatOptions
.boolean
filterNonSupportedFields
(Map<String, Object> options) Filter out the non-supported fields from the options.static OllamaOptions
fromOptions
(OllamaOptions fromOptions) getF16KV()
Deprecated.Not supported in Ollama anymore.Returns the frequency penalty to use for the chat.Whether theChatModel
is responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.Deprecated.Not supported in Ollama anymore.Deprecated.Not supported in Ollama anymore.Returns the maximum number of tokens to use for the chat.getMinP()
Deprecated.Not supported in Ollama anymore.Deprecated.Not supported in Ollama anymore.Deprecated.Not supported in Ollama anymore.getModel()
Returns the model to use for the chat.Deprecated.Not supported in Ollama anymore.Returns the presence penalty to use for the chat.getSeed()
getStop()
Returns the stop sequences to use for the chat.Returns the temperature to use for the chat.getTfsZ()
Deprecated.Not supported in Ollama anymore.ToolCallbacks to be registered with the ChatModel.Get the configured tool context.Names of the tools to register with the ChatModel.getTopK()
Returns the top K to use for the chat.getTopP()
Returns the top P to use for the chat.Deprecated.Not supported in Ollama anymore.Deprecated.Not supported in Ollama anymore.Deprecated.Not supported in Ollama anymore.int
hashCode()
void
Deprecated.Not supported in Ollama anymore.void
void
setFrequencyPenalty
(Double frequencyPenalty) void
setInternalToolExecutionEnabled
(Boolean internalToolExecutionEnabled) Set whether theChatModel
is responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.void
setKeepAlive
(String keepAlive) void
setLogitsAll
(Boolean logitsAll) Deprecated.Not supported in Ollama anymore.void
setLowVRAM
(Boolean lowVRAM) Deprecated.Not supported in Ollama anymore.void
setMainGPU
(Integer mainGPU) void
setMaxTokens
(Integer maxTokens) void
void
setMirostat
(Integer mirostat) Deprecated.Not supported in Ollama anymore.void
setMirostatEta
(Float mirostatEta) Deprecated.Not supported in Ollama anymore.void
setMirostatTau
(Float mirostatTau) Deprecated.Not supported in Ollama anymore.void
void
setNumBatch
(Integer numBatch) void
void
void
setNumKeep
(Integer numKeep) void
setNumPredict
(Integer numPredict) void
setNumThread
(Integer numThread) void
setPenalizeNewline
(Boolean penalizeNewline) Deprecated.Not supported in Ollama anymore.void
setPresencePenalty
(Double presencePenalty) void
setRepeatLastN
(Integer repeatLastN) void
setRepeatPenalty
(Double repeatPenalty) void
void
void
setStopSequences
(List<String> stopSequences) void
setTemperature
(Double temperature) void
Deprecated.Not supported in Ollama anymore.void
setToolCallbacks
(List<ToolCallback> toolCallbacks) Set the ToolCallbacks to be registered with the ChatModel.void
setToolContext
(Map<String, Object> toolContext) Set the tool context values as map.void
setToolNames
(Set<String> toolNames) Set the names of the tools to register with the ChatModel.void
void
void
setTruncate
(Boolean truncate) void
setTypicalP
(Float typicalP) void
setUseMLock
(Boolean useMLock) Deprecated.Not supported in Ollama anymore.void
setUseMMap
(Boolean useMMap) void
setUseNUMA
(Boolean useNUMA) Deprecated.Not supported in Ollama anymore.void
setVocabOnly
(Boolean vocabOnly) Deprecated.Not supported in Ollama anymore.toMap()
Convert theOllamaOptions
object to aMap
of key/value pairs.
-
Constructor Details
-
OllamaOptions
public OllamaOptions()
-
-
Method Details
-
builder
Description copied from interface:ToolCallingChatOptions
A builder to create a newToolCallingChatOptions
instance.- 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.
-
fromOptions
-
getModel
Description copied from interface:ChatOptions
Returns the model to use for the chat.- Specified by:
getModel
in interfaceChatOptions
- Specified by:
getModel
in interfaceEmbeddingOptions
- Returns:
- the model to use for the chat
-
setModel
-
getFormat
-
setFormat
-
getKeepAlive
-
setKeepAlive
-
getUseNUMA
Deprecated.Not supported in Ollama anymore. -
setUseNUMA
Deprecated.Not supported in Ollama anymore. -
getNumCtx
-
setNumCtx
-
getNumBatch
-
setNumBatch
-
getNumGPU
-
setNumGPU
-
getMainGPU
-
setMainGPU
-
getLowVRAM
Deprecated.Not supported in Ollama anymore. -
setLowVRAM
Deprecated.Not supported in Ollama anymore. -
getF16KV
Deprecated.Not supported in Ollama anymore. -
setF16KV
Deprecated.Not supported in Ollama anymore. -
getLogitsAll
Deprecated.Not supported in Ollama anymore. -
setLogitsAll
Deprecated.Not supported in Ollama anymore. -
getVocabOnly
Deprecated.Not supported in Ollama anymore. -
setVocabOnly
Deprecated.Not supported in Ollama anymore. -
getUseMMap
-
setUseMMap
-
getUseMLock
Deprecated.Not supported in Ollama anymore. -
setUseMLock
Deprecated.Not supported in Ollama anymore. -
getNumThread
-
setNumThread
-
getNumKeep
-
setNumKeep
-
getSeed
-
setSeed
-
getMaxTokens
Description copied from interface:ChatOptions
Returns the maximum number of tokens to use for the chat.- Specified by:
getMaxTokens
in interfaceChatOptions
- Returns:
- the maximum number of tokens to use for the chat
-
setMaxTokens
-
getNumPredict
-
setNumPredict
-
getTopK
Description copied from interface:ChatOptions
Returns the top K to use for the chat.- Specified by:
getTopK
in interfaceChatOptions
- Returns:
- the top K to use for the chat
-
setTopK
-
getTopP
Description copied from interface:ChatOptions
Returns the top P to use for the chat.- Specified by:
getTopP
in interfaceChatOptions
- Returns:
- the top P to use for the chat
-
setTopP
-
getMinP
-
setMinP
-
getTfsZ
Deprecated.Not supported in Ollama anymore. -
setTfsZ
Deprecated.Not supported in Ollama anymore. -
getTypicalP
-
setTypicalP
-
getRepeatLastN
-
setRepeatLastN
-
getTemperature
Description copied from interface:ChatOptions
Returns the temperature to use for the chat.- Specified by:
getTemperature
in interfaceChatOptions
- Returns:
- the temperature to use for the chat
-
setTemperature
-
getRepeatPenalty
-
setRepeatPenalty
-
getPresencePenalty
Description copied from interface:ChatOptions
Returns the presence penalty to use for the chat.- Specified by:
getPresencePenalty
in interfaceChatOptions
- Returns:
- the presence penalty to use for the chat
-
setPresencePenalty
-
getFrequencyPenalty
Description copied from interface:ChatOptions
Returns the frequency penalty to use for the chat.- Specified by:
getFrequencyPenalty
in interfaceChatOptions
- Returns:
- the frequency penalty to use for the chat
-
setFrequencyPenalty
-
getMirostat
Deprecated.Not supported in Ollama anymore. -
setMirostat
Deprecated.Not supported in Ollama anymore. -
getMirostatTau
Deprecated.Not supported in Ollama anymore. -
setMirostatTau
Deprecated.Not supported in Ollama anymore. -
getMirostatEta
Deprecated.Not supported in Ollama anymore. -
setMirostatEta
Deprecated.Not supported in Ollama anymore. -
getPenalizeNewline
Deprecated.Not supported in Ollama anymore. -
setPenalizeNewline
Deprecated.Not supported in Ollama anymore. -
getStopSequences
Description copied from interface:ChatOptions
Returns the stop sequences to use for the chat.- Specified by:
getStopSequences
in interfaceChatOptions
- Returns:
- the stop sequences to use for the chat
-
setStopSequences
-
getStop
-
setStop
-
getTruncate
-
setTruncate
-
getToolCallbacks
Description copied from interface:ToolCallingChatOptions
ToolCallbacks to be registered with the ChatModel.- Specified by:
getToolCallbacks
in interfaceToolCallingChatOptions
-
setToolCallbacks
Description copied from interface:ToolCallingChatOptions
Set the ToolCallbacks to be registered with the ChatModel.- Specified by:
setToolCallbacks
in interfaceToolCallingChatOptions
-
getToolNames
Description copied from interface:ToolCallingChatOptions
Names of the tools to register with the ChatModel.- Specified by:
getToolNames
in interfaceToolCallingChatOptions
-
setToolNames
Description copied from interface:ToolCallingChatOptions
Set the names of the tools to register with the ChatModel.- Specified by:
setToolNames
in interfaceToolCallingChatOptions
-
getInternalToolExecutionEnabled
Description copied from interface:ToolCallingChatOptions
Whether theChatModel
is responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.- Specified by:
getInternalToolExecutionEnabled
in interfaceToolCallingChatOptions
-
setInternalToolExecutionEnabled
Description copied from interface:ToolCallingChatOptions
Set whether theChatModel
is responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.- Specified by:
setInternalToolExecutionEnabled
in interfaceToolCallingChatOptions
-
getDimensions
- Specified by:
getDimensions
in interfaceEmbeddingOptions
-
getToolContext
Description copied from interface:ToolCallingChatOptions
Get the configured tool context.- Specified by:
getToolContext
in interfaceToolCallingChatOptions
- Returns:
- the tool context map.
-
setToolContext
Description copied from interface:ToolCallingChatOptions
Set the tool context values as map.- Specified by:
setToolContext
in interfaceToolCallingChatOptions
- Parameters:
toolContext
- as map
-
toMap
Convert theOllamaOptions
object to aMap
of key/value pairs.- Returns:
- The
Map
of key/value pairs.
-
copy
Description copied from interface:ChatOptions
Returns a copy of thisChatOptions
.- Specified by:
copy
in interfaceChatOptions
- Returns:
- a copy of this
ChatOptions
-
equals
-
hashCode
public int hashCode()
-