https://github.com/hakdogan/jollama
Ollama Java client. This project shows you how to configure models and manage the request-response cycle in pure Java.
https://github.com/hakdogan/jollama
ollama ollama-client
Last synced: about 1 month ago
JSON representation
Ollama Java client. This project shows you how to configure models and manage the request-response cycle in pure Java.
- Host: GitHub
- URL: https://github.com/hakdogan/jollama
- Owner: hakdogan
- Created: 2025-08-29T14:22:23.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-08-30T12:26:35.000Z (about 1 month ago)
- Last Synced: 2025-08-31T22:34:06.735Z (about 1 month ago)
- Topics: ollama, ollama-client
- Language: Java
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Jollama
`Ollama` is a lightweight, extensible framework for building, running, and chatting with large language models (LLMs) locally on your machine. This project demonstrates how to integrate with Ollama's API, manage model configurations via `Modelfiles`, and maintain conversation context across chat sessions.
## Features
- **Ollama API Integration:** Communicate seamlessly with your local Ollama server
- **Modelfile Support:** Load and manage custom model configurations
- **Context Awareness:** Maintain conversation context across requests for coherent multi-turn dialogues
- **Interactive Console Chat:** Simple console interface for testing and demonstration
- **Standalone Java Application:** No external dependencies beyond the Ollama server
## Prerequisites
- Java 17 or higher
- Ollama installed on your system
- At least one model pulled via Ollama _(e.g., ollama pull mistral)_## Installation
Clone this repository:
```bash
git clone https://github.com/hakdogan/jollama
cd jollama
```Create an executable Jar file:
```bash
javac -d mods --source-path "./src/*" \ ✔ 22
$(find . -name "*.java")cd mods/
jar cvmf ../manifest.txt jollama.jar .
```or
```bash
sh compile.sh
```## Usage
```bash
java -jar jollama.jar
```or
```bash
sh run.sh
```To list local models, you can type **models** after the following message is displayed in the console
```bash
Before you begin, please specify the model you want to use.
(Type "models" to list local models)models
gpt-oss
qwen2.5
phi3.5
phi3
all-minilm
qwen3
nomic-embed-text
llava
qwen2.5
llama3.2
qwen2.5
mistralPlease specify the model you want to use.
```
If you want to configure a model, you must provide the **model name** and **model file path**```bash
java -jar jollama.jar java-expert src/main/resources/Modelfilegathering model components
using existing layer sha256:ff82381e2bea77d91c1b824c7afb83f6fb73e9f7de9dda631bcdbca564aa5435
using existing layer sha256:43070e2d4e532684de521b885f385d0841030efa2b1a20bafb76133a5e1379c1
using existing layer sha256:491dfa501e59ed17239711477601bdc7f559de5407fbd4a2a79078b271045621
using existing layer sha256:69525e015f87b01e2746a48e53866575cc5f0a371d3dbce438be557a83713b0c
using existing layer sha256:85b5c07d0bb2f5fff04c0d8fdaaeb698686fcd155220c9ce7a65913111b043ee
writing manifest
successModel created successfully: java-expert
Before you begin, please specify the model you want to use.
(Type "models" to list local models)java-expert
Ask anything. Type exit to exit!
What is Java?Java is a programming language. It was designed by Sun Microsystems in 1995...
```