Skip to content

Conversation

DyanGalih
Copy link

fix(agents): avoid sending unsupported 'stop' param to models (e.g. gpt-5-nano)

Detect whether a model supports the stop parameter and only bind stop sequences when supported. Prevents 400 errors from models that reject stop. Files touched: ConversationalAgent, agents utils, XMLAgent (conditional stop binding).

…pt-5-nano)

Detect whether a model supports the `stop` parameter and only bind stop sequences when supported.
Prevents 400 errors from models that reject `stop`.
Files touched: ConversationalAgent, agents utils, XMLAgent (conditional stop binding).
@HenryHengZJ
Copy link
Contributor

The latest version should already fixed that, see here

@DyanGalih
Copy link
Author

This bugfix is related to the unsupported 'stop' message for all gpt-5*, o1*, and o3* models.

This is the issue in the main branch:
image

this is from my curent branch
image

} from 'langchain/agents'
import { formatLogToString } from 'langchain/agents/format_scratchpad/log'
import { IUsedTool } from './Interface'
import { modelSupportsStop } from './utils'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where does this come from? I dont see any changes in utils file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the changes from the utils.ts file. Please check. Thanks

@HenryHengZJ
Copy link
Contributor

Or, can you try using AgentflowV2?

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.

2 participants