Class OllamaFunctionTool

java.lang.Object
me.neurodock.ollama.OllamaFunctionTool
All Implemented Interfaces:
OllamaTool
Direct Known Subclasses:
AddArrayMemory, AddMemoryFunction, GetArrayedMemories, GetArrayMemory, GetMemoriesFunction, GetMemoryFunction, GetMemoryIdentitiesFunction, ReadFileTool, RemoveMemoryFunction

public abstract class OllamaFunctionTool extends Object implements OllamaTool
Represents a tool that Ollama can call.
  • Field Details

  • Constructor Details

    • OllamaFunctionTool

      public OllamaFunctionTool()
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • name

      @NotNull public abstract @NotNull String name()
      The name of the tool This is used by Ollama to know what the tool is
      Returns:
      The name of the tool
    • description

      public String description()
      The description of the tool This is used by Ollama to know what the tool does
      Returns:
      The description of the tool
    • parameters

      @NotNull public abstract @NotNull OllamaPerameter parameters()
      The parameters of the tool This is used by Ollama to know what parameters the tool takes If null, the tool does not take any parameters
      Returns:
      The parameters of the tool or null if the tool does not take any parameters
    • function

      @NotNull public abstract @NotNull OllamaToolResponse function(OllamaFunctionArgument... args)
      The function of the tool.
      This is used by Ollama to call the tool.
      Throw OllamaToolErrorException if the tool encounters an error instead of normal exceptions. The OllamaToolErrorException gets handled more gracefully by Core.handleResponce(JSONObject)
      Parameters:
      args - The arguments to pass to the tool, if any
      Returns:
      The response from the tool, if null return OllamaToolResponse
      Throws:
      OllamaToolErrorException - If the tool encounters an error