mirror of
https://github.com/amithkoujalgi/ollama4j.git
synced 2025-11-02 09:30:41 +01:00
Adds documentation for annotation based Tool registration
This commit is contained in:
@@ -317,7 +317,7 @@ class TestRealAPIs {
|
||||
List<OllamaChatToolCalls> toolCalls = chatResult.getChatHistory().get(1).getToolCalls();
|
||||
assertEquals(1, toolCalls.size());
|
||||
OllamaToolCallsFunction function = toolCalls.get(0).getFunction();
|
||||
assertEquals("computeMkeConstant", function.getName());
|
||||
assertEquals("computeImportantConstant", function.getName());
|
||||
assertEquals(1, function.getArguments().size());
|
||||
Object noOfDigits = function.getArguments().get("noOfDigits");
|
||||
assertNotNull(noOfDigits);
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.math.BigDecimal;
|
||||
public class AnnotatedTool {
|
||||
|
||||
@ToolSpec(desc = "Computes the most important constant all around the globe!")
|
||||
public String computeMkeConstant(@ToolProperty(name = "noOfDigits",desc = "Number of digits that shall be returned") Integer noOfDigits ){
|
||||
public String computeImportantConstant(@ToolProperty(name = "noOfDigits",desc = "Number of digits that shall be returned") Integer noOfDigits ){
|
||||
return BigDecimal.valueOf((long)(Math.random()*1000000L),noOfDigits).toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user