Skip to content

AzureOpenAiChatClient langchain reasoning models o*, gpt-5* will fail if passed in max_tokens, temperature and even api versions are problematic #1174

@krodyrobi

Description

@krodyrobi

Describe the Bug

It seems for these models a breaking change happened sillently and the correct key would be max_completion_tokens

https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-openai/src/chat_models.ts#L2355
(permanent link: https://github.com/langchain-ai/langchainjs/blob/b8ffc1e613cf5a469127ed57195053f18d29b297/libs/langchain-openai/src/chat_models.ts#L2363)

Also noticed that these models seem to treat roles differently
https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-openai/src/chat_models.ts#L363
(permanent link: https://github.com/langchain-ai/langchainjs/blob/b8ffc1e613cf5a469127ed57195053f18d29b297/libs/langchain-openai/src/chat_models.ts#L366C4-L369C1)

Steps to Reproduce

n/a

Expected Behavior

max_tokens to be forwarded under the correct key

Screenshots

No response

Used Versions

  • Node version via node -v: ...
  • NPM version via `npm -v: ...
  • SAP Cloud SDK for AI version:
    • ...
    • ...

Code Examples

No response

Log File

No response

Region

EU10

Affected Development Phase

Getting Started

Impact

No Impact

Timeline

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions