Skip to content

Conversation

@bhaskargurram-ai
Copy link

Description

This PR adds missing video support to the convert_to_openai_data_block function, addressing issue #33652.

Changes

  • Added elif block["type"] == "video": handling in convert_to_openai_data_block
  • Support for base64 encoded videos (both Chat Completions and Responses API)
  • Support for video URLs (Responses API only, with proper error for Chat API)
  • Support for video file IDs
  • Comprehensive error handling for missing required keys

Testing

Tested all video input scenarios:

  • ✅ Base64 encoded videos for both APIs
  • ✅ Video URLs (Responses API only)
  • ✅ Video file IDs
  • ✅ Proper error handling for unsupported combinations
  • ✅ Existing image/audio functionality remains intact

Fixes #33652

- Added video block handling for base64, URLs, and file_ids
- Support for both Chat Completions and Responses API formats
- Proper error handling for unsupported combinations
- Maintains consistency with existing audio/image handling patterns

Fixes langchain-ai#33652
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 24, 2025

CodSpeed Performance Report

Merging #33654 will improve performances by 20.26%

Comparing bhaskargurram-ai:fix-video-support-convert-openai (1bd15ea) with master (ef85161)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

⚡ 12 improvements
✅ 1 untouched
⏩ 21 skipped1

Benchmarks breakdown

Mode Benchmark BASE HEAD Change
WallTime test_import_time[BaseChatModel] 605.6 ms 503.5 ms +20.26%
WallTime test_import_time[CallbackManager] 523.4 ms 442.4 ms +18.3%
WallTime test_import_time[ChatPromptTemplate] 667.1 ms 568.7 ms +17.31%
WallTime test_import_time[Document] 206 ms 182.8 ms +12.68%
WallTime test_import_time[HumanMessage] 300.9 ms 260.5 ms +15.51%
WallTime test_import_time[InMemoryRateLimiter] 189.8 ms 170.9 ms +11.02%
WallTime test_import_time[InMemoryVectorStore] 692.1 ms 587.5 ms +17.8%
WallTime test_import_time[LangChainTracer] 493.1 ms 421.6 ms +16.96%
WallTime test_import_time[PydanticOutputParser] 604.2 ms 509.4 ms +18.61%
WallTime test_import_time[RunnableLambda] 541.9 ms 473.9 ms +14.33%
WallTime test_import_time[Runnable] 558.5 ms 468.5 ms +19.2%
WallTime test_import_time[tool] 567.1 ms 495.1 ms +14.52%

Footnotes

  1. 21 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@ccurme ccurme closed this Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Related to the package `langchain-core`

Projects

None yet

2 participants