v0.4.0 — local models, async, typed, uv-ready
Highlights
- Ollama provider — run on local LLMs (llama3, mistral, qwen, …) over Ollama's HTTP API. No API key.
- Async API — `Compressor.acompress(text, concurrency=4)` extracts chunks in parallel via `asyncio.gather`. Public `extract_async` / `extract_chunked_async`.
- OpenAI prompt-cache stats — `ProviderResponse.cached_input_tokens` is populated from `usage.prompt_tokens_details.cached_tokens` on hits (≥1024 prompt tokens).
- Typed (PEP 561) — ships `py.typed`; mypy / pyright / IDE checkers consume inline annotations directly.
- `uv` ready — `uv build`, `uvx --from narratoflow narratoflow ...`, and `uv add narratoflow` all work; no pyproject changes were needed.
- Docs — new pages: Install (pip + uv + uv build), Providers (matrix + per-provider), Async API, Type checking.
Install
```bash
pip install narratoflow==0.4.0
or
uv add narratoflow
```
Example
```python
import asyncio
from narrato import Compressor
local model via Ollama, no key
c = Compressor.from_profile("rag-en", provider="ollama",
extractor_model="llama3", target_model="llama3")
concurrent chunked extraction
result = asyncio.run(c.acompress(very_long_document, concurrency=8))
```
Tests
55 passing (was 42). New `tests/test_async.py`, `tests/test_ollama.py` (httpx MockTransport — zero network), `tests/test_typing_marker.py`.
Full notes: see CHANGELOG.md.