Overview
Sonar models can return videos as part of their responses to provide rich multimedia content that enhances the information delivered. You can control video returns using themedia_response
parameter with overrides
to specify when videos should be included in responses.
Use the
media_response.overrides.return_videos
parameter to control when videos are returned in API responses.Video returns may increase response size and processing time. Use this feature selectively for queries where video content adds significant value.
Basic Usage
To enable video returns, include themedia_response
parameter with overrides.return_videos
set to true
in your request.
Simple Video Request
Sample Response
Sample Response
Use Case Examples
Sports and Events
Request videos for major sporting events or news:Educational Content
Get instructional videos for learning topics:Technology Demonstrations
Request videos showing product demos or tutorials:Combined Media Responses
You can combine video returns with other media response options:Videos with Images
Videos with Search Filters
Advanced Usage
Streaming with Videos
Enable streaming responses while including video content:Multi-turn Conversation with Videos
Continue a conversation while maintaining video context:Best Practices
Query Optimization
Query Optimization
- Be specific: Use descriptive queries that clearly indicate when video content would be valuable
- Include context: Mention specific events, products, or topics that commonly have video coverage
- Use recency filters: Combine with search filters to get the most current video content
- Consider query intent: Videos work best for demonstrations, tutorials, events, and visual explanations
Performance Considerations
Performance Considerations
- Monitor response times: Video-enabled requests may take longer to process
- Handle larger payloads: Responses containing videos will be larger than text-only responses
- Implement timeouts: Set appropriate timeout values for video-enabled requests
- Cache strategically: Consider caching video responses for frequently requested content
Content Quality
Content Quality
- Verify video relevance: Not all queries will return relevant video content
- Handle empty results: Implement fallback logic when no videos are available
- Check video accessibility: Ensure returned video content is accessible and appropriate
- Validate video links: Test that returned video URLs are functional before displaying
Response Format
When videos are returned, they appear in the response content along with text. The videos will be included as part of the response structure, with video URLs and metadata available for display or processing.Common Use Cases
News and Current Events
Product Reviews and Demonstrations
Educational and How-to Content
Troubleshooting
No Videos Returned
No Videos Returned
If your request doesn’t return videos:
- Verify the
media_response.overrides.return_videos
parameter is set totrue
- Check that your query is likely to have video content available
- Ensure you’re using a model that supports video returns (sonar-pro recommended)
- Try different query phrasings that explicitly mention video content
Request Timeouts
Request Timeouts
For timeout issues:
- Increase your request timeout settings
- Use streaming responses for better user experience
- Consider breaking complex queries into smaller parts
- Implement retry logic for failed requests
Large Response Handling
Large Response Handling
When dealing with video-heavy responses:
- Implement proper JSON parsing for large payloads
- Consider pagination for multiple video results
- Use appropriate data structures to handle media content
- Implement progressive loading for video content
Limitations
Current Limitations:
- Video returns may not be available for all query types
- Response times will be longer when videos are included
- Video content availability depends on external sources
- Some video content may be region-restricted
- No direct video format or quality control options currently available
Environment Variables
For security, use environment variables for your API key:Start with simple queries to test video returns, then gradually build more complex requests as you understand the response patterns and performance characteristics.