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.
-
Constructor Summary
ConstructorsConstructorDescriptionCore(@NotNull PrintAdvanceMessageHandler printMessageHandler) Creates a new instance of Core with the provided PrintMessageHandler, defaulting the Ollama backend tolocalhost. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessage(Message message) voidAdds a new tool to the SystemvoidenablePlugins(File pluginDirectory) static voidEnsures that a directory exists at the given path, creating it if it does not.static voidflushLog()Flushes the log filegetModel()Gets the Ollama ObjectgetTools()Gets the list of tools added to the SystemvoidhandleResponse(Message response) Handles the response from Ollama.queryModel(Consumer<org.json.JSONObject> consumer) voidremoveTool(String name) Removes a tool with a given namestatic voidsetLogDirectory(String logDirectory) voidSets themodelobject to the provided argument, Also adds the memory base system.voidsetModelNoMemory(Model model) Sets themodelobject to the provided argument, Does not add the base system for memory.static voidWrites a message to the log file
-
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
-
-
Method Details
-
setLogDirectory
-
ensureDir
Ensures that a directory exists at the given path, creating it if it does not.- Parameters:
path- The path of the directory to create
-
getChatObject
-
setModel
Sets themodelobject to the provided argument, Also adds the memory base system. SeesetModelNoMemory(Model)if you don't want to add memory functions- Parameters:
model- The Model to use
-
setModelNoMemory
Sets themodelobject to the provided argument, Does not add the base system for memory. seesetModel(Model)if you want to add memory function- Parameters:
model- The Model to use
-
addTool
Adds a new tool to the System- Parameters:
functionTool- The tool to add
-
addMessage
-
getTools
-
getModel
-
removeTool
Removes a tool with a given name- Parameters:
name- The tool to remove
-
flushLog
public static void flushLog()Flushes the log file -
queryModel
-
queryModel
public CompletableFuture<Message> queryModel(Consumer<org.json.JSONObject> consumer) throws OperationNotSupportedException - Throws:
OperationNotSupportedException
-
handleResponse
Handles the response from Ollama.Processes tool calls, logs information, appends messages to the OllamaObject, and prints output to the user.
- Parameters:
response- The response from Ollama
-
writeLog
Writes a message to the log file- Parameters:
message- The message to write
-
enablePlugins
-