Generate a corpus overview
This recipe shows you how to summarize all your videos and images (themes, subjects, content types, patterns, and key statistics) in a single request. You can receive the overview as prose or as structured JSON.
Use cases:
- Collection onboarding: Summarize a new collection before starting development
- Dashboard generation: Create collection summaries for a UI or reporting tool
- Pipeline input: Feed collection context to a downstream agent or workflow
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 shows two approaches: a plain-text overview that needs only a prompt, and a structured overview that adds a JSON schema to define the output format. Jockey reasons across your knowledge store, identifies themes and patterns, and returns results in the format you chose. You can adapt this recipe to target a specific domain or ask a different question about your collection.
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.
Plain-text overview
Return the overview as prose. This approach needs only a prompt.
Example
Copy and paste the code below, replacing the placeholders surrounded by <> with your values.
Code explanation
Python
Node.js
To generate a plain-text overview, call the responses.create method with a prompt that requests a collection summary.
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 requests a comprehensive overview covering themes, subjects, content types, and patterns.
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. Read thetextfield of each content part in amessageitem for the overview.usage: Token usage statistics, including theinput_tokensandoutput_tokensfields.
Example response
The text field inside each content part contains Jockey’s overview formatted as Markdown. A typical response looks like this:
Note
Jockey returns Markdown-formatted text. If your downstream pipeline expects plain prose, strip the Markdown formatting before processing.
Structured overview
Return the overview as JSON that matches a schema you define. Use this approach when downstream code expects typed fields.
Example
Copy and paste the code below, replacing the placeholders surrounded by <> with your values.
Code explanation
Python
Node.js
To receive a structured overview, call the responses.create method with a text parameter that describes your JSON 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.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()into a native object.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:
Note
Jockey evaluates the actual content in your knowledge store. Results change depending on the items you have indexed.
Variations
Adapt the analysis by changing the prompt or adding the instructions parameter.
- Target a domain: Add the
instructionsparameter, such as “You are a media analyst”, to shape the overview for a specific audience. - Compare collections: Change the prompt to “How do these videos and images compare to a typical corporate training library?”
- Find gaps: Change the prompt to “What topics are underrepresented in these videos and images?”
Jupyter notebook
See also
- Organize a video library - uses a corpus overview as the first step in a full workflow
- Structured output - more on JSON Schema responses
- Create a response - API reference for the Responses endpoint