VectorMethods

Docs / Guides

Create prompts with nested schemas

Create VideoVector prompts with nested JSON Schema fields, repeated objects, semantic indexing controls, and schema validation.

sdk/videovector/resources/prompts.pyfrontend/src/components/prompt-schema/schemaFields.tsapi/routes.py

Search documentation

Search pages, API reference sections, and guide headings.

Summary

This guide shows how to define a prompt with nested and repeated fields, validate the schema, and keep the output shape usable for search and filtering.

Build the segment-level schema first

Start with the evidence-level fields you need per segment.

For schema-aware video metadata extraction, treat the schema as the public contract that operators, search filters, exports, and downstream applications will reuse. Stable nested field names make JSON schema media extraction easier to query after prompt runs complete.

{
  "type": "object",
  "properties": {
    "headline": { "type": "string" },
    "scene": {
      "type": "object",
      "properties": {
        "location": { "type": "string" },
        "people": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": { "type": "string" },
              "emotion": { "type": "string" }
            }
          }
        }
      }
    }
  }
}

Create the prompt

from videovector import VideoVector

schema = {
    "type": "object",
    "properties": {
        "headline": {"type": "string"},
        "scene": {
            "type": "object",
            "properties": {
                "location": {"type": "string"},
                "people": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "name": {"type": "string"},
                            "emotion": {"type": "string"},
                        },
                    },
                },
            },
        },
    },
}

with VideoVector(api_key="sk_live_...") as client:
    prompt = client.prompts.create(
        name="Segment scene extractor",
        description="Extract scene-level review metadata.",
        prompt_text="Extract the requested fields from this media segment.",
        json_schema=schema,
        semantic_indexing={
            "disabled_segment_fields": [],
            "disabled_video_level_fields": [],
        },
    )

Validate the schema against sample data

Use the public schema test surface before you save or publish a contract that downstream systems rely on.

curl -X POST https://playground-api-stg-udk7d32fva-uc.a.run.app/api/v2/prompts/test-schema \
  -H "Authorization: Bearer <token-or-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "json_schema": {
      "type": "object",
      "properties": {
        "headline": { "type": "string" }
      }
    },
    "sample_data": {
      "headline": "Crowd gathers near station entrance"
    }
  }'

Keep the schema query-friendly

  • Use stable field names.
  • Avoid ., [ and ] in field names.
  • Treat repeated object fields as future filter paths such as scene.people[].emotion.
  • Disable semantic indexing only when a field should stay in structured output but not in embeddings.

When to add video-level synthesis

If the workflow also needs one result per media item, add video_level after the segment-level schema is stable. That keeps evidence extraction and media-wide synthesis as separate contracts.

Related documentation

Prompt schemas define what gets extracted, what becomes searchable, and what can be reused in video-level synthesis. This page covers the public schema rules and field-path conventions.

API reference

Prompts define the extraction contract. The public API supports prompt CRUD, schema testing, usage inspection, and prompt-definition draft generation.

Add a second prompt layer that rolls segment evidence into one result per media item without replacing the segment-level output.