Unable to use GPT-5 with Langchain's create_react_agent #32780
Unanswered
genaiconference
asked this question in
Q&A
Replies: 1 comment
-
If you are using the create_react_agent, it forces a stop argument itself (due to the construction of the react prompt so that the llm doesnt hallucinate after the first observation). You can check it in debug in agent -> steps -> RunnableBinding( kwargs={'stop': ['\nObservation']}). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
[Bug Report] GPT-5 "Unsupported parameter: 'stop'" Error — Needs Official LangChain Fix
Summary
When using **LangChain’s react agent using
create_react_agent
,AgentExecutor
with GPT-5 (viaAzureChatOpenAI
), executions consistently fail with the following error:BadRequestError: Error code: 400 - {'error': {'message': "Unsupported parameter: 'stop' is not supported with this model." ...}}
Using the below versions
langchain==0.3.27
langchain-openai==0.3.32
Details
"stop"
in my agent, model, or executor configuration."stop"
parameter is somehow included in the POST request to the GPT-5 endpoint.Attempted Fixes
"stop"
from_default_params
andmodel_kwargs
after LLM initialization."stop"
(not possible due to Pydantic restrictions).➡️ No success —
"stop"
keeps returning in the payload and causing the error.Impact
This prevents using GPT-5 models with LangChain agents, even on the latest versions (
langchain-core
,langchain-openai
, and Azure deployments).Request
Could LangChain developers address the following?
"stop"
automatically for GPT-5 and future models.Beta Was this translation helpful? Give feedback.
All reactions