forked from Mirror/ollama4j
Refactor JSON logging and utility methods
Replaced manual pretty-printing of JSON in OllamaAPI with a new Utils.toJSON method for cleaner logging. Added private constructors to utility classes to prevent instantiation. Updated test and sample code for improved clarity and randomness.
This commit is contained in:
@@ -114,8 +114,7 @@ class OllamaAPIIntegrationTest {
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
void testPing()
|
||||
throws URISyntaxException, IOException, OllamaBaseException, InterruptedException {
|
||||
void testPing() throws OllamaBaseException {
|
||||
boolean pingResponse = api.ping();
|
||||
assertTrue(pingResponse, "Ping should return true");
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ package io.github.ollama4j.samples;
|
||||
import io.github.ollama4j.tools.annotations.ToolProperty;
|
||||
import io.github.ollama4j.tools.annotations.ToolSpec;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Random;
|
||||
|
||||
public class AnnotatedTool {
|
||||
|
||||
@@ -18,7 +19,8 @@ public class AnnotatedTool {
|
||||
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();
|
||||
return BigDecimal.valueOf((long) (new Random().nextLong() * 1000000L), noOfDigits)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@ToolSpec(desc = "Says hello to a friend!")
|
||||
|
||||
Reference in New Issue
Block a user