refactor: update CoreMemory to v2 and rename OllamaToolResponse
build / build (push) Has been cancelled
build / build (push) Has been cancelled
- Refactored `CoreMemory` to support versioning (v2) and dual-memory types: `MAPPED_MEMORY` (key-value) and `ARRAYED_MEMORY` (sequential). - Added automatic migration logic for v1 memory files to v2. - Introduced new memory tools: `AddArrayMemory`, `GetArrayMemory`, and `GetArrayedMemories`. - Renamed `OllamaToolRespnce` to `OllamaToolResponse` and added `empty()` factory methods for better error handling. - Updated multiple function tools (e.g., `GetMemoryFunction`, `GetMemoriesFunction`, `APITool`, `GetWikiPageText`) to use the new `OllamaToolResponse` and `Optional`-based memory retrieval. - Improved null safety by adding `@NotNull` annotations to tool implementations.
This commit is contained in:
@@ -2,7 +2,7 @@ package me.zacharias.neuro.dock.genius.endpoints;
|
||||
|
||||
import me.zacharias.chat.ollama.OllamaFunctionArgument;
|
||||
import me.zacharias.chat.ollama.OllamaPerameter;
|
||||
import me.zacharias.chat.ollama.OllamaToolRespnce;
|
||||
import me.zacharias.chat.ollama.OllamaToolResponse;
|
||||
import me.zacharias.chat.ollama.exceptions.OllamaToolErrorException;
|
||||
import me.zacharias.neuro.dock.genius.GeniusEndpoint;
|
||||
import me.zacharias.neuro.dock.genius.GeniusEndpointTool;
|
||||
@@ -39,7 +39,7 @@ public class FindSong extends GeniusEndpointTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public OllamaToolRespnce function(OllamaFunctionArgument... args) {
|
||||
public @NotNull OllamaToolResponse function(OllamaFunctionArgument... args) {
|
||||
String title = (String) args[0].value();
|
||||
if (title == null || title.isEmpty()) {
|
||||
throw new OllamaToolErrorException(this.name(), "Title cannot be null or empty.");
|
||||
@@ -64,6 +64,6 @@ public class FindSong extends GeniusEndpointTool {
|
||||
throw new OllamaToolErrorException(this.name(), "No songs found for the given title.");
|
||||
}
|
||||
|
||||
return new OllamaToolRespnce(this.name(), responseData.toString());
|
||||
return new OllamaToolResponse(this.name(), responseData.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package me.zacharias.neuro.dock.genius.endpoints;
|
||||
|
||||
import me.zacharias.chat.ollama.OllamaFunctionArgument;
|
||||
import me.zacharias.chat.ollama.OllamaPerameter;
|
||||
import me.zacharias.chat.ollama.OllamaToolRespnce;
|
||||
import me.zacharias.chat.ollama.OllamaToolResponse;
|
||||
import me.zacharias.chat.ollama.exceptions.OllamaToolErrorException;
|
||||
import me.zacharias.neuro.dock.genius.GeniusEndpoint;
|
||||
import me.zacharias.neuro.dock.genius.GeniusEndpointTool;
|
||||
@@ -56,7 +56,7 @@ public class GetLyrics extends GeniusEndpointTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public OllamaToolRespnce function(OllamaFunctionArgument... args) {
|
||||
public @NotNull OllamaToolResponse function(OllamaFunctionArgument... args) {
|
||||
|
||||
if(!( args[0].value() instanceof Integer)) {
|
||||
throw new OllamaToolErrorException(this.name(), "The song_id must be an integer.");
|
||||
@@ -66,7 +66,7 @@ public class GetLyrics extends GeniusEndpointTool {
|
||||
|
||||
if(lyricsStr != null)
|
||||
{
|
||||
return new OllamaToolRespnce(this.name(), lyricsStr.trim());
|
||||
return new OllamaToolResponse(this.name(), lyricsStr.trim());
|
||||
}
|
||||
|
||||
JSONObject obj = geniusToolsInstance.getGeniusEndpoint("/songs/" + args[0].value(), null);
|
||||
@@ -116,7 +116,7 @@ public class GetLyrics extends GeniusEndpointTool {
|
||||
|
||||
geniusToolsInstance.cacheLyrics((int) args[0].value(), lyrics.toString());
|
||||
|
||||
return new OllamaToolRespnce(this.name(), lyrics.toString().trim());
|
||||
return new OllamaToolResponse(this.name(), lyrics.toString().trim());
|
||||
}catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user