Extract entities
This recipe shows you how to extract every distinct entity from your videos and images. The response includes each entity’s name, type, frequency, and the items it appears in, ready for a content index, tagging system, or downstream pipeline.
Use cases:
- Content indexing: Build a searchable catalog of who and what appears across your videos and images
- Classification pipelines: Feed entity lists to downstream tagging or categorization systems
- Cross-video analysis: Find which entities appear most frequently or span multiple videos
Key concepts
- 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.
- Structured output: A JSON schema you provide with your request. Jockey constrains its output to match your schema, so you retrieve machine-readable results instead of plain text. For a guide on designing schemas and parsing responses, see the Structured output page.
Workflow
This recipe combines two elements: a JSON schema that defines the entity data structure, and a prompt that describes what to extract. Jockey reasons across your knowledge store, identifies every distinct entity, and returns structured results that match your schema. You can adapt this recipe to extract different entity types or apply different extraction criteria.
Prerequisites
- You’ve already created a knowledge store with at least one item in
readystatus. See the Quickstart page for details. - You’re familiar with the request and response format. See the Create a response page for details.
Complete example
Copy and paste the code below, replacing the placeholders surrounded by <> with your values.
Code explanation
Python
Node.js
To extract entities, call the responses.create method with a prompt and a text parameter that describes your result schema.
Parameters:
knowledge_store_id: The unique identifier of the knowledge store to reason over.input: An array of input items. Each item is a message you send to Jockey. This example asks Jockey to list every distinct entity across all videos and images, including frequency.text: An object that specifies the response format. To return structured JSON, set theformatfield: itsschema_field defines the structure the output must match, and itsnamefield identifies the schema. Design the schema to fit your use case; the inline comments in the example describe each field. For the schema rules, see the Structured output page.
Return value: An object of type ResponseObject containing, among other information, the following fields:
id: The unique identifier of the response.knowledge_store_id: The knowledge store this response was generated against.session_id: The session identifier. Pass it in a follow-up request to continue the conversation.status: The status of the response. The possible values arecompleted,failed,in_progress, andincomplete.output: The response output items. Thetextfield of each content part in amessageitem is a JSON string that matches your schema. Parse it withjson.loads(), then iterate theentitiesarray to read each entity.usage: Token usage statistics, including theinput_tokensandoutput_tokensfields.
Example response
The text field inside each content part is a JSON string that matches your schema. After parsing, a typical result looks like this:
Notes
- The
frequencyfield reports the number of indexed spans where the entity appears, not the number of videos. - The
appears_infield lists the asset identifiers of the knowledge store items that contain the entity.
Variations
Change the prompt to adapt this recipe for different extraction needs.
- Filter by entity type: Change the prompt to “List only the people who appear in these videos and images.”
- Cross-video presence: Change the prompt to “Which entities appear in more than one video?”
- Include relationships: Change the prompt to “List entities and describe how they relate to each other.”
Jupyter notebook
See also
- Track entities across videos - follow a specific entity across multiple videos
- Organize a video library - use entity extraction for categorization
- Structured output - more on JSON Schema responses
- Create a response - API reference for the Responses endpoint