Problem Description
In the Python LangChain/LangGraph SDK, the ChatOpenAI class supports an extra_body parameter that allows passing additional parameters to the OpenAI API client:
Python example:
# Python Example
chat = ChatOpenAI(
extra_body={
"custom_parameter": "value"
}
)
The current JavaScript/TypeScript implementation lacks a direct equivalent for adding custom body parameters to API requests.
Use Cases
Developers might want to:
- Include additional metadata with API calls
- Support experimental or vendor-specific API parameters
- Maintain feature parity with the Python SDK
Proposed Solution
Add a configuration option in the LangGraph JS SDK’s ChatOpenAI class that allows passing extra body parameters, similar to the Python implementation.
const chat = new ChatOpenAI({
extraBody: {
custom_parameter: "value"
}
});