Metadata-Version: 2.4
Name: palito
Version: 0.14.0
Summary: Ultra-fast local LLM inference for Python powered by Rust, custom CUDA/Vulkan/Metal kernels, PLT1/QTIP quantization, and native EAGLE-3 speculative decoding (up to 1,000+ tok/s on Llama 3.1 8B) — no llama.cpp or Python ML stack required.
License-Expression: MIT
Project-URL: Homepage, https://github.com/natanloterio/palito
Project-URL: Source, https://github.com/natanloterio/palito/tree/master/bindings/python
Keywords: llm,gguf,inference,cuda,ai,local-llm,qwen,llama
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`, `min_p`, `repeat_penalty`, `repeat_last_n`, `presence_penalty`, `frequency_penalty`, `logit_bias` (`{token id: bias}`; `float("-inf")` bans), `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`.
