Metadata-Version: 2.4
Name: palito
Version: 0.7.1
Summary: Python binding for Palito, fast local LLM inference for GGUF models
License-Expression: MIT
Project-URL: Homepage, https://github.com/natanloterio/palito
Project-URL: Source, https://github.com/natanloterio/palito/tree/master/bindings/python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# palito (Python)

Python binding for [Palito](../../README.md). It uses only the standard library (ctypes).

```sh
pip install ./bindings/python
```

```python
import palito

with palito.Palito("model.gguf") as llm:
    reply = llm.chat([{"role": "user", "content": "Hello!"}],
                     on_text=lambda text: print(text, end="", flush=True))
    print(reply.finish_reason, reply.tokens_per_second)

    for text in llm.stream_chat([{"role": "user", "content": "A haiku about tea"}],
                                temperature=0.7, top_p=0.9, stop=["\n\n"]):
        print(text, end="", flush=True)
```

- **Generation keywords:** `max_tokens`, `thinking`, `temperature` (0: greedy), `top_p`, `top_k`, `seed`, `stop` and `json_schema` (a dict or JSON string; the reply is JSON matching it, with reasoning off; `{"type": "object"}` for any object).
- **Results:** a `Completion` dataclass.
- **Errors:** raise `palito.PalitoError`.
