Class OllamaObject.OllamaObjectBuilder
java.lang.Object
me.zacharias.chat.ollama.OllamaObject.OllamaObjectBuilder
- Enclosing class:
OllamaObject
Represents a builder for OllamaObject.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddFileTools(String baseDirectory) Initializes theFileHandlersingleton with the given base directory and adds its tools.addMessage(OllamaMessage messages) Adds a message to the Ollama ObjectaddMessages(OllamaMessage... messages) Adds messages to the Ollama ObjectaddTool(OllamaTool tool) Adds a tool to the Ollama Object Assumes the tool is from an external source, seeaddTool(OllamaTool, String)to specify the sourceaddTool(OllamaTool tool, String source) Adds a tool to the Ollama Object This allows you to specify the source of the tool, seeaddTool(OllamaTool)to add a tool from an external sourceaddTools(ArrayList<Pair<? extends OllamaTool, String>> tools) Adds tools to the Ollama Object This allows you to specify the source of the tools, seeaddToolsExternal(ArrayList)} to add tools from an external sourceaddTools(Pair<OllamaTool, String>... tools) Adds tools to the Ollama Object This allows you to specify the source of the tools, seeaddTools(OllamaTool[])to add tools from an external sourceaddTools(OllamaTool... tools) Adds tools to the Ollama Object Assumes the tools are from an external source, seeaddTools(Pair[])} to specify the sourceaddToolsExternal(ArrayList<? extends OllamaTool> tools) Adds tools to the Ollama Object Assumes the tools are from an external source, seeaddTools(ArrayList)} to specify the sourcebuild()Builds theOllamaObjectSets the format of the Ollama Object as a JSON schema.keep_alive(int minutes) Sets the keep alive of the Ollama Object.keep_alive(String keep_alive) Sets the keep alive of the Ollama Object.
This is a string formated as "minutes"m or "hours"h or "days"dSets an option of the Ollama Object.Sets the options of the Ollama Object.Sets the model of the Ollama Objectstream(boolean stream) Deprecated.This should be false due to being broken in the current version of this system
-
Constructor Details
-
OllamaObjectBuilder
public OllamaObjectBuilder()Creates a new instance ofOllamaObject.OllamaObjectBuilder.
-
-
Method Details
-
format
Sets the format of the Ollama Object as a JSON schema.- Parameters:
format- The format of the Ollama Object as a JSON schema- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
options
Sets the options of the Ollama Object.- Parameters:
options- The options of the Ollama Object- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
option
Sets an option of the Ollama Object.- Parameters:
key- The key of the optionvalue- The value of the option- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
stream
Deprecated.This should be false due to being broken in the current version of this systemSets if the Ollama Object is streamed.- Parameters:
stream- If the Ollama Object is streamed- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
keep_alive
Sets the keep alive of the Ollama Object.
This is a string formated as "minutes"m or "hours"h or "days"d- Parameters:
keep_alive- The keep alive of the Ollama Object- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
keep_alive
Sets the keep alive of the Ollama Object.- Parameters:
minutes- The keep alive of the Ollama Object in minutes- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
addTool
Adds a tool to the Ollama Object Assumes the tool is from an external source, seeaddTool(OllamaTool, String)to specify the source- Parameters:
tool- The tool to add- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
addTool
Adds a tool to the Ollama Object This allows you to specify the source of the tool, seeaddTool(OllamaTool)to add a tool from an external source- Parameters:
tool- The tool to add- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
addToolsExternal
Adds tools to the Ollama Object Assumes the tools are from an external source, seeaddTools(ArrayList)} to specify the source- Parameters:
tools- The tools to add- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
addTools
public OllamaObject.OllamaObjectBuilder addTools(ArrayList<Pair<? extends OllamaTool, String>> tools) Adds tools to the Ollama Object This allows you to specify the source of the tools, seeaddToolsExternal(ArrayList)} to add tools from an external source- Parameters:
tools- The tools to add- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
addTools
Adds tools to the Ollama Object Assumes the tools are from an external source, seeaddTools(Pair[])} to specify the source- Parameters:
tools- The tools to add- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
addTools
@SafeVarargs public final OllamaObject.OllamaObjectBuilder addTools(Pair<OllamaTool, String>... tools) Adds tools to the Ollama Object This allows you to specify the source of the tools, seeaddTools(OllamaTool[])to add tools from an external source- Parameters:
tools- The tools to add- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
addMessages
Adds messages to the Ollama Object- Parameters:
messages- The messages to add- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
addMessage
Adds a message to the Ollama Object- Parameters:
messages- The message to add- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
setModel
Sets the model of the Ollama Object- Parameters:
model- The model of the Ollama Object- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
addFileTools
Initializes theFileHandlersingleton with the given base directory and adds its tools.The
FileHandleris intentionally constructed here rather than eagerly, as file access tooling should only be initialized if explicitly requested during object construction. Calling this afterbuild()is technically possible but not intended.- Parameters:
baseDirectory- the base directory for file access, seeFileHandlerLocation- Returns:
- The
OllamaObject.OllamaObjectBuilder
-
build
-