Skip to main content

RAG layer for pydantic-ai agents. Part of pydantic-ai-toolkits.

Project description

pydantic-ai-rag

This project is included in pydantic-ai-toolbox.

Install

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

Usage

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic_ai_rag-0.0.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydantic_ai_rag-0.0.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_ai_rag-0.0.0.tar.gz.

File metadata

  • Download URL: pydantic_ai_rag-0.0.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pydantic_ai_rag-0.0.0.tar.gz
Algorithm Hash digest
SHA256 6321f22dc8e57b806a1da6f244fd085aabbef2d95e23ce0521a17910136bc510
MD5 9534e94f4d6623c46de78cec3df821e2
BLAKE2b-256 c23b97dd980830b862732eb215c80c5385f624105201d182d06e7f9ee20d98bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydantic_ai_rag-0.0.0.tar.gz:

Publisher: publish.yml on wachawo/pydantic-ai-rag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydantic_ai_rag-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_ai_rag-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89eec645988326d4044cd8e8e38e07031100edb07ea8096bb4849e37193f656c
MD5 55f3ba55538127f86d97180ccd077197
BLAKE2b-256 e3b5fcd013cba8e4e69a23feb1de0fd36ad78f7f4c32e6799db790665914edd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydantic_ai_rag-0.0.0-py3-none-any.whl:

Publisher: publish.yml on wachawo/pydantic-ai-rag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page