Assemble highlight reels
This recipe shows you how to find and sequence clips from a video collection based on a theme, topic, or set of criteria. The response includes clip references with video identifiers, timestamps, and assembly notes, ready for your editing tool or pipeline.
Use cases:
- Marketing highlight reels: Select product demos and customer reactions for promotional videos
- Event recaps: Pull the best moments from conference or event footage
- Training compilations: Assemble instructional clips by topic or skill level
- Content repurposing: Find and sequence clips for social media or internal communications
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: Additional guidance that shapes Jockey’s behavior for a specific domain or task.
- 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 three elements: a JSON schema that defines the clip data structure, instructions that give Jockey a specific role and domain guidance, and a prompt that describes what you want in the highlight reel. Jockey reasons across your knowledge store, finds the best matching moments, and returns structured clip references in the order it recommends. You can adapt this recipe to target different editorial styles or content themes.
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 assemble a highlight reel, call the responses.create method with editorial instructions, 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 describes the highlight reel: what clips to find, how long the reel should be, and the thematic criteria.instructions: A per-request system prompt that shapes Jockey’s behavior for a domain or task. This example uses a video editor role that prioritizes pacing and variety.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 theclipsarray to read each selection in order.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
video_referencefield contains the asset identifier of the knowledge store item. - The
start_timeandend_timefields useMM:SSformat for videos under one hour andHH:MM:SSfor longer content. - Jockey returns clip references (video identifiers and timestamps), not rendered video files. Use these references with your video editing tool or pipeline to assemble the final reel.
Variations
Change the instructions and prompt to adapt this recipe for different editorial styles and content focuses.
- Change the editorial style: Set the
instructionsparameter to “documentary editor”, “social media creator”, or “training video producer.” - Change the content focus: Change the prompt to request “funny moments”, “technical deep dives”, or “executive summaries.”
- Refine with follow-up turns: Use a multi-turn session to adjust the results: “Replace the second clip with something more energetic.”
Jupyter notebook
See also
- Search a knowledge store - the single-step way to find clips
- Structured output - more on JSON Schema responses
- Create a response - API reference for the Responses endpoint