Metadata-Version: 2.4
Name: pydantic-ai-rag
Version: 0.0.0
Summary: RAG layer for pydantic-ai agents. Part of pydantic-ai-toolkits.
Project-URL: Homepage, https://github.com/wachawo/pydantic-ai-rag
Project-URL: Repository, https://github.com/wachawo/pydantic-ai-rag
Project-URL: Issues, https://github.com/wachawo/pydantic-ai-rag/issues
Project-URL: Toolkits, https://github.com/wachawo/pydantic-ai-toolkits
Author-email: wachawo <kpbico6ou@gmail.com>
License: MIT
License-File: LICENSE
Keywords: agents,llm,pydantic,pydantic-ai,rag,retrieval
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# pydantic-ai-rag

This project is included in [pydantic-ai-toolbox](https://github.com/wachawo/pydantic-ai-toolbox/blob/main/docs/RAG.md).

## Install

```bash
pip install "pydantic-ai-toolbox[rag]"
```

## Usage

```python
from pydantic_ai import Agent
from pydantic_ai_toolbox import RAGToolset

rag = RAGToolset(
    embedder=my_embedder,
    chunk_size=1000,
    chunk_overlap=100,
    storage_path="./index",
    distance="cosine",
    max_results=20,
    namespace="default",
)
rag.add_text("The sky is green.", doc_id="d-sky")

agent = Agent("openai:gpt-4o", toolsets=[rag])
agent.run_sync("What color is the sky?")
```

`embedder` is any callable mapping `list[str] -> list[list[float]]` (OpenAI, a local model, or a stub for tests).

Full reference and a runnable example: [RAG.md](https://github.com/wachawo/pydantic-ai-toolbox/blob/main/docs/RAG.md).
