Class OllamaObject
java.lang.Object
me.neurodock.ollama.OllamaObject
Represents an Ollama Object.
This is used to represent the state of the Ollama Object.
This is used by the Core to store the state of the Ollama Object.
This is used by the API to send the state of the Ollama Object to the client.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a builder for OllamaObject. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAllMessages(List<OllamaMessage> messages) Adds all messages from a povided list to thisOllamaObjectvoidaddMessage(OllamaMessage message) Adds a message to the Ollama ObjectvoidaddTool(OllamaTool tool, String source) Adds a tool to the Ollama Objectbuilder()Creates a new instance of OllamaObjectBuilder.Returns the current list of messages, AND clears them.org.json.JSONObjectGets the format of the Ollama Object.Gets the keep alive of the Ollama Object.Gets the messagesgetModel()Gets the model of the Ollama Object.Gets the options of the Ollama Object.getTools()Gets the toolsbooleanisStream()Gets if the Ollama Object is streamed.voidremoveTool(OllamaTool tool) voidsetSystemMessage(String message) Sets the system message, replacing any existing one at the start ofmessages, or inserting one at the start if none exists yet.voidsetSystemPrompt(LLMSystemPrompt prompt) Replaces the current system prompt if one exists at the start ofmessages, or inserts one at the start if none exists yet.org.json.JSONObjecttoJSON()
-
Method Details
-
getModel
Gets the model of the Ollama Object.- Returns:
- The model of the Ollama Object
-
getMessages
-
getTools
-
addTool
Adds a tool to the Ollama Object- Parameters:
tool- The tool to add
-
removeTool
-
getFormat
public org.json.JSONObject getFormat()Gets the format of the Ollama Object.- Returns:
- The format of the Ollama Object
-
getOptions
-
isStream
public boolean isStream()Gets if the Ollama Object is streamed.- Returns:
- If the Ollama Object is streamed
-
getKeep_alive
Gets the keep alive of the Ollama Object.- Returns:
- The keep alive of the Ollama Object
-
addMessage
Adds a message to the Ollama Object- Parameters:
message- The message to add
-
dumpMessages
Returns the current list of messages, AND clears them. You will need to re-submit the System prompt if you had one- Returns:
- an ArrayList containing all messages stored in this
OllamaObject
-
addAllMessages
Adds all messages from a povided list to thisOllamaObject- Parameters:
messages- the message list to add
-
setSystemMessage
Sets the system message, replacing any existing one at the start ofmessages, or inserting one at the start if none exists yet.- Parameters:
message- the system message text
-
setSystemPrompt
Replaces the current system prompt if one exists at the start ofmessages, or inserts one at the start if none exists yet. -
toJSON
public org.json.JSONObject toJSON() -
builder
Creates a new instance of OllamaObjectBuilder.- Returns:
- The
OllamaObject.OllamaObjectBuilder
-