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 am trying to connect to a Singlestore database with CrewAI's NL2SQL tool and I see this error
I encountered an error while trying to use the tool. This was the error: Arguments validation failed: 1 validation error for NL2SQLToolInput
sql_query
Field required [type=missing, input_value={'query': 'SELECT DISTINC...store_name FROM stores'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.10/v/missing.
Tool NL2SQLTool accepts these inputs: Converts natural language to SQL queries and executes them..
My code is pretty simple and straight forward, I used basic SQLAlchemy executor to verify the DB connection as well.
Steps to Reproduce
Use my code above.
Expected behavior
The Nl2sql tool must work properly when used as per the example.
Screenshots/Code snippets
from crewai import Agent, Crew, Task
from crewai_tools import NL2SQLTool
DATABASE_URI = f"mysql+pymysql://{db_cfgs["db_username"]}:{encoded_password}@{db_cfgs["db_host"]}:3306/{db_cfgs["db_name"]}"
# Define file paths for YAML configurations
files = {
'agents': 'config/agents.yaml',
'tasks': 'config/tasks.yaml'
}
# Load configurations from YAML files
configs = {}
for config_type, file_path in files.items():
with open(file_path, 'r') as file:
configs[config_type] = yaml.safe_load(file)
# Assign loaded configurations to specific variables
agents_config = configs['agents']
tasks_config = configs['tasks']
# create Agent
agent_text_to_sql = Agent(
config=agents_config['agent_text_to_sql'],
allow_delegation=False,
tools=[nl2sql]
)
# create Task
task_extract_data = Task(
config=tasks_config['task_extract_data'],
agent=agent_text_to_sql
)
# Creating Crew
crew = Crew(
agents=[
agent_text_to_sql
],
tasks=[
task_extract_data
],
verbose=True
)
# The given Python dictionary
inputs = {
"sql_query": "find all distinct stores"
}
# Run the crew
result = crew.kickoff(
inputs=inputs
)```
### Operating System
MacOS
### Python Version
3.12
### crewAI Version
0.95.0
### crewAI Tools Version
0.25.8
### Virtual Environment
Venv
The text was updated successfully, but these errors were encountered:
Description
I am trying to connect to a Singlestore database with CrewAI's NL2SQL tool and I see this error
My code is pretty simple and straight forward, I used basic SQLAlchemy executor to verify the DB connection as well.
Steps to Reproduce
Use my code above.
Expected behavior
The Nl2sql tool must work properly when used as per the example.
Screenshots/Code snippets
The text was updated successfully, but these errors were encountered: