Skip to main content

Classes

Client

Client for interacting with the TopK API. For available regions see regions Methods Constructor
Parameters

collection()

Get a client for managing data operations on a specific collection such as querying, upserting, and deleting documents. Optionally, pass partition name to scope data operations to that partition. Parameters Returns CollectionClient

collections()

Get a client for managing collections. Returns CollectionsClient

dataset()

Get a client for managing data operations on a specific dataset such as upserting files, managing metadata, and deleting files. Parameters Returns DatasetClient

datasets()

Get a client for managing datasets. Returns DatasetsClient

ask()

Ask a question and get streaming responses as an iterator. Parameters Returns AskIterator
Search for documents and get streaming responses as an iterator. Parameters Returns SearchIterator

AsyncClient

Async client for interacting with the TopK API. For available regions see regions Methods Constructor
Parameters

collection()

Get an async client for a specific collection. Optionally, pass partition name to scope data operations to that partition. Parameters Returns AsyncCollectionClient

collections()

Get an async client for managing collections. Returns AsyncCollectionsClient

dataset()

Get an async client for managing data operations on a specific dataset. Parameters Returns AsyncDatasetClient

datasets()

Get an async client for managing datasets. Returns AsyncDatasetsClient

ask()

Ask a question and get streaming responses asynchronously as an async iterator. Parameters Returns AsyncAskIterator

search()

Search for documents and get streaming responses asynchronously as an async iterator. Parameters Returns AsyncSearchIterator

CollectionClient

Synchronous client for collection operations. Methods

get()

Get documents by their IDs. Parameters Returns dict[str, dict[str, Any]]

count()

Get the count of documents in the collection. Parameters Returns int

query()

Execute a query against the collection. Parameters Returns list[dict[str, Any]]

upsert()

Insert or update documents in the collection. Parameters Returns str

update()

Update documents in the collection. Existing documents will be merged with the provided fields. Missing documents will be ignored. Returns the LSN at which the update was applied. If no updates were applied, this will be empty. Parameters Returns str

delete()

Delete documents by their IDs or using a filter expression. Example: Delete documents by their IDs:
Delete documents by a filter expression:
Parameters Returns str

list_partitions()

List partitions in the collection as an iterator. Parameters Returns PartitionListIterator

delete_partition()

Delete a partition and all documents within it. Parameters Returns None

AsyncCollectionClient

Asynchronous client for collection operations. Methods

get()

Get documents by their IDs asynchronously. Parameters Returns Awaitable[dict[str, dict[str, Any]]]

count()

Get the count of documents in the collection asynchronously. Parameters Returns Awaitable[int]

query()

Execute a query against the collection asynchronously. Parameters Returns Awaitable[list[dict[str, Any]]]

upsert()

Insert or update documents in the collection asynchronously. Parameters Returns Awaitable[str]

update()

Update documents in the collection asynchronously. Existing documents will be merged with the provided fields. Missing documents will be ignored. Returns the LSN at which the update was applied. If no updates were applied, this will be empty. Parameters Returns Awaitable[str]

delete()

Delete documents by their IDs or using a filter expression asynchronously. Example: Delete documents by their IDs:
Delete documents by a filter expression:
Parameters Returns Awaitable[str]

list_partitions()

List partitions in the collection as an async iterator. Parameters Returns AsyncPartitionListIterator

delete_partition()

Delete a partition and all documents within it asynchronously. Parameters Returns Awaitable[None]

Collection

Represents a collection in the TopK system. Properties

Dataset

Represents a dataset in the TopK system. Properties

ListEntry

Entry in a dataset. Properties

Partition

Represents a partition in a collection. Properties

CollectionsClient

Synchronous client for managing collections. Methods

get()

Get information about a specific collection. Parameters Returns Collection

list()

List all collections. Returns list[Collection]

create()

Create a new collection with the specified schema. Parameters Returns Collection

delete()

Delete a collection. Parameters Returns None

AsyncCollectionsClient

Asynchronous client for managing collections. Methods

get()

Get information about a specific collection asynchronously. Parameters Returns Awaitable[Collection]

list()

List all collections asynchronously. Returns Awaitable[list[Collection]]

create()

Create a new collection with the specified schema asynchronously. Parameters Returns Awaitable[Collection]

delete()

Delete a collection asynchronously. Parameters Returns Awaitable[None]

DatasetsClient

Synchronous client for managing datasets. Methods

get()

Get information about a specific dataset. Parameters Returns Dataset

list()

List all datasets. Returns list[Dataset]

create()

Create a new dataset. Parameters Returns Dataset

update()

Update dataset properties. Parameters Returns Dataset

delete()

Delete a dataset. Parameters Returns None

DatasetClient

Synchronous client for dataset operations. Methods

upsert_file()

Upsert a file to the dataset. Returns the processing handle. Parameters Returns str

get_metadata()

Get metadata for one or more documents. Parameters Returns dict[str, dict[str, Any]]

update_metadata()

Update metadata for a file. Returns the processing handle. Parameters Returns str

delete()

Delete a file from the dataset. Returns the processing handle. Parameters Returns str

check_handle()

Return whether the handle has been processed. Parameters Returns bool

wait_for_handle()

Poll until a handle has been processed or the timeout is reached. Raises an error if the handle is not processed within the configured timeout. Parameters Returns None

list()

List files in the dataset as a streaming iterator. Parameters Returns DatasetListIterator

AsyncDatasetsClient

Asynchronous client for managing datasets. Methods

get()

Get information about a specific dataset asynchronously. Parameters Returns Awaitable[Dataset]

list()

List all datasets asynchronously. Returns Awaitable[list[Dataset]]

create()

Create a new dataset asynchronously. Parameters Returns Awaitable[Dataset]

update()

Update dataset properties. Parameters Returns Awaitable[Dataset]

delete()

Delete a dataset asynchronously. Parameters Returns Awaitable[None]

AsyncDatasetClient

Asynchronous client for dataset operations. Methods

upsert_file()

Upsert a file to the dataset asynchronously. Returns the processing handle. Parameters Returns Awaitable[str]

get_metadata()

Get metadata for one or more documents asynchronously. Parameters Returns Awaitable[dict[str, dict[str, Any]]]

update_metadata()

Update metadata for a file asynchronously. Returns the processing handle. Parameters Returns Awaitable[str]

delete()

Delete a file from the dataset asynchronously. Returns the processing handle. Parameters Returns Awaitable[str]

check_handle()

Return whether the handle has been processed asynchronously. Parameters Returns Awaitable[bool]

wait_for_handle()

Poll until a handle has been processed or the timeout is reached asynchronously. Raises an error if the handle is not processed within the configured timeout. Parameters Returns Awaitable[None]

list()

List files in the dataset as a streaming async iterator. Parameters Returns AsyncDatasetListIterator

Source

Represents a dataset with an optional filter. Properties

Fact

Represents a fact in an ask response. Properties

Chunk

Text chunk content. Properties

Image

Image content. Properties

Page

Page content with optional image. Properties

Content

Content in a search result. One of chunk, page, or image. Properties

SearchResult

Represents a search result in an ask response. Properties

Answer

Represents a final answer in an ask response. Properties

Progress

Represents a progress update in an ask response. Properties

AskIterator

Iterator for synchronous ask responses.

AsyncAskIterator

Iterator for asynchronous ask responses.

SearchIterator

Iterator for synchronous search responses.

AsyncSearchIterator

Iterator for asynchronous search responses.

DatasetListIterator

Iterator for synchronous dataset list responses.

AsyncDatasetListIterator

Iterator for asynchronous dataset list responses.

PartitionListIterator

Iterator for synchronous partition list responses.

AsyncPartitionListIterator

Iterator for asynchronous partition list responses.

ConsistencyLevel

Consistency level for read operations. Properties

WaitConfig

Configuration for polling when waiting for a handle to be processed. Properties Methods Constructor
Parameters

RetryConfig

Configuration for retry behavior. By default, retries occur in two situations:
  1. When the server requests the client to reduce its request rate, resulting in a SlowDownError.
  2. When using the query(..., lsn=N) to wait for writes to be available.
Properties Methods Constructor
Parameters

BackoffConfig

Configuration for backoff behavior in retries. Properties Methods Constructor
Parameters