Skip to content

Tutorial

Loading documents

from raggy.loaders.web import SitemapLoader

raggy_documentation_loader = SitemapLoader(
    urls=["https://zzstoatzz.github.io/raggy/sitemap.xml"],
    exclude=["api-ref", "/events/"],
)
documents = await raggy_documentation_loader.load()

print(documents[0])

Adding documents to a vectorstore

from raggy.vectorstores.tpuf import Turbopuffer

async with Turbopuffer() as vectorstore: # uses default `raggy` namespace
    await vectorstore.upsert(documents)

Querying the vectorstore

from raggy.vectorstores.tpuf import query_namespace

print(await query_namespace("how do I get started with raggy?"))

Real-world example

See this example I use to refresh a chatbot that knows about prefect.