Class OllamaRequestBody
java.lang.Object
com.developer.nefarious.zjoule.plugin.chat.ollama.OllamaRequestBody
Represents the request body for sending chat interactions to the Ollama API.
This class contains the model name, streaming flag, and a list of chat messages.
It also provides serialization to JSON using the Gson
library.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the list of chat messages included in the request.getModel()
Retrieves the name of the AI model.boolean
isStream()
Checks if streaming is enabled for the chat response.void
setMessages
(List<IChatMessage> messages) Sets the list of chat messages to be included in the request.void
Sets the name of the AI model.void
setStream
(boolean stream) Enables or disables streaming for the chat response.toString()
Serializes this object to its JSON representation usingGson
.
-
Constructor Details
-
OllamaRequestBody
public OllamaRequestBody()
-
-
Method Details
-
getModel
Retrieves the name of the AI model.- Returns:
- the model name as a
String
.
-
setModel
Sets the name of the AI model.- Parameters:
model
- the model name to set.
-
isStream
public boolean isStream()Checks if streaming is enabled for the chat response.- Returns:
true
if streaming is enabled,false
otherwise.
-
setStream
public void setStream(boolean stream) Enables or disables streaming for the chat response.- Parameters:
stream
-true
to enable streaming,false
to disable.
-
getMessages
Retrieves the list of chat messages included in the request.- Returns:
- a list of
IChatMessage
objects.
-
setMessages
Sets the list of chat messages to be included in the request.- Parameters:
messages
- a list ofIChatMessage
objects.
-
toString
Serializes this object to its JSON representation usingGson
.The
Role.RoleSerializer
is registered to handle role serialization.
-