Add assets to a knowledge store
This guide shows you how to add an uploaded asset to a knowledge store and wait for indexing to complete.
Key concepts
- Asset: Your uploaded content. Once created, you can reference the same asset across multiple operations without uploading the file again.
- Knowledge store: A persistent store of your videos and images plus the understanding the platform derives from them — spatiotemporal context, a typed ontology, and embeddings — that together enable corpus-level reasoning.
- Knowledge store item: An asset added to a knowledge store. The platform processes each item asynchronously. When processing finishes, the item is ready for downstream tasks.
Prerequisites
- You’ve already uploaded your content, and the asset has reached the
readystatus. See the Upload content page for details. - You’ve already created a knowledge store. See the Create a knowledge store page for details.
Example
Copy and paste the code below, replacing the placeholders surrounded by <> with your values.
Code explanation
Python
Node.js
Add the asset to the knowledge store
Add an uploaded asset to a knowledge store as an item. The platform begins indexing the item asynchronously. This example prints the item identifier to the standard output.
Function call: You call the knowledge_store_items.create method.
Parameters:
knowledge_store_id: The unique identifier of the knowledge store.asset_id: The unique identifier of the asset to add.- (Optional)
asset_type: The type of asset. Defaults tovideo; set it toimageto add an image asset. Thefile_typefield of the asset records the type the platform detected during upload.
Return value: An object of type KnowledgeStoreItem with a field named id representing the unique identifier of the newly created knowledge store item, and a field named status representing its current state.
Check the status of the knowledge store item
Poll the item until it reaches the ready status. Indexing usually takes longer than the asset processing that happens after upload. One asset can exist in multiple knowledge stores. For the full list of statuses, see the Knowledge stores page.
Function call: You call the knowledge_store_items.retrieve method.
Parameters:
knowledge_store_id: The unique identifier of the knowledge store.item_id: The unique identifier of the knowledge store item, from the previous step.
Return value: An object of type KnowledgeStoreItem. Check the status field for the current state.
Next steps
- Create a response - generate responses from your video and image collection through the Responses API
- Search a knowledge store - find matching video clips and images in your knowledge store