Updated OllamaFunctionTool.toString to reflect what the Ollama API actually wants
build / build (push) Has been cancelled
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:
@@ -1,9 +1,6 @@
|
||||
package me.zacharias.chat.display;
|
||||
|
||||
import com.github.dockerjava.api.DockerClient;
|
||||
import com.github.dockerjava.api.async.ResultCallback;
|
||||
import com.github.dockerjava.api.command.*;
|
||||
import com.github.dockerjava.api.model.Frame;
|
||||
import com.github.dockerjava.api.model.HostConfig;
|
||||
import com.github.dockerjava.core.DefaultDockerClientConfig;
|
||||
import com.github.dockerjava.core.DockerClientImpl;
|
||||
@@ -14,8 +11,10 @@ import me.zacharias.chat.core.Pair;
|
||||
import me.zacharias.chat.ollama.*;
|
||||
import me.zacharias.chat.ollama.exceptions.OllamaToolErrorException;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.ServerSocket;
|
||||
@@ -28,7 +27,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static me.zacharias.chat.core.Core.writeLog;
|
||||
|
||||
@@ -266,7 +264,7 @@ public class PythonRunner extends OllamaFunctionTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
public @NonNull String name() {
|
||||
return "python_runner";
|
||||
}
|
||||
|
||||
@@ -276,7 +274,7 @@ public class PythonRunner extends OllamaFunctionTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public OllamaPerameter parameters() {
|
||||
public @NotNull OllamaPerameter parameters() {
|
||||
return OllamaPerameter.builder()
|
||||
.addProperty("code", OllamaPerameter.OllamaPerameterBuilder.Type.STRING, "The code to be executed, optional if a file with the same name exists.")
|
||||
.addProperty("name", OllamaPerameter.OllamaPerameterBuilder.Type.STRING, "The name of the python code")
|
||||
|
||||
@@ -4,6 +4,8 @@ import me.zacharias.chat.ollama.OllamaFunctionArgument;
|
||||
import me.zacharias.chat.ollama.OllamaFunctionTool;
|
||||
import me.zacharias.chat.ollama.OllamaPerameter;
|
||||
import me.zacharias.chat.ollama.OllamaToolRespnce;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -20,12 +22,12 @@ public class TimeTool extends OllamaFunctionTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
public @NonNull String name() {
|
||||
return "get_current_date";
|
||||
}
|
||||
|
||||
@Override
|
||||
public OllamaPerameter parameters() {
|
||||
public @NotNull OllamaPerameter parameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user