Search a knowledge store
Research preview
Jockey is in research preview. Availability, limits, and API surface may change before general availability.
This guide shows how to upload videos and images, build a knowledge store, and search it with a natural-language query. The search returns matching video clips and images ranked by relevance.
Key concepts
This section explains the key concepts and terminology used in this guide:
- 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.
Workflow
Upload your videos and images as assets, then create a knowledge store. Add the assets to the knowledge store. The platform indexes the content asynchronously. When the items reach the ready status, search the knowledge store with a natural-language query.
Prerequisites
-
To use the platform, you need an API key:
-
Depending on the programming language you are using, install the TwelveLabs SDK by entering one of the following commands:
-
Publicly accessible video or image URLs that point directly to media files. This quickstart demonstrates the URL upload method. For local file uploads, see the Upload content page.
-
Upload limits: Public video URLs up to 4 GB, local video files up to 200 MB, or images up to 32 MB. For local files up to 5 GB, see the Upload content page.
Starter code
Copy and paste the code below, replacing the placeholders surrounded by <> with your values.
Code explanation
Import the SDK and initialize the client
Create a client instance with your API key to interact with the platform.
Upload a video or an image
Upload a video or an image using a publicly accessible URL to create an asset. The same call handles both.
Check the status of the asset
Asset processing is asynchronous. Poll the status of the asset until it is ready before you use it.
Create a knowledge store
Create a knowledge store. You add the asset to it in the next step, and the platform indexes it.
Add the asset to the knowledge store
Add the asset to the knowledge store. This creates a knowledge store item that the platform indexes. Set the asset_type parameter to image when the asset is an image. It defaults to video.
Check the status of the knowledge store item
Check the status of the knowledge store item until it reaches the ready status. Indexing runs asynchronously and usually takes longer than the asset processing in step 3.
Search the knowledge store
Search the knowledge store with a natural-language query. The data array in the response contains the matches, ranked by relevance. The asset_type field identifies each match: a video match includes a matches array of clips with a time range, and an image match has no clip. This example prints each match to the standard output.
Next steps
- Search a knowledge store - the complete guide: filter results, group clips, and page through large result sets