forked from Chat_things/NeuroDock
Initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package me.zacharias.chat.ollama;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
public abstract class OllamaFuntionTool implements OllamaTool {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
JSONObject ret = new JSONObject();
|
||||
ret.put("tool", "function");
|
||||
|
||||
JSONObject function = new JSONObject();
|
||||
function.put("name", name());
|
||||
function.put("description", description());
|
||||
function.put("parameters", (parameters() == null?
|
||||
new JSONObject() : new JSONObject(parameters().toString())));
|
||||
|
||||
ret.put("function", function);
|
||||
|
||||
return ret.toString();
|
||||
}
|
||||
|
||||
abstract public String name();
|
||||
abstract public String description();
|
||||
abstract public OllamaPerameter parameters();
|
||||
|
||||
abstract public OllamaToolRespnce function(OllamaFunctionArgument... args);
|
||||
}
|
||||
Reference in New Issue
Block a user