Metadata-Version: 2.4
Name: djeli
Version: 0.1.1
Summary: Python client for the djeli local LLM server
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27

# djeli

**Python client for the djeli local LLM server.**

`djeli` is a small, typed Python library for talking to a `djeli serve`
process running on your machine. It lets you run GGUF language models
locally and offline — no cloud, no API key, no data leaving your computer.

## Installation

```bash
pip install djeli
```

Requires Python 3.8 or newer.

## Prerequisite

This package is a client only. To use it, you need the djeli engine running on your machine.

1. Install the engine

Download the standalone binary for your OS (Linux, macOS, or Windows) from the official repository:

👉 https://github.com/bigdahaut/djeli

Follow the one-line install instructions in the repository's README.

2. Start the server

```bash
djeli serve
```
By default, it listens on http://127.0.0.1:11435.

## Usage

```python
from djeli import Djeli

client = Djeli()

answer = client.chat(
    model="qwen2.5-1.5b-instruct-q4_k_m",
    messages=[
        {"role": "system", "content": "You are a concise assistant."},
        {"role": "user", "content": "What is the capital of Kenya?"},
    ],
)
print(answer)
# The capital of Kenya is Nairobi.
```

## Streaming

```python
for chunk in client.chat(
    model="qwen2.5-1.5b-instruct-q4_k_m",
    messages=[{"role": "user", "content": "Write a haiku about Dakar."}],
    stream=True,
):
    print(chunk, end="", flush=True)
```

## API Reference

Djeli(base_url="http://127.0.0.1:11435", timeout=300.0)

Create a client. timeout is the maximum time in seconds to wait for a response.

Argument	Type	Default	Description
--------------------------------------------------
ase_url	str	"http://127.0.0.1:11435"	URL of the local engine.

timeout	float	300.0	Request timeout in seconds.

------------------------------------------------

client.models() -> list[dict]

Return the models the engine can load. Each entry has id, object, created, and owned_by fields.

client.chat(model, messages, temperature=0.7, max_tokens=1024, stream=False)

Send a chat request.

Argument	Type	Default	Description
----------------------------------------------------
model	str	—	Model name: the .gguf filename without extension.

messages	list[dict]	—	Conversation history. Each dict has role ("system", "user", "assistant") and content.

temperature	float	0.7	Sampling temperature. 0.0 greedy, 0.7 balanced, 1.0+ creative.

max_tokens	int	1024	Maximum generated tokens.

stream	bool	False	Return an iterator of string chunks.

-------------------------------------------------

Returns str when stream=False, Iterator[str] when stream=True.

## DjeliError

Raised on non-2xx responses, connection failures, or malformed responses.
The message contains the engine's error text when available.

## License

### MIT
