Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/ollama4j/ollama4j

A simple Java library for interacting with Ollama server.
https://github.com/ollama4j/ollama4j

gen-ai genai generative-ai gpt java language-model large-language-models llama llama2 llama3 llm ollama

Last synced: about 3 hours ago
JSON representation

A simple Java library for interacting with Ollama server.

Awesome Lists containing this project

README

        

### Ollama4j


ollama4j-icon


A Java library (wrapper/binding) for Ollama server.

Find more details on the [website](https://ollama4j.github.io/ollama4j/).

![GitHub stars](https://img.shields.io/github/stars/ollama4j/ollama4j)
![GitHub forks](https://img.shields.io/github/forks/ollama4j/ollama4j)
![GitHub watchers](https://img.shields.io/github/watchers/ollama4j/ollama4j)
![Contributors](https://img.shields.io/github/contributors/ollama4j/ollama4j?style=social)
![GitHub License](https://img.shields.io/github/license/ollama4j/ollama4j)

[//]: # (![GitHub repo size](https://img.shields.io/github/repo-size/ollama4j/ollama4j))

[//]: # (![GitHub top language](https://img.shields.io/github/languages/top/ollama4j/ollama4j))

[//]: # (![JitPack Downloads This Month Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fjitpack.io%2Fapi%2Fdownloads%2Fio.github.ollama4j%2Follama4j&query=%24.month&label=JitPack%20Downloads%20-%20This%20Month))

[//]: # (![JitPack Downloads This Week Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fjitpack.io%2Fapi%2Fdownloads%2Fio.github.ollama4j%2Follama4j&query=%24.week&label=JitPack%20Downloads%20-%20This%20Week))

[//]: # (![JitPack Downloads Per Month Badge](https://jitpack.io/v/ollama4j/ollama4j/month.svg))

[//]: # (![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/ollama4j/ollama4j/total?label=GitHub%20Package%20Downloads))

![GitHub last commit](https://img.shields.io/github/last-commit/ollama4j/ollama4j?color=green)
[![codecov](https://codecov.io/gh/ollama4j/ollama4j/graph/badge.svg?token=U0TE7BGP8L)](https://codecov.io/gh/ollama4j/ollama4j)
![Build Status](https://github.com/ollama4j/ollama4j/actions/workflows/maven-publish.yml/badge.svg)

[//]: # (![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Follama4j%2Follama4j&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false))

[//]: # (![GitHub language count](https://img.shields.io/github/languages/count/ollama4j/ollama4j))

## Table of Contents

- [How does it work?](#how-does-it-work)
- [Requirements](#requirements)
- [Installation](#installation)
- [API Spec](https://ollama4j.github.io/ollama4j/category/apis---model-management)
- [Javadoc](https://ollama4j.github.io/ollama4j/apidocs/)
- [Development](#development)
- [Contributions](#get-involved)
- [References](#references)

#### How does it work?

```mermaid
flowchart LR
o4j[Ollama4j]
o[Ollama Server]
o4j -->|Communicates with| o;
m[Models]
subgraph Ollama Deployment
direction TB
o -->|Manages| m
end
```

#### Requirements

![Java](https://img.shields.io/badge/Java-11_+-green.svg?style=for-the-badge&labelColor=gray&label=Java&color=orange)



Local Installation

Docker Installation

Download for macOS

Download for Windows

Install on Linux

```shell
curl -fsSL https://ollama.com/install.sh | sh
```

CPU only

```shell
docker run -d -p 11434:11434 \
-v ollama:/root/.ollama \
--name ollama \
ollama/ollama
```

NVIDIA GPU

```shell
docker run -d -p 11434:11434 \
--gpus=all \
-v ollama:/root/.ollama \
--name ollama \
ollama/ollama
```

## Installation

> [!NOTE]
> We are now publishing the artifacts to both Maven Central and GitHub package repositories.
>
> Track the releases [here](https://github.com/ollama4j/ollama4j/releases) and update the dependency version
> according to your requirements.

### For Maven

#### Using [Maven Central](https://central.sonatype.com/)

[![][ollama4j-mvn-releases-shield]][ollama4j-mvn-releases-link]

[ollama4j-mvn-releases-link]: https://central.sonatype.com/artifact/io.github.ollama4j/ollama4j/overview

[ollama4j-mvn-releases-shield]: https://img.shields.io/maven-central/v/io.github.ollama4j/ollama4j?display_name=release&style=for-the-badge&label=From%20Maven%20Central

In your Maven project, add this dependency:

```xml

io.github.ollama4j
ollama4j
1.0.79

```

#### Using GitHub's Maven Package Repository

[![][ollama4j-releases-shield]][ollama4j-releases-link]

[ollama4j-releases-link]: https://github.com/ollama4j/ollama4j/releases

[ollama4j-releases-shield]: https://img.shields.io/github/v/release/ollama4j/ollama4j?display_name=release&style=for-the-badge&label=From%20GitHub%20Packages

1. Add `GitHub Maven Packages` repository to your project's `pom.xml` or your `settings.xml`:

```xml


github
GitHub Apache Maven Packages
https://maven.pkg.github.com/ollama4j/ollama4j

true


true

```

2. Add `GitHub` server to settings.xml. (Usually available at ~/.m2/settings.xml)

```xml



github
YOUR-USERNAME
YOUR-TOKEN

```

3. In your Maven project, add this dependency:

```xml

io.github.ollama4j
ollama4j
1.0.79

```

### For Gradle

1. Add the dependency

```groovy
dependencies {
implementation 'io.github.ollama4j:ollama4j:1.0.79'
}
```

[//]: # (Latest release:)

[//]: # ()

[//]: # (![Maven Central](https://img.shields.io/maven-central/v/io.github.ollama4j/ollama4j))

[//]: # ()

[//]: # ([![][lib-shield]][lib])

[lib]: https://central.sonatype.com/artifact/io.github.ollama4j/ollama4j

[lib-shield]: https://img.shields.io/badge/ollama4j-get_latest_version-blue.svg?style=just-the-message&labelColor=gray

#### API Spec

> [!TIP]
> Find the full API specifications on the [website](https://ollama4j.github.io/ollama4j/).

#### Development

Build:

```shell
make build
```

Run unit tests:

```shell
make unit-tests
```

Run integration tests:

```shell
make integration-tests
```

#### Releases

Newer artifacts are published via GitHub Actions CI workflow when a new release is created from `main` branch.

#### Who's using Ollama4j?

- `Datafaker`: a library to generate fake data
- https://github.com/datafaker-net/datafaker-experimental/tree/main/ollama-api
- `Vaadin Web UI`: UI-Tester for Interactions with Ollama via ollama4j
- https://github.com/TEAMPB/ollama4j-vaadin-ui
- `ollama-translator`: Minecraft 1.20.6 spigot plugin allows to easily break language barriers by using ollama on the
server to translate all messages into a specfic target language.
- https://github.com/liebki/ollama-translator
- https://www.reddit.com/r/fabricmc/comments/1e65x5s/comment/ldr2vcf/
- `Ollama4j Web UI`: A web UI for Ollama written in Java using Spring Boot and Vaadin framework and
Ollama4j.
- https://github.com/ollama4j/ollama4j-web-ui
- `JnsCLI`: A command-line tool for Jenkins that manages jobs, builds, and configurations directly from the terminal while offering AI-powered error analysis for quick troubleshooting.
- https://github.com/mirum8/jnscli
- `Katie Backend`: An Open Source AI-based question-answering platform that helps companies and organizations make their private domain knowledge accessible and useful to their employees and customers.
- https://github.com/wyona/katie-backend

#### Traction

[![Star History Chart](https://api.star-history.com/svg?repos=ollama4j/ollama4j&type=Date)](https://star-history.com/#ollama4j/ollama4j&Date)

### Get Involved

![Open Issues](https://img.shields.io/github/issues-raw/ollama4j/ollama4j)
![Closed Issues](https://img.shields.io/github/issues-closed-raw/ollama4j/ollama4j)
![Open PRs](https://img.shields.io/github/issues-pr-raw/ollama4j/ollama4j)
![Closed PRs](https://img.shields.io/github/issues-pr-closed-raw/ollama4j/ollama4j)
![Discussions](https://img.shields.io/github/discussions/ollama4j/ollama4j)

[//]: # (![GitHub Issues or Pull Requests](https://img.shields.io/github/issues-raw/ollama4j/ollama4j))

[//]: # (![GitHub Issues or Pull Requests](https://img.shields.io/github/issues-closed-raw/ollama4j/ollama4j))

[//]: # (![GitHub Issues or Pull Requests](https://img.shields.io/github/issues-pr-raw/ollama4j/ollama4j))

[//]: # (![GitHub Issues or Pull Requests](https://img.shields.io/github/issues-pr-closed-raw/ollama4j/ollama4j))

[//]: # (![GitHub Discussions](https://img.shields.io/github/discussions/ollama4j/ollama4j))

Contributions are most welcome! Whether it's reporting a bug, proposing an enhancement, or helping
with code - any sort
of contribution is much appreciated.

### References

- [Ollama REST APIs](https://github.com/jmorganca/ollama/blob/main/docs/api.md)

### Credits

The nomenclature and the icon have been adopted from the incredible [Ollama](https://ollama.ai/)
project.

**Thanks to the amazing contributors**





### Appreciate my work?


Buy Me A Coffee