Repository navigation
Conversation
…meters Stop forwarding container, inference_geo and metadata, so the handler forwards the same model.parameters keys as the Python SDK. Drop a thinking, tool_choice, cache_control or output_config value of the wrong shape instead of sending it.
…meters Stop forwarding context_management, include, instructions, metadata, moderation, prompt_cache_retention, safety_identifier, store, truncation and user, so invoke and stream forward the same keys as the Python SDK. reasoning keeps only effort and summary, and a malformed reasoning or tool_choice is dropped instead of sent. max_tool_calls is on the shared list but not on ResponseCreateParamsBase in the installed openai package, so it is not forwarded.
Stop forwarding context_management, prompt_cache_retention, store and truncation into ModelSettings, in the handler and the native graph, so they match the Python SDK. A tool_choice that is not a string is now dropped instead of passed on.
Narrow the ChatOpenAI, ChatAnthropic and ChatBedrockConverse allowlists, used by both LangChain packages and the LangGraph native graph's default model, to the lists the Python SDK forwards. This stops forwarding LangChain wiring and logging settings (tags, metadata, verbose, streaming, stream_usage, disable_streaming, output_version), settings that switch ChatOpenAI to the Responses API (reasoning, use_responses_api), data location and retention settings (inference_geo, prompt_cache_retention, zdr_enabled), and audio, modalities, user, context_management, guardrail_config and supports_tool_choice_values. ChatAnthropic now also takes stop as stopSequences and max_tokens_to_sample as maxTokens, since it has neither field under those names. A malformed thinking, output_config, logit_bias or performance_config is dropped instead of passed on.
…K list The list itself is unchanged. The new test proves invoke and stream add exactly those query options and nothing else.
Contributor
Author
|
bugbot run |
The Python ChatOpenAI has no such field, so the cross-SDK list cuts it for both SDKs. OpenAI Messages still forwards it to the Responses API.
Contributor
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 0e963d3. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The JS and Python SDKs have to forward the same
model.parameterskeys before 1.0. Jeff's review of launchdarkly/python-ai-sdk#107 found that the lists from #73 differ from Python's. The shared lists are now in the cross-SDK spec (launchdarkly/ai-sdks-monorepo#42, TESTING.md §1.12), and Python is moving to them too. This PR makes each JS handler forward exactly those lists.What changed:
container,inference_geoandmetadata.context_management,include,instructions,metadata,moderation,prompt_cache_retention,safety_identifier,store,truncationanduser, on both invoke and stream.max_tool_callsis not forwarded: theopenaipackage has no such field onResponseCreateParamsBase, so the spec cuts it for both SDKs.context_management,prompt_cache_retention,storeandtruncation.audio,disable_streaming,metadata,modalities,output_version,prompt_cache_key,prompt_cache_retention,reasoning,stream_usage,streaming,tags,use_responses_api,user,verboseandzdr_enabled.prompt_cache_keyis cut because the PythonChatOpenAIhas no such field; OpenAI Messages still forwards it.context_management,disable_streaming,inference_geo,metadata,output_version,stream_usage,streaming,tagsandverbose. It now takesstopasstopSequencesandmax_tokens_to_sampleasmaxTokens, becauseChatAnthropichas neither field under those names.disable_streaming,guardrail_config,metadata,output_version,stream_usage,streaming,supports_tool_choice_values,tagsandverbose.Following the spec, nested values with the wrong shape are dropped instead of sent. Examples are a
thinkingwithout atype, areasoningthat is not an object, or atool_choiceof the wrong type. OpenAI Messagesreasoningkeeps onlyeffortandsummary, as OpenAI Agents already did.Testing:
__tests__/never-forwarded.ts, so the existing bag tests prove it is gone.yarn test,yarn typecheckandbiome check .pass locally.Note
Overview
Aligns JS provider handlers with the cross-SDK
model.parametersallowlists (TESTING.md §1.12) so forwarding matches the Python SDK before 1.0.Handlers now forward only generation-shaping keys and stop passing retention, attribution, server-side state, and wiring fields that were previously allowed (e.g. Claude Messages:
container,inference_geo,metadata; OpenAI Messages/Agents:store,context_management,truncation, etc.; LangChain:reasoning,use_responses_api,guardrail_config,metadata, streaming flags, and more). Malformed nested values (thinking,tool_choice,reasoning,output_config, etc.) are dropped instead of sent; OpenAI Messages trimsreasoningtoeffort/summary. LangChain ChatAnthropic mapsmax_tokens_to_sample→maxTokensandstop→stopSequences. OpenAI Agents removescontext_managementtransformation frombuildModelSettings.Tests add canonical-key parity for invoke vs stream, expand
NEVER_FORWARDED_KEYS, and cover malformed-parameter drops.Reviewed by Cursor Bugbot for commit 0e963d3. Bugbot is set up for automated code reviews on this repo. Configure here.