mirror of
https://github.com/amithkoujalgi/ollama4j.git
synced 2025-05-15 20:07:10 +02:00
init
This commit is contained in:
parent
153f516d9f
commit
c74e70f3fa
@ -11,6 +11,7 @@ Install:
|
|||||||
From [Maven Central](https://s01.oss.sonatype.org/#nexus-search;quick~ollama4j):
|
From [Maven Central](https://s01.oss.sonatype.org/#nexus-search;quick~ollama4j):
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.amithkoujalgi</groupId>
|
<groupId>io.github.amithkoujalgi</groupId>
|
||||||
<artifactId>ollama4j</artifactId>
|
<artifactId>ollama4j</artifactId>
|
||||||
@ -21,9 +22,10 @@ From [Maven Central](https://s01.oss.sonatype.org/#nexus-search;quick~ollama4j):
|
|||||||
You might want to include the Maven repository to pull the ollama4j library from. Include this in your `pom.xml`:
|
You might want to include the Maven repository to pull the ollama4j library from. Include this in your `pom.xml`:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>ollama-from-ossrh</id>
|
<id>ollama4j-from-ossrh</id>
|
||||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
@ -36,6 +38,7 @@ mvn clean install
|
|||||||
```
|
```
|
||||||
|
|
||||||
Start Ollama Container:
|
Start Ollama Container:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run -v ~/ollama:/root/.ollama -p 11434:11434 ollama/ollama
|
docker run -v ~/ollama:/root/.ollama -p 11434:11434 ollama/ollama
|
||||||
```
|
```
|
||||||
@ -51,6 +54,7 @@ public class Main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Post a question to Ollama using Ollama4j:
|
Post a question to Ollama using Ollama4j:
|
||||||
|
|
||||||
Using sync API:
|
Using sync API:
|
||||||
@ -86,6 +90,7 @@ public class Main {
|
|||||||
```
|
```
|
||||||
|
|
||||||
You'd then get a response from Ollama:
|
You'd then get a response from Ollama:
|
||||||
|
|
||||||
```
|
```
|
||||||
I am LLaMA, an AI assistant developed by Meta AI that can understand and respond to human input in a conversational manner. I am trained on a massive dataset of text from the internet and can generate human-like responses to a wide range of topics and questions. I can be used to create chatbots, virtual assistants, and other applications that require natural language understanding and generation capabilities.
|
I am LLaMA, an AI assistant developed by Meta AI that can understand and respond to human input in a conversational manner. I am trained on a massive dataset of text from the internet and can generate human-like responses to a wide range of topics and questions. I can be used to create chatbots, virtual assistants, and other applications that require natural language understanding and generation capabilities.
|
||||||
```
|
```
|
||||||
|
@ -10,7 +10,7 @@ public class Main {
|
|||||||
OllamaAPI ollamaAPI = new OllamaAPI(host);
|
OllamaAPI ollamaAPI = new OllamaAPI(host);
|
||||||
|
|
||||||
String prompt1 = SamplePrompts.getSampleDatabasePromptWithQuestion("List all customer names who have bought one or more products");
|
String prompt1 = SamplePrompts.getSampleDatabasePromptWithQuestion("List all customer names who have bought one or more products");
|
||||||
String response1 = ollamaAPI.ask(OllamaModelType.LLAMA2, prompt1);
|
String response1 = ollamaAPI.ask(OllamaModelType.SQLCODER, prompt1);
|
||||||
System.out.println(response1);
|
System.out.println(response1);
|
||||||
|
|
||||||
String prompt2 = "Give me a list of world cup cricket teams.";
|
String prompt2 = "Give me a list of world cup cricket teams.";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user