Skip to content

Conversation

@Abhinavexists
Copy link
Contributor

Description

Fixed a bug where NotRequired fields in TypedDict caused a TypeError when converting to OpenAI function schema. The fix properly handles NotRequired and Required type annotations by:

Detecting and unwrapping NotRequired/Required annotations, Correctly excluding NotRequired fields from the required list in the OpenAI schema

Issue

Fixes: #34085

Dependencies

None

The implementation also includes a test case that validates the proper handling of TypedDict with NotRequired fields when converting to OpenAI function schema format.

@github-actions github-actions bot added core Related to the package `langchain-core` fix labels Nov 24, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 24, 2025

CodSpeed Performance Report

Merging #34093 will not alter performance

Comparing Abhinavexists:type-error-fix-openai-function-schema (2dfdfc8) with master (c375732)1

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

✅ 13 untouched
⏩ 21 skipped2

Footnotes

  1. No successful run was found on master (7fe1c4b) during the generation of this report, so c375732 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 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.

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` fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NotRequired in TypedDict causes TypeError when converting to OpenAI function schema

1 participant