You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched the LangChain documentation with the integrated search.
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).
Example Code
# Import necessary librariesimportosimportcassiofromlangchainimporthubfromlangchain.agentsimportAgentExecutor, create_openai_tools_agentfromlangchain_community.agent_toolkits.cassandra_database.toolkitimport (
CassandraDatabaseToolkit,
)
fromlangchain_community.tools.cassandra_database.promptimportQUERY_PATH_PROMPTfromlangchain_community.utilities.cassandra_databaseimportCassandraDatabasefromlangchain_openaiimportChatOpenAIfromdotenvimportload_dotenvdefinit_cassandra():
load_dotenv(override=True)
cassio.init(auto=True)
session=cassio.config.resolve_session()
ifnotsession:
raiseException(
"Check environment configuration or manually configure cassio connection parameters"
)
session.execute("""DROP KEYSPACE IF EXISTS langchain_agent_test; """)
session.execute(
""" CREATE KEYSPACE if not exists langchain_agent_test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; """
)
session.execute(
""" CREATE TABLE IF NOT EXISTS langchain_agent_test.user_credentials ( user_email text PRIMARY KEY, user_id UUID, password TEXT ); """
)
session.execute(
""" CREATE TABLE IF NOT EXISTS langchain_agent_test.users ( id UUID PRIMARY KEY, name TEXT, email TEXT );"""
)
session.execute(
""" CREATE TABLE IF NOT EXISTS langchain_agent_test.user_videos ( user_id UUID, video_id UUID, title TEXT, description TEXT, PRIMARY KEY (user_id, video_id) ); """
)
user_id="522b1fe2-2e36-4cef-a667-cd4237d08b89"video_id="27066014-bad7-9f58-5a30-f63fe03718f6"session.execute(
f""" INSERT INTO langchain_agent_test.user_credentials (user_id, user_email) VALUES ({user_id}, '[email protected]'); """
)
session.execute(
f""" INSERT INTO langchain_agent_test.users (id, name, email) VALUES ({user_id}, 'Patrick McFadin', '[email protected]'); """
)
session.execute(
f""" INSERT INTO langchain_agent_test.user_videos (user_id, video_id, title) VALUES ({user_id}, {video_id}, 'Use Langflow to Build a LangChain LLM Application in 5 Minutes'); """
)
session.set_keyspace("langchain_agent_test")
deftest_sql_agent(prompt):
load_dotenv(override=True)
cassio.init(auto=True)
session=cassio.config.resolve_session()
ifnotsession:
raiseException(
"Check environment configuration or manually configure cassio connection parameters"
)
db=CassandraDatabase(session=session)
llm=ChatOpenAI(temperature=0, model="gpt-3.5-turbo")
toolkit=CassandraDatabaseToolkit(db=db)
tools=toolkit.get_tools()
print("Available tools:")
fortoolintools:
print(tool.name+"\t- "+tool.description)
agent=create_openai_tools_agent(llm, tools, hub.pull("hwchase17/openai-tools-agent"))
input= (
QUERY_PATH_PROMPT+"\n\n"+prompt
)
agent_executor=AgentExecutor(agent=agent, tools=tools, verbose=True)
response=agent_executor.invoke({"input": input})
print(response["output"])
if__name__=="__main__":
# init_cassandra()prompt=f"Here is your task: In the langchain_agent_test keyspace Find all the videos that the user with the email address '[email protected]' has uploaded to the langchain_agent_test keyspace and tell me the result"test_sql_agent(prompt)
Error Message and Stack Trace (if applicable)
No response
Description
I want to use CassandraDatabaseToolkit to process data. I referred to the tutorial at https://python.langchain.com/v0.2/docs/integrations/tools/cassandra_database/, but unfortunately, my output is completely different from what is shown in the documentation. Through debugging, we found that it directly returned ActionFinish without executing the tools. Further analysis revealed that tool_calls is empty. Could you please explain why this is happening?
System Info
openai==1.14.0
langchain-community==0.3.18
The text was updated successfully, but these errors were encountered:
dosubotbot
added
the
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
label
Dec 22, 2024
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
No response
Description
I want to use CassandraDatabaseToolkit to process data. I referred to the tutorial at https://python.langchain.com/v0.2/docs/integrations/tools/cassandra_database/, but unfortunately, my output is completely different from what is shown in the documentation. Through debugging, we found that it directly returned ActionFinish without executing the tools. Further analysis revealed that tool_calls is empty. Could you please explain why this is happening?
System Info
openai==1.14.0
langchain-community==0.3.18
The text was updated successfully, but these errors were encountered: