Skip to content

fix(langchain): handle missing response token details - #462

Open
annzhang-db wants to merge 2 commits into
databricks:mainfrom
annzhang-db:codex/fix-responses-usage-none-details
Open

fix(langchain): handle missing response token details#462
annzhang-db wants to merge 2 commits into
databricks:mainfrom
annzhang-db:codex/fix-responses-usage-none-details

Conversation

@annzhang-db

Copy link
Copy Markdown
Contributor

Fixes #461.

Responses API providers can omit input and output token-detail objects. Build LangChain usage metadata from the required token counts and only attach detail dictionaries when present, avoiding AIMessage and AIMessageChunk validation failures.

How do you know it works?

Regression coverage exercises direct conversion, normal Responses invocation, and streamed usage chunks both with and without detail objects. The complete chat-model unit module passes (108 passed, 2 skipped), along with Ruff formatting/lint and ty check.

annzhang-db and others added 2 commits August 15, 2026 00:42
@smurching
smurching marked this pull request as ready for review August 24, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ChatDatabricks: Responses API raises ValidationError when a provider omits token details

2 participants