This commit is contained in:
Amith Koujalgi
2023-10-27 12:12:47 +05:30
parent e7351359a3
commit fd289fa39a
2 changed files with 28 additions and 9 deletions

View File

@@ -5,14 +5,8 @@ public class Main {
String host = "http://localhost:11434/";
OllamaAPI ollamaAPI = new OllamaAPI(host);
ollamaAPI.pullModel(OllamaModel.LLAMA2);
OllamaAsyncResultCallback ollamaAsyncResultCallback = ollamaAPI.runAsync(OllamaModel.LLAMA2, "Who are you?");
while (true) {
if (ollamaAsyncResultCallback.isComplete()) {
System.out.println(ollamaAsyncResultCallback.getResponse());
break;
}
Thread.sleep(1000);
}
String response = ollamaAPI.runSync(OllamaModel.LLAMA2, "Who are you?");
System.out.println(response);
}
}