Knowledge stores

A knowledge store contains your videos plus the understanding the platform derives from them: spatiotemporal context, a typed ontology, and embeddings for semantic retrieval. The KnowledgeStores class provides methods to create and manage knowledge stores.

Methods

Create a knowledge store

Description: This method creates a knowledge store.

Provide a name. Optionally include a description, a metadata map, and an ingestionConfig object that controls how content added to the store is processed. The ingestionConfig object is immutable after creation.

Function signature and example:

1create(
2 request: TwelvelabsApi.KnowledgeStoresCreateRequest,
3 requestOptions?: KnowledgeStores.RequestOptions
4): Promise<TwelvelabsApi.KnowledgeStore>

Parameters

NameTypeRequiredDescription
namestringYesThe name of the knowledge store.
ingestionConfigIngestionConfigNoConfiguration that controls how content added to the knowledge store is processed. Immutable after creation.
descriptionstringNoAn optional description of the knowledge store.
metadataRecord
<string, string>
NoCustom metadata for the knowledge store. Both keys and values must be strings.
requestOptionsKnowledgeStores.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

The IngestionConfig object contains the following property:

NameTypeRequiredDescription
enrichmentConfigEnrichmentConfigYesMetadata enrichment configuration. Set type to description for natural-language instructions that the platform converts into a schema internally, or to json_schema for structured extraction conforming to a provided JSON Schema.

Return value

Returns a KnowledgeStore object. The KnowledgeStore object contains the following properties:

NameTypeDescription
idstringThe unique identifier of the knowledge store.
namestringThe name of the knowledge store.
descriptionstringAn optional description of the knowledge store.
ingestionConfigIngestionConfigThe ingestion configuration set when this knowledge store was created. Immutable.
itemCountnumberThe number of items in the knowledge store.
createdAtstringThe date and time when the knowledge store was created, in the RFC 3339 format.
updatedAtstringThe date and time when the knowledge store was last updated, in the RFC 3339 format.
metadataRecord
<string, string>
Custom metadata for the knowledge store.

API Reference

Create a knowledge store.

Create a knowledge store.

List knowledge stores

Description: This method returns a list of the knowledge stores in your account.

Function signature and example:

1list(
2 request?: TwelvelabsApi.KnowledgeStoresListRequest,
3 requestOptions?: KnowledgeStores.RequestOptions
4): Promise<core.Page<TwelvelabsApi.KnowledgeStore>>

Parameters

NameTypeRequiredDescription
pagenumberNoA number that identifies the page to retrieve. Default: 1.
pageLimitnumberNoThe number of items to return on each page. Default: 10. Max: 50.
sortByKnowledgeStores
ListRequestSortBy
NoThe field to sort on. The following options are available:
- created_at: Sorts by the time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the knowledge store was created.
- updated_at: Sorts by the time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the knowledge store was updated. Default: created_at.
sortOptionstringNoThe sorting direction. The following options are available:
- asc
- desc Default: desc.
requestOptionsKnowledgeStores.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a Page<KnowledgeStore> object that allows you to iterate through the paginated list of knowledge stores. For the properties of each KnowledgeStore object, see Create a knowledge store.

API Reference

List knowledge stores.

Retrieve a knowledge store

Description: This method retrieves the details of a specific knowledge store.

Function signature and example:

1retrieve(
2 knowledgeStoreId: string,
3 requestOptions?: KnowledgeStores.RequestOptions
4): Promise<TwelvelabsApi.KnowledgeStore>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
requestOptionsKnowledgeStores.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStore object. For its properties, see Create a knowledge store.

API Reference

Retrieve a knowledge store.

Update a knowledge store

Description: This method updates the specified knowledge store. Only the name, description, and metadata fields can be updated.

Function signature and example:

1update(
2 knowledgeStoreId: string,
3 request?: TwelvelabsApi.KnowledgeStoresUpdateRequest,
4 requestOptions?: KnowledgeStores.RequestOptions
5): Promise<TwelvelabsApi.KnowledgeStore>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
namestringNoThe name of the knowledge store.
descriptionstringNoAn optional description of the knowledge store.
metadataRecord
<string, string>
NoCustom metadata for the knowledge store. Both keys and values must be strings. The provided object replaces the existing metadata in full, so include every key you want to keep. To clear all metadata, set this field to an empty object ({}). A null value is stored as an empty string.
requestOptionsKnowledgeStores.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStore object. For its properties, see Create a knowledge store.

API Reference

Update a knowledge store.

Delete a knowledge store

Description: This method deletes the specified knowledge store and all its items.

Function signature and example:

1delete(
2 knowledgeStoreId: string,
3 requestOptions?: KnowledgeStores.RequestOptions
4): Promise<void>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
requestOptionsKnowledgeStores.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

This method does not return a value.

API Reference

Delete a knowledge store.