crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

[BUG] - NL2Sql is falling

Open Neerajkumar12 opened this issue 1 year ago • 0 comments

Description

I am trying to implement NL2Sql_tool in my project, I encountered an error while trying to use the tool. This was the error: Arguments validation failed: 1 validation error for NL2SQLToolInput sql_query, Even i am using latest version of CrewAI==0.95.0

Steps to Reproduce

image

Expected behavior

The expected behaviour is an accurate, well-optimized SQL query generated from the user's natural language input

Screenshots/Code snippets

      if tool.toolName == 'NL2SQLTool':
                  #this is not my db_uri, i have just hide it
                  db_uri = "postgresql://postgres****-postgresql-server-****** :5432"
                  if db_uri is None:
                      raise ValueError("Missing connection_url for NL2sql_tool")
                  if db_uri:
                      try:
                          nl2sql_tool = NL2SQLTool(db_uri=db_uri)
                          logger.info(f"NL2SQLTool initialized with database URI: {db_uri}")
                          
                          
                         # checking database is connected or not
                          if test_connection(db_uri):
                              logger.info("Successfully connected to the database")
  
                          agent_model.tools.append(nl2sql_tool)

Operating System

Windows 11

Python Version

3.12

crewAI Version

0.95.0

crewAI Tools Version

0.25.8

Virtual Environment

Venv

Evidence

image

Possible Solution

None

Additional context

None

Neerajkumar12 avatar Jan 08 '25 18:01 Neerajkumar12