mirror of
https://github.com/amithkoujalgi/ollama4j.git
synced 2025-05-15 03:47:13 +02:00
Updated readme
This commit is contained in:
parent
2bdf0cc638
commit
1f28e61234
@ -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());
|
||||
|
@ -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];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user