Reputation: 11
I'm building a chatbot using LangChain and OpenAI. I'm utilizing LangChain to connect to a database and generate queries based on user prompts. Initially, it generates and executes queries correctly, but after running 2–3 queries, the execution hangs on subsequent queries.
from langchain_community.agent_toolkits.sql.base import create_sql_agent
db_agent = create_sql_agent(llm=llm,
toolkit=toolkit,
agent_type="tool-calling",
top_k=10,
verbose=True,
max_execution_time=30000,
max_iterations=10,
handle_parsing_errors=True,
handle_sql_errors=True)
What could be causing this issue, and how can I prevent the chatbot from hanging during query execution? Any insights on handling this in LangChain or optimizing the query generation process would be appreciated.
Upvotes: 0
Views: 82