Merge pull request #8 from omcodedthis/main

Added updated syntax & relevant dependencies
This commit is contained in:
Amith Koujalgi 2023-12-19 14:45:47 +05:30 committed by GitHub
commit cf0188c126
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,6 +78,17 @@ your `pom.xml`:
</repositories> </repositories>
``` ```
You should also include [SL4J](https://www.slf4j.org/) in your `pom.xml` file if you encounter any errors related to this.
```xml
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>2.0.9</version>
</dependency>
```
#### Build: #### Build:
Build your project to resolve the dependencies: Build your project to resolve the dependencies:
@ -236,8 +247,8 @@ public class Main {
public static void main(String[] args) { public static void main(String[] args) {
String host = "http://localhost:11434/"; String host = "http://localhost:11434/";
OllamaAPI ollamaAPI = new OllamaAPI(host); OllamaAPI ollamaAPI = new OllamaAPI(host);
String response = ollamaAPI.ask(OllamaModelType.LLAMA2, "Who are you?"); OllamaResult response = ollamaAPI.ask(OllamaModelType.LLAMA2, "Who are you?");
System.out.println(response); System.out.println(response.getResponse());
} }
} }
``` ```
@ -285,8 +296,8 @@ public class Main {
OllamaAPI ollamaAPI = new OllamaAPI(host); OllamaAPI ollamaAPI = new OllamaAPI(host);
String prompt = "List all cricket world cup teams of 2019."; String prompt = "List all cricket world cup teams of 2019.";
String response = ollamaAPI.ask(OllamaModelType.LLAMA2, prompt); OllamaResult response = ollamaAPI.ask(OllamaModelType.LLAMA2, prompt);
System.out.println(response); System.out.println(response.getResponse());
} }
} }
``` ```
@ -322,8 +333,8 @@ public class Main {
String prompt = SamplePrompts.getSampleDatabasePromptWithQuestion( String prompt = SamplePrompts.getSampleDatabasePromptWithQuestion(
"List all customer names who have bought one or more products"); "List all customer names who have bought one or more products");
String response = ollamaAPI.ask(OllamaModelType.SQLCODER, prompt); OllamaResult response = ollamaAPI.ask(OllamaModelType.SQLCODER, prompt);
System.out.println(response); System.out.println(response.getResponse());
} }
} }
``` ```