The current `create_agent` agent's `invoke()` response cannot include a `structured_response`.
Closed this issue · 1 comments
precious0612 commented
Checked other resources
- This is a bug, not a usage question.
- I added a clear and descriptive title that summarizes this issue.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
- This is not related to the langchain-community package.
- I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
- I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.
Example Code
Such as
class StructuredResponse(BaseModel):
id: str
context: str
agent = create_agent(model=llm, response_format=StructuredResponse)
result = agent.invoke()Error Message and Stack Trace (if applicable)
The standard result must include both "message" and "structured_response"; however, currently, it only contains "message."
Description
I have printed the response content; it is also in JSON format, but it only includes the "message." The final AIMessage contains the complete structured result. The "finish_reason" being "stop" indicates that it worked correctly.
System Info
python test.py
sydney-runkle commented
Hi, please attach a reproducible snippet so that we can offer some help!
This should have all imports included and run from start to finish. Going to close as stale for now, happy to help if you have a repro!