Skip to content

TurboPuffer

TurboPuffer

Wrapper for turbopuffer.Namespace as a context manager.

Attributes:

Name Type Description
namespace str

The namespace to use for the TurboPuffer instance.

Examples:

Upsert documents to a namespace:

from raggy.documents import Document
from raggy.vectorstores.tpuf import TurboPuffer

with TurboPuffer() as tpuf: # default namespace is "raggy"
    tpuf.upsert(documents=[Document(id="1", text="Hello, world!")])

Query a namespace:

from raggy.vectorstores.tpuf import TurboPuffer

with TurboPuffer() as tpuf:
    result = tpuf.query(text="Hello, world!")
    print(result)

upsert_batched async

Upsert documents in batches concurrently.

Parameters:

Name Type Description Default
documents Sequence[Document]

Sequence of documents to upsert

required
batch_size int

Maximum number of documents per batch

100
max_concurrent int

Maximum number of concurrent upsert operations

8

TurboPufferSettings

Settings for the TurboPuffer vectorstore.

multi_query_tpuf

searches a Turbopuffer namespace for the given queries

query_namespace

Query a TurboPuffer namespace.