Skip to content

fix(openai): omit timeout from client_params when not set by user#35616

Open
Mohammad Mohtashim (keenborder786) wants to merge 7 commits intolangchain-ai:masterfrom
keenborder786:fix/update_default_value
Open

fix(openai): omit timeout from client_params when not set by user#35616
Mohammad Mohtashim (keenborder786) wants to merge 7 commits intolangchain-ai:masterfrom
keenborder786:fix/update_default_value

Conversation

@keenborder786
Copy link
Copy Markdown
Contributor

@keenborder786 Mohammad Mohtashim (keenborder786) commented Mar 7, 2026

When request_timeout is None (the default), we passed timeout=None to the OpenAI SDK, which interprets it as "disable all timeouts" — bypassing the built-in 600s default and causing infinite hangs on network issues.

Now we omit the timeout key entirely when unset, so the SDK default applies. Aligns with langchain-google-genai's existing approach.

Fixes #35597

@github-actions github-actions bot added integration PR made that is related to a provider partner package integration openai `langchain-openai` package issues & PRs external fix For PRs that implement a fix and removed fix For PRs that implement a fix labels Mar 7, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 7, 2026

Merging this PR will degrade performance by 12.03%

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

❌ 3 regressed benchmarks
⏩ 37 skipped benchmarks1

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

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime test_init_time 3.2 ms 3.7 ms -12.03%
WallTime test_init_time 121.5 ms 137.7 ms -11.75%
WallTime test_init_time 3.2 ms 3.7 ms -11.54%

Comparing keenborder786:fix/update_default_value (d784e35) with master (90d015c)

Open in CodSpeed

Footnotes

  1. 37 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.

@github-actions github-actions bot added the langchain `langchain` package issues & PRs label Mar 7, 2026
@github-actions github-actions bot added the langchain-classic `langchain-classic` package issues & PRs label Mar 7, 2026
@keenborder786 Mohammad Mohtashim (keenborder786) changed the title fix(openai): align ChatOpenAI default request_timeout with OpenAI SDK default fix(openai): omit timeout from client_params when not set by user Mar 8, 2026
@github-actions github-actions bot added fix For PRs that implement a fix and removed fix For PRs that implement a fix labels Mar 8, 2026
@github-actions github-actions bot added the size: XS < 50 LOC label Mar 9, 2026
@org-membership-reviewer org-membership-reviewer bot added the trusted-contributor >= 5 merged PRs in the `langchain-ai/langchain` repo label Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external fix For PRs that implement a fix integration PR made that is related to a provider partner package integration langchain `langchain` package issues & PRs langchain-classic `langchain-classic` package issues & PRs openai `langchain-openai` package issues & PRs size: XS < 50 LOC trusted-contributor >= 5 merged PRs in the `langchain-ai/langchain` repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ChatOpenAI/ChatAnthropic: request_timeout=None (default) disables SDK timeout, causing infinite hangs

2 participants