[X] I added a very descriptive title to this issue.
[X] I searched the LangChain documentation with the integrated search.
[X] I used the GitHub search to find a similar question and didn't find it.
[X] I am sure that this is a bug in LangChain rather than my code.
[X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
I have followed the instructions to create a react agent that can query sqlite database:
agent_executor = create_react_agent(chat_model, tools, messages_modifier=system_message)
for s in agent_executor.stream(
{"messages": [HumanMessage(content="Which country's customers spent the most?")]}
):
print(s)
print("----")
Error Message and Stack Trace (if applicable)
No response
Description
the stream stopped on the very first AIMessage. This is what I got after running this code:
{'agent': {'messages': [AIMessage(content="To determine which country's customers spent the most, we need to look at the relevant tables in the database. First, let's list all the tables to understand the structure of the database.", additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 36, 'prompt_tokens': 549, 'total_tokens': 585}, 'model_name': 'gpt-4o', 'system_fingerprint': 'fp_f5a70d8dc9', 'finish_reason': 'stop', 'logprobs': None}, id='run-fa55841d-026a-4bd9-9060-24740c0ec6ad-0', usage_metadata={'input_tokens': 549, 'output_tokens': 36, 'total_tokens': 585})]}}
System Info
System Information
OS: Windows
OS Version: 10.0.19045
Python Version: 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
Hello! We're a group of students from the University of Toronto Scarborough, and we're looking to contribute to LangChain. We'd love the opportunity to investigate this bug further.
Checked other resources
Example Code
I have followed the instructions to create a react agent that can query sqlite database:
Error Message and Stack Trace (if applicable)
No response
Description
the stream stopped on the very first AIMessage. This is what I got after running this code: {'agent': {'messages': [AIMessage(content="To determine which country's customers spent the most, we need to look at the relevant tables in the database. First, let's list all the tables to understand the structure of the database.", additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 36, 'prompt_tokens': 549, 'total_tokens': 585}, 'model_name': 'gpt-4o', 'system_fingerprint': 'fp_f5a70d8dc9', 'finish_reason': 'stop', 'logprobs': None}, id='run-fa55841d-026a-4bd9-9060-24740c0ec6ad-0', usage_metadata={'input_tokens': 549, 'output_tokens': 36, 'total_tokens': 585})]}}
System Info
System Information
Package Information
Optional packages not installed