Skip to main content
Video contains a wealth of conversational potential, but extracting meaningful insights through natural language queries requires sophisticated understanding of both spoken content and visual context. While basic transcription gives you raw text, chat completions with Media Description Collections allow you to have intelligent conversations with your video content. With Cloudglue’s Chat Completion API and Media Description Collections, you can ask natural language questions about your videos and receive contextually accurate responses grounded in the actual video content—including speech, visual scenes, and on-screen text.
Chat completions work with both locally uploaded videos and YouTube content, with multimodal understanding available for uploaded files.

Understanding Media Description Collections

Media Description Collections are specialized collections that combine multiple layers of video understanding:
  1. Speech transcription: What’s being said in the video
  2. Visual scene descriptions: What’s happening visually
  3. On-screen text: Text and captions visible in the video
  4. Contextual understanding: How all these elements work together
Unlike basic transcription, Media Description Collections create a searchable knowledge base that enables semantic queries across all modalities of your video content.

When to Use Chat Completions

Chat completions with Media Description Collections are ideal when you need to:
  1. Answer specific questions about video content without watching the entire video
  2. Extract insights that span multiple segments or videos
  3. Generate summaries with specific focus areas or perspectives
  4. Find precise information using natural language rather than keyword search
  5. Build conversational interfaces that can discuss video content intelligently

Core Chat Completion Parameters

Essential Parameters

Messages Array

The messages array follows the standard chat completion format:
  • role: “user”, “assistant”, or “system”
  • content: The message content
For multi-turn conversations, include the full conversation history:

Model: nimbus-001

Cloudglue’s nimbus-001 is a specialized model optimized for:
  • Multimodal understanding: Processes speech, visual, and text content together
  • Grounded responses: Answers are based on actual video content, not training data
  • Citation support: Can provide specific timestamps and sources
  • Conversational context: Maintains context across multiple exchanges
The force_search parameter controls whether the system searches your collections:
  • true: Always searches collections before responding (recommended)
  • false: May respond from general knowledge without searching

Include Citations

Citations provide transparency and verifiability:
  • true: Returns timestamps, file references, and content snippets
  • false: Returns only the response text

Advanced Search Filters

For precise control over what content is searched, you can use metadata filters to target specific videos in your collection:

Supported Filter Operations

The filter parameter allows you to constrain searches using file metadata:
  • path: JSON path to the metadata field (e.g., "metadata.custom_field" or "video_info.has_audio")
  • operator: Comparison operator to apply
    • Equal / NotEqual: Exact match comparison
    • LessThan / GreaterThan: Numeric comparison
    • In: Check if value is in a comma-separated list
    • ContainsAny / ContainsAll: Array operations (use valueTextArray)
  • valueText: Single value for scalar comparisons
  • valueTextArray: Array of values for array operations
Example metadata filter scenarios:

Practical Example: Cooking Video Chat Bot

Let’s build a comprehensive example using cooking videos to demonstrate multi-turn conversations and advanced features.

Setting Up the Collection

Multi-Turn Conversation Example

Now let’s demonstrate a realistic conversation about pasta recipes. This example shows how to build a stateful chatbot that maintains conversation history and can handle follow-up questions. The implementation demonstrates proper conversation state management, error handling, and how to structure questions for optimal results from the nimbus-001 model.
Key features demonstrated in this example:
  • Conversation State Management: The chatbot maintains conversation history across multiple questions
  • TypeScript Integration: Full type safety with proper Cloudglue SDK types
  • Multiple Question Types: Shows different query patterns (techniques, ingredients, visual cues, structured output)
  • Citation Handling: Demonstrates how to access and count citation sources
  • Environment Configuration: Proper setup with environment variables and command-line arguments
  • Error Handling: Safe access to response properties with optional chaining
  • Production-Ready Structure: Modular design that can be extended for real applications

Example Conversation Output

Here’s what a realistic conversation might look like:

Advanced Techniques

Using System Messages for Specialized Responses

You can guide the model’s behavior using system messages:

Search Optimization with Filters

For complex queries, use metadata filters to target specific videos in your collection:

Understanding Citations

When you set include_citations: true, the response includes detailed references to the specific video segments that informed the answer. This provides transparency and allows users to verify information or explore the original content.

Example Citation Response

Let’s examine what a real citation response looks like for the question “What cooking techniques are used for pasta dishes?”:

Complete JSON Response with Citations

Key Citation Fields

Each citation provides detailed information about the source:
  • collection_id: ID of the collection containing the video
  • file_id: Unique identifier for the specific video file
  • segment_id: ID of the specific segment within the video
  • start_time / end_time: Precise timestamps in seconds
  • text: Brief description of the segment’s relevance
  • speech: Array of transcribed speech with speaker identification and timestamps
  • visual_scene_description: Visual content descriptions (when available)
  • audio_description: Audio content descriptions (when available)
  • scene_text: On-screen text detected in the segment

Using Citation Data

Citations enable powerful functionality in your applications:
This citation system ensures that every response can be traced back to its original source, providing transparency and enabling users to explore the full context of the information.

Best Practices

1. Design Effective Conversations

  • Start broad, then narrow: Begin with overview questions, then drill into specifics
  • Maintain context: Include relevant conversation history for follow-up questions
  • Use specific terminology: Culinary terms, technique names, and ingredient specifics yield better results

2. Optimize Search Parameters

  • Use force_search: true for accuracy when you need video-specific information
  • Apply metadata filters when you need to target specific subsets of your video collection
  • Set appropriate temperature: Lower (0.1-0.3) for factual responses, higher (0.5-0.7) for creative interpretations

3. Structure Complex Requests

4. Handle Multi-Video Collections

  • Reference specific videos when asking comparative questions
  • Use metadata filters to focus on relevant subsets of your collection
  • Aggregate insights by asking for patterns across multiple sources

5. Leverage Citation Information

  • Verify key facts by checking citation timestamps
  • Cross-reference information across multiple cited segments
  • Guide users to specific video moments for deeper learning

Try it out

Ready to start building conversational video experiences? Check out our Chat Completion API to get started with Media Description Collections. Experiment with different question types:
  • Factual queries: “What ingredients are used?”
  • Technique analysis: “How do the chefs differ in their approach?”
  • Structured requests: “Create a recipe in markdown format”
  • Comparative questions: “Which method is more traditional?”
Get started on our platform and create your first Media Description Collection today.

Advanced Integration Patterns

For production applications, consider implementing:
  • Conversation persistence: Store and resume chat sessions
  • Response caching: Cache common queries for better performance
  • Citation indexing: Build searchable citation databases for content discovery
  • Multi-collection queries: Search across different video collections simultaneously
  • Response validation: Implement confidence scoring based on citation quality