From 1f28e61234ab713483befc1d5f1178e57abaf00b Mon Sep 17 00:00:00 2001 From: Amith Koujalgi Date: Thu, 9 Nov 2023 11:55:00 +0530 Subject: [PATCH] Updated readme --- README.md | 7 ++++--- .../amithkoujalgi/ollama4j/core/models/Model.java | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 30137ab..0d28330 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,8 @@ public class Main { public static void main(String[] args) throws Exception { String host = "http://localhost:11434/"; OllamaAPI ollamaAPI = new OllamaAPI(host); - ollamaAPI.createModel("mycustommodel", "/path/to/modelfile/on/ollama-server"); + ollamaAPI.setVerbose(false); + ollamaAPI.deleteModel("mycustommodel", true); } } ``` @@ -183,7 +184,7 @@ public class Main { public static void main(String[] args) { String host = "http://localhost:11434/"; OllamaAPI ollamaAPI = new OllamaAPI(host); - String response = ollamaAPI.runSync(OllamaModel.LLAMA2, "Who are you?"); + String response = ollamaAPI.ask(OllamaModel.LLAMA2, "Who are you?"); System.out.println(response); } } @@ -196,7 +197,7 @@ public class Main { public static void main(String[] args) { String host = "http://localhost:11434/"; OllamaAPI ollamaAPI = new OllamaAPI(host); - OllamaAsyncResultCallback ollamaAsyncResultCallback = ollamaAPI.runAsync(OllamaModel.LLAMA2, "Who are you?"); + OllamaAsyncResultCallback ollamaAsyncResultCallback = ollamaAPI.askAsync(OllamaModel.LLAMA2, "Who are you?"); while (true) { if (ollamaAsyncResultCallback.isComplete()) { System.out.println(ollamaAsyncResultCallback.getResponse()); diff --git a/src/main/java/io/github/amithkoujalgi/ollama4j/core/models/Model.java b/src/main/java/io/github/amithkoujalgi/ollama4j/core/models/Model.java index 6f4493e..1c8afe0 100644 --- a/src/main/java/io/github/amithkoujalgi/ollama4j/core/models/Model.java +++ b/src/main/java/io/github/amithkoujalgi/ollama4j/core/models/Model.java @@ -4,14 +4,26 @@ public class Model { private String name, modified_at, digest; private Long size; + /** + * Returns the model's tag. This includes model name and its version separated by a colon character `:` + * @return model tag + */ public String getName() { return name; } + /** + * Returns the model name without its version + * @return model name + */ public String getModelName() { return name.split(":")[0]; } + /** + * Returns the model version without its name + * @return model version + */ public String getModelVersion() { return name.split(":")[1]; }