Updated OllamaFunctionTool.toString to reflect what the Ollama API actually wants
build / build (push) Has been cancelled

Added @NotNull annotation to OllamaFunctionTool.name and OllamaFunctionTool.parameters since the documentation reports as these being required

Made sure that OllamaFunctionTool.description is actually optional as the Ollama API docs define
This commit is contained in:
2026-05-05 22:27:36 +02:00
parent b1aa35e1b1
commit a33a37ec0a
17 changed files with 66 additions and 45 deletions
@@ -7,6 +7,7 @@ import me.zacharias.chat.ollama.exceptions.OllamaToolErrorException;
import me.zacharias.neuro.dock.genius.GeniusEndpoint;
import me.zacharias.neuro.dock.genius.GeniusEndpointTool;
import me.zacharias.neuro.dock.genius.GeniusTools;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -21,7 +22,7 @@ public class FindSong extends GeniusEndpointTool {
}
@Override
public String name() {
public @NotNull String name() {
return "findsong";
}
@@ -31,7 +32,7 @@ public class FindSong extends GeniusEndpointTool {
}
@Override
public OllamaPerameter parameters() {
public @NotNull OllamaPerameter parameters() {
return OllamaPerameter.builder()
.addProperty("title", STRING, "The title, artitst, and song_id of the song to find.", true)
.build();
@@ -7,6 +7,7 @@ import me.zacharias.chat.ollama.exceptions.OllamaToolErrorException;
import me.zacharias.neuro.dock.genius.GeniusEndpoint;
import me.zacharias.neuro.dock.genius.GeniusEndpointTool;
import me.zacharias.neuro.dock.genius.GeniusTools;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
@@ -15,8 +16,6 @@ import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
import org.jsoup.select.Elements;
import java.util.stream.Collectors;
import static me.zacharias.chat.core.Core.writeLog;
/**
@@ -40,7 +39,7 @@ public class GetLyrics extends GeniusEndpointTool {
}
@Override
public String name() {
public @NotNull String name() {
return "get_lyrics";
}
@@ -50,7 +49,7 @@ public class GetLyrics extends GeniusEndpointTool {
}
@Override
public OllamaPerameter parameters() {
public @NotNull OllamaPerameter parameters() {
return OllamaPerameter.builder()
.addProperty("song_id", OllamaPerameter.OllamaPerameterBuilder.Type.INT, "The ID of the song to get lyrics for.", true)
.build();