Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLAgent requiring "chat_history"? #4663

Closed
SavvySupport opened this issue Nov 18, 2024 · 4 comments · Fixed by #4667
Closed

SQLAgent requiring "chat_history"? #4663

SavvySupport opened this issue Nov 18, 2024 · 4 comments · Fixed by #4667
Assignees
Labels
bug Something isn't working

Comments

@SavvySupport
Copy link

Bug Description

The SQLAgent shows error "chat_history not found in SQLAgentComponent".

Reproduction

  1. Build a flow with "OpenAI" (or equivalent LLM) and "SQLAgent" component
  2. Enter in API key for OpenAI, input and database URI for SQLAgent
  3. Run the SQLAgent
  4. Returns error below

Error building Component SQLAgent:

chat_history not found in SQLAgentComponent

Traceback (most recent call last):
File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/graph/vertex/base.py", line 708, in _build_results
result = await initialize.loading.get_instance_results(
File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/interface/initialize/loading.py", line 68, in get_instance_results
return await build_component(params=custom_params, custom_component=custom_component)
File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/interface/initialize/loading.py", line 145, in build_component
build_results, artifacts = await custom_component.build_results()
File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/custom/custom_component/component.py", line 837, in build_results
return await self._build_with_tracing()
File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/custom/custom_component/component.py", line 819, in _build_with_tracing
_results, _artifacts = await self._build_results()
File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/custom/custom_component/component.py", line 883, in _build_results
result = await method()
File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/base/agents/agent.py", line 81, in message_response
message = await self.run_agent(agent=agent)
File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/base/agents/agent.py", line 136, in run_agent
if self.chat_history:
File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/custom/custom_component/component.py", line 665, in getattr
raise AttributeError(msg)
AttributeError: chat_history not found in SQLAgentComponent

Expected behavior

Expecting a response from the SQLAgent, instead of an error message for "chat_history"

Who can help?

No response

Operating System

MacOS

Langflow Version

1.1

Python Version

3.10

Screenshot

Screenshot 2024-11-18 at 5 03 33 pm Screenshot 2024-11-18 at 5 03 56 pm

Flow File

No response

@SavvySupport SavvySupport added the bug Something isn't working label Nov 18, 2024
Copy link

dosubot bot commented Nov 18, 2024

The error you're encountering, "chat_history not found in SQLAgentComponent," suggests that the chat_history attribute is expected but not properly initialized or included in your setup. The chat_history is typically used to store previous interactions in a chat session, allowing the agent to maintain context or continuity in interactions [1][2].

To resolve this issue, you should ensure that the chat_history attribute is correctly initialized in your flow. This might involve explicitly defining or passing a chat_history parameter when setting up the SQLAgentComponent. If the component or flow setup does not automatically handle this, you may need to manually add a chat_history input or ensure that the component's configuration includes it as a DataInput.

If the issue persists, it might be helpful to check if there are any recent changes or updates in the codebase related to the SQLAgentComponent that could have introduced this requirement.

To continue talking to Dosu, mention @dosu.

@ogabrielluiz
Copy link
Contributor

Thanks for the report, @SavvySupport !

They were very helpful in pinpointing the bug.

@SavvySupport
Copy link
Author

Thanks for the report, @SavvySupport !

They were very helpful in pinpointing the bug.

No worries @ogabrielluiz ! Do you know when the fixes will be released?

@nec330
Copy link

nec330 commented Dec 11, 2024

this issue already had fixed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants