Class Core
java.lang.Object
me.neurodock.core.Core
The Main class for the System, responsible for managing the OllamaObject, tools, and the Ollama API.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCore(@NotNull PrintAdvanceMessageHandler printMessageHandler) Creates a new instance of Core with the provided PrintMessageHandler, defaulting the Ollama backend tolocalhost.Core(@NotNull PrintAdvanceMessageHandler printMessageHandler, @NotNull String ollamaIP) Creates a new instance of Core with the provided PrintMessageHandler and a specific Ollama backend address. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTool(OllamaFunctionTool functionTool, String source) Adds a new tool to the SystemvoidaddTools(OllamaFunctionTools tools) Adds a list of tools to the SystemvoidenablePlugins(File pluginDirectory) static voidflushLog()Flushes the log fileGets the list of tools added to the SystemGets the Ollama ObjectvoidhandleResponce(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.org.json.JSONObjectSends the OllamaObject to OllamavoidremoveTool(String name) Removes a tool with a given namestatic voidsetDataDirectory(String dataDirectory) Set the data directory in appropriate locations depending on the host OS, falling back to $WORKING_DIR/datavoidsetOllamaObject(OllamaObject ollamaObject) Sets theollamaObjectobject to the provided argument, Also adds the memory base system.voidsetOllamaObjectNoMemory(OllamaObject ollamaObject) Sets theollamaObjectobject to the provided argument, Dose not add the base system for memory.static voidWrites a message to the log file
-
Field Details
-
DATA
-
DATA_DIR
-
PLUGIN_DIRECTORY
-
CACHE_DIRECTORY
-
-
Constructor Details
-
Core
Creates a new instance of Core with the provided PrintMessageHandler, defaulting the Ollama backend tolocalhost.- 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 and a specific Ollama backend address.- Parameters:
printMessageHandler- The PrintMessageHandler to use as the default outputollamaIP- The IP or hostname of the Ollama backend
-
-
Method Details
-
setDataDirectory
Set the data directory in appropriate locations depending on the host OS, falling back to $WORKING_DIR/data- Parameters:
dataDirectory- the data directory to use
-
setOllamaObject
Sets theollamaObjectobject to the provided argument, Also adds the memory base system. SeesetOllamaObjectNoMemory(OllamaObject)if you don't want to add memory functions- Parameters:
ollamaObject- The OllamaObject to use
-
setOllamaObjectNoMemory
Sets theollamaObjectobject to the provided argument, Dose not add the base system for memory. seesetOllamaObject(OllamaObject)if you want to add memory function- Parameters:
ollamaObject- The OllamaObject to use
-
addTool
Adds a new tool to the System- Parameters:
functionTool- The tool to addsource- The source of the tool
-
addTools
Adds a list of tools to the System- Parameters:
tools- The tools to add
-
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
-
removeTool
Removes a tool with a given name- Parameters:
name- The tool to remove
-
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
Writes a message to the log file- Parameters:
message- The message to write
-
enablePlugins
-