Class Core

java.lang.Object
me.zacharias.chat.core.Core

public class Core extends Object
The Main class for the System, responsible for managing the OllamaObject, tools, and the Ollama API.
  • Field Details

    • DATA

      public static String DATA
    • DATA_DIR

      public static File DATA_DIR
    • PLUGIN_DIRECTORY

      public static File PLUGIN_DIRECTORY
    • CACHE_DIRECTORY

      public static File CACHE_DIRECTORY
  • Constructor Details

    • Core

      public Core(@NotNull @NotNull PrintAdvanceMessageHandler printMessageHandler)
      Creates a new instance of Core with the provided PrintMessageHandler
      Parameters:
      printMessageHandler - The PrintMessageHandler to use as the default Output
    • Core

      public Core(@NotNull @NotNull PrintAdvanceMessageHandler printMessageHandler, @NotNull @NotNull String ollamaIP)
      Creates a new instance of Core with the provided PrintMessageHandler, with a specific IP used for Ollama
      Parameters:
      printMessageHandler - The PrintMessageHandler to use as the default Output
      ollamaIP - The IP used for the Ollama backend
  • Method Details

    • setDataDirectory

      public static void setDataDirectory(String dataDirectory)
    • setOllamaObject

      public void setOllamaObject(OllamaObject ollamaObject)
      Sets the ollamaObject object to the provided argument, Also adds the memory base system. see setOllamaObjectNoMemory(OllamaObject) if you don't want to add memory functions
      Parameters:
      ollamaObject - The OllamaObject to use
    • setOllamaObjectNoMemory

      public void setOllamaObjectNoMemory(OllamaObject ollamaObject)
      Sets the ollamaObject object to the provided argument, Dose not add the base system for memory. see setOllamaObject(OllamaObject) if you want to add memory function
      Parameters:
      ollamaObject - The OllamaObject to use
    • addTool

      public void addTool(OllamaFunctionTool functionTool, String source)
      Adds a new tool to the System
      Parameters:
      functionTool - The tool to add
      source - The source of the tool
    • addTools

      public void addTools(OllamaFunctionTools tools)
      Adds a list of tools to the System
      Parameters:
      tools - The tools to add
    • getFuntionTools

      public ArrayList<Pair<OllamaFunctionTool, String>> getFuntionTools()
      Gets the list of tools added to the System
      Returns:
      The list of tools added to the System compressed as Pairs of the tool and the source
    • getOllamaObject

      public OllamaObject getOllamaObject()
      Gets the Ollama Object
      Returns:
      The Ollama Object
    • removeTool

      public void removeTool(String name)
    • flushLog

      public static void flushLog()
      Flushes the log file
    • qurryOllama

      public org.json.JSONObject qurryOllama()
      Sends the OllamaObject to Ollama
      Returns:
      The response from Ollama
    • handleResponce

      public void handleResponce(org.json.JSONObject responce)
      Handles the response from Ollama By Processing the response, handles Function Calls, Logs relevant information, Appends information to the OllamaObject, Prints messages to the User.
      Parameters:
      responce - The response from Ollama
    • writeLog

      public static void writeLog(String message)
      Writes a message to the log file
      Parameters:
      message - The message to write
    • enablePlugins

      public void enablePlugins(File pluginDirectory)