Class OllamaRequestBody

java.lang.Object
com.developer.nefarious.zjoule.plugin.chat.ollama.OllamaRequestBody

public class OllamaRequestBody extends Object
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 Details

    • OllamaRequestBody

      public OllamaRequestBody()
  • Method Details

    • getModel

      public String getModel()
      Retrieves the name of the AI model.
      Returns:
      the model name as a String.
    • setModel

      public void setModel(String model)
      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

      public List<IChatMessage> getMessages()
      Retrieves the list of chat messages included in the request.
      Returns:
      a list of IChatMessage objects.
    • setMessages

      public void setMessages(List<IChatMessage> messages)
      Sets the list of chat messages to be included in the request.
      Parameters:
      messages - a list of IChatMessage objects.
    • toString

      public String toString()
      Serializes this object to its JSON representation using Gson.

      The Role.RoleSerializer is registered to handle role serialization.

      Overrides:
      toString in class Object
      Returns:
      the JSON representation of this request body as a String.