Skip to content

Conversation

ccurme
Copy link
Collaborator

@ccurme ccurme commented Sep 10, 2025

This requires a small refactor.

Currently we pass all standard inputs through convert_to_openai_data_block in langchain-core, which returns chat completions format. BaseChatOpenAI then translates to Responses format if needed.

PDFs specified via URLs are not supported by chat completions, so ideally convert_to_openai_data_block continues to raise an informative ValueError there.

Simplest solution IMO is to enable convert_to_openai_data_block to return either Chat Completions or Responses format, and do the translation there instead of in BaseChatOpenAI.

BaseChatOpenAI continues to accept chat completions format directly on Responses path.

@ccurme ccurme requested a review from eyurtsev as a code owner September 10, 2025 02:01
Copy link

vercel bot commented Sep 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
langchain Ready Ready Preview Comment Sep 10, 2025 2:12pm

Copy link

codspeed-hq bot commented Sep 10, 2025

CodSpeed WallTime Performance Report

Merging #32876 will degrade performances by 12.53%

Comparing cc/openai_pdf_url (9a9fc88) with wip-v1.0 (a48ace5)

⚠️ 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

❌ 3 regressions
✅ 10 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
test_import_time[BaseChatModel] 494.9 ms 565.8 ms -12.53%
test_import_time[ChatPromptTemplate] 554.3 ms 628.8 ms -11.84%
test_import_time[PydanticOutputParser] 499.9 ms 561.3 ms -10.94%

@ccurme ccurme changed the title feat(openai): (v1) support pdfs passed via url in openai / responses feat(openai): (v1) support pdfs passed via url in standard format Sep 10, 2025
Copy link

codspeed-hq bot commented Sep 10, 2025

CodSpeed Instrumentation Performance Report

Merging #32876 will not alter performance

Comparing cc/openai_pdf_url (9a9fc88) with wip-v1.0 (a48ace5)

Summary

✅ 14 untouched benchmarks

@ccurme
Copy link
Collaborator Author

ccurme commented Sep 10, 2025

Need to add back more descriptive warning / error if users pass {"type": "file", "url": "..."} to chat completions.

@ccurme ccurme marked this pull request as ready for review September 10, 2025 14:04
@ccurme ccurme requested a review from mdrxy September 10, 2025 14:08
@mdrxy mdrxy added the integration Related to a provider partner package integration label Sep 10, 2025
@mdrxy mdrxy added this to the v1 milestone Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration Related to a provider partner package integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants