Create a response
This guide shows you how to generate a response from a knowledge store and customize Jockey’s behavior for a specific domain. You can also use this endpoint for agentic search: have Jockey reason over your content to find and explain matches. For direct, single-call retrieval of ranked clips and images instead, use Search a knowledge store.
Key features:
- Corpus-level reasoning: Answers questions by reasoning across every item in a knowledge store.
- Domain-specific behavior: Adapts responses to your domain or task through per-request instructions.
- Multi-turn sessions: Maintains conversation context across follow-up requests.
- Streaming: Returns tokens in real time instead of waiting for the full response.
- Structured output: Returns typed JSON responses when you provide a JSON Schema.
- Intermediate outputs: Returns Jockey’s reasoning steps alongside the final answer.
Use cases:
- Corpus overview: Generate responses that reason across all your videos and images.
- Entity extraction: Identify people, places, objects, and other entities across a knowledge store.
- Search and discovery: Find moments in videos and matching images by describing what you want in natural language.
- Content organization: Categorize videos and images by themes, topics, formats, or other useful dimensions.
- Cross-video tracking: Track a subject across multiple videos and reconstruct a timeline of appearances.
- Content enrichment: Analyze existing content through a specific domain lens or schema.
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.
- Instructions: A system-level prompt that shapes Jockey’s behavior for a specific domain or task. Same endpoint, different results depending on the instructions you provide.
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.
- You’ve already added at least one asset to a knowledge store, and the knowledge store item has reached the
readystatus. See the Add assets to 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
To generate a response, call the responses.create method with a natural-language message in the input array and the knowledge store to reason over. This example prints the response identifier, session identifier, generated text, and token usage to the standard output.
Parameters:
knowledge_store_id: The unique identifier of the knowledge store to reason over. Every request requires exactly one.input: An array of input items. Each item is a message you send to Jockey.- (Optional)
session_id: Continues a multi-turn conversation. Pass the identifier from a previous response. See the Multi-turn sessions page. - (Optional)
instructions: Adds a per-request system prompt that shapes Jockey’s behavior for your domain or task. See the Customize behavior with instructions section for details. - (Optional)
include: An array of extra items to include in the response. Passintermediate_outputsto return Jockey’s reasoning steps in theoutputarray. See the Inspect intermediate outputs section for details. - (Optional)
selections: An array that restricts the request to specific knowledge store items or item collections. Omit to run against every item. - (Optional)
text: An object that specifies the response format. Provide a JSON Schema to return typed JSON output. See the Structured output page for details.
Return value: An object of type ResponseObject containing, among other information, the following fields:
id: The unique identifier of the response.session_id: The session identifier. Pass it in a follow-up request to continue the conversation. See the Multi-turn sessions page for details.status: The status of the response. The possible values arecompleted,failed,in_progress, andincomplete.output: The response output items. Iterate the array and read thetextfield of each content part in amessageitem to extract the generated text.usage: Token usage statistics, including theinput_tokensandoutput_tokensfields.
To stream the response as it is generated, call the create_stream method instead. See the Streaming page for details.
Example response
The response object contains the generated text along with the session identifier and token usage:
Customize behavior with instructions
Add the instructions field to specialize Jockey for your domain. Same endpoint, different results depending on what you provide.
Swap the instructions field to reshape Jockey for different contexts:
Inspect intermediate outputs
Jockey performs multi-step reasoning internally: searching, analyzing, and synthesizing across your videos and images. Add "intermediate_outputs" to the include array to see these reasoning steps alongside the final answer. This is useful for debugging or understanding how Jockey produced the answer.
Capabilities
The Responses API handles many tasks through the same endpoint. These examples are not exhaustive.
Common pitfalls
- Index at least one item before you query. A knowledge store with no items in the
readystate has no content for the request to draw on. - Include the knowledge store identifier. Every request must include the
knowledge_store_idfield.
Next steps
- Streaming - receive tokens in real time instead of waiting for the full response
- Structured output - receive typed JSON by providing a schema
- Multi-turn sessions - maintain conversation context across requests