An open API service indexing awesome lists of open source software.

https://github.com/parakeet-nest/parakeet4j

🦜🪺☕️ Parakeet4J is a Java library, made to simplify the development of small generative AI applications with Ollama 🦙.
https://github.com/parakeet-nest/parakeet4j

ai genai java llm ollama slm

Last synced: 18 days ago
JSON representation

🦜🪺☕️ Parakeet4J is a Java library, made to simplify the development of small generative AI applications with Ollama 🦙.

Awesome Lists containing this project

README

          

# 🦜🪺☕️ Parakeet4J

Parakeet4J is the simplest Java library to create **GenAI apps** with **[Ollama](https://ollama.com/)**.

> A GenAI app is an application that uses generative AI technology. Generative AI can create new text, images, or other content based on what it's been trained on. So a GenAI app could help you write a poem, design a logo, or even compose a song! These are still under development, but they have the potential to be creative tools for many purposes. - [Gemini](https://gemini.google.com)

> ✋ Parakeet4J is only for creating GenAI apps generating **text** (not image, music,...).

## Hello World!

```java
public class Hello
{
public static void main( String[] args )
{
Options options = new Options()
.setTemperature(0.0)
.setRepeatLastN(2);

var systemContent = "You are a useful AI agent, expert with programming";
var userContent = "Generate a Hello World program in GoLang.";

List messages = List.of(
new Message("system", systemContent),
new Message("user", userContent)
);

Query queryChat = new Query("deepseek-coder", options).setMessages(messages);

var resultAnswer = ChatStream("http://0.0.0.0:11434", queryChat,
chunk -> {
System.out.print(chunk.getMessage().getContent());
return null;
});

if(resultAnswer.exception().isEmpty()) {
System.out.println("🙂: " +
resultAnswer.getAnswer().getMessage().getContent()
);
} else {
System.out.println("😡: " +
resultAnswer.exception().toString()
);
}
}
}
```

## Install

This library project use the [GitHub Maven Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry). So, to use it in your projects, use the following steps.

### First

Create (or update) a file: `~/.m2/settings.xml` with the following content

```xml


github



github


central
https://repo1.maven.org/maven2


github
https://maven.pkg.github.com/parakeet-nest/parakeet4j

true






github
your GitHub handle
your GitHub token

```

### Then

Add this section to your `pom.xml` file:

```xml


org.parakeetnest.parakeet4j
parakeet4j
0.0.7

```