Classes
AskStream
Iterator for ask responses. This type implements JavaScript’s async iterable protocol. It can be used withfor await...of loops.
See
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
Constructors
Constructor
AskStream
Methods
[asyncIterator]()
AsyncGenerator<
| Answer
| Progress, void, undefined>
Client
Client for interacting with the TopK API. For available regions see https://docs.topk.io/regions Constructors Constructor
Returns
Client
Methods
ask()
Returns
AskStream
collection()
Returns
CollectionClient
collections()
CollectionsClient
dataset()
Returns
DatasetClient
datasets()
DatasetsClient
search()
Returns
SearchStream
CollectionClient
Internal
Client for interacting with a specific collection.
This client provides methods to perform operations on a specific collection,
including querying, upserting, and deleting documents.
Methods
count()
Returns
Promise<number>
delete()
Returns
Promise<string>
deletePartition()
Returns
Promise<void>
get()
Returns
Promise<Record<string, Record<string, any>>>
listPartitions()
Returns
PartitionListStream
query()
Returns
Promise<Record<string, any>[]>
update()
Returns
Promise<string>
The LSN at which the update was applied.
If no updates were applied, this will be empty.
upsert()
Returns
Promise<string>
CollectionsClient
Internal
Client for managing collections.
This client provides methods to create, list, get, and delete collections.
Methods
create()
Returns
Promise<Collection>
delete()
Returns
Promise<void>
get()
Returns
Promise<Collection>
list()
Promise<Collection[]>
DatasetClient
Internal
Client for dataset operations.
Methods
checkHandle()
Returns
Promise<boolean>
delete()
Returns
Promise<string>
getMetadata()
Returns
Promise<Record<string, Record<string, any>>>
list()
Returns
DatasetListStream
updateMetadata()
Returns
Promise<string>
upsertFile()
Returns
Promise<string>
waitForHandle()
Returns
Promise<void>
DatasetListStream
Iterator for dataset list responses. This type implements JavaScript’s async iterable protocol. It can be used withfor await...of loops.
See
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
Constructors
Constructor
DatasetListStream
Methods
[asyncIterator]()
AsyncGenerator<ListEntry, void, undefined>
next()
Promise<ListEntry>
DatasetsClient
Internal
Client for managing datasets.
Methods
create()
Returns
Promise<Dataset>
delete()
Returns
Promise<void>
get()
Returns
Promise<Dataset>
list()
Promise<Dataset[]>
update()
Returns
Promise<Dataset>
PartitionListStream
Iterator for partition list responses. This type implements JavaScript’s async iterable protocol. It can be used withfor await...of loops.
See
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
Constructors
Constructor
PartitionListStream
Methods
[asyncIterator]()
AsyncGenerator<Partition, void, undefined>
next()
Promise<Partition>
SearchStream
Iterator for search responses. This type implements JavaScript’s async iterable protocol. It can be used withfor await...of loops.
See
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
Constructors
Constructor
SearchStream
Methods
[asyncIterator]()
AsyncGenerator<SearchResult, void, undefined>
Interfaces
Answer
Represents a final answer in an ask response. PropertiesBackoffConfig
Configuration for exponential backoff between retry attempts. This struct controls how the delay between retry attempts increases over time. All fields are optional and will use sensible defaults if not provided. PropertiesChunk
Text chunk content. PropertiesClientConfig
Configuration for the TopK client. This struct contains all the necessary configuration options to connect to the TopK API. Theapi_key and region are required, while other options have sensible defaults.
Properties
Collection
Represents a collection in the TopK service. A collection is a container for documents with a defined schema. This struct contains metadata about the collection including its name, organization, project, schema, and region. PropertiesCollectionFieldSpec
Represents a field specification within a collection schema. This struct defines the properties of a field in a collection, including its data type, whether it’s required, and any index configuration. PropertiesContent
Content in a search result. One of chunk, page, or image. PropertiesDataset
Represents a dataset in the TopK service. PropertiesFact
Represents a fact in an ask response. PropertiesImage
Image content. PropertiesInputFile
Input for upserting a file to a dataset. Provide either apath to a file on disk, or inline data via data + fileName + mimeType.
Properties
ListEntry
Entry in a dataset. PropertiesPage
Page content with optional image. PropertiesPartition
A partition within a collection. PropertiesProgress
Represents a progress update in an ask response. PropertiesQueryOptions
Options for query operations. These options control the behavior of query operations, including consistency guarantees and sequence number constraints. PropertiesRetryConfig
Configuration for retry behavior when requests fail. This struct allows you to customize how the client handles retries for failed requests. All fields are optional and will use sensible defaults if not provided. PropertiesSearchResult
Represents a search result in an ask response. PropertiesUpdateDatasetParams
PropertiesWaitConfig
Configuration for polling when waiting for a handle to be processed. PropertiesNamespaces
Type Aliases
ConsistencyLevel
Indexed: Query returns results as soon as they are indexed (faster, eventual consistency)Strong: Query waits for all replicas to be consistent (slower, strong consistency)