CSVSearchTool Tool Usage Failed

CSV search tool failes with following error

Tool Usage Failed
Name: Search a CSV’s content Error: APIConnectionError.init() takes 1 positional argument but 2 were given

In crew.py, used tool to initialize as below
tool = CSVSearchTool(csv=“/Users/XX/samplenew.csv”)

Following additional error is shown in console

I encountered an error while trying to use the tool. This was the error: APIConnectionError.init() takes 1 positional argument but 2 were given.
Tool Search a CSV’s content accepts these inputs: Tool Name: Search a CSV’s content
Tool Arguments: {‘search_query’: {‘description’: “Mandatory search query you want to use to search the CSV’s content”, ‘type’: ‘str’}}
Tool Description: A tool that can be used to semantic search a query the /Users/XX/samplenew.csv CSV’s content.

Any help is greatly appreciated

Looks like this is a version compatibility issue mostly. Still unable to figure out which version of crewai-tool and other library works. Any help is greatly appreciated.

Ravish, first off, welcome to the community!

I just gave the tool a whirl, and everything seems to be working smoothly on my end. I’m running crewai-tools==0.45.0 and using Google’s embedding model. (Just a heads-up, if you’re not on OpenAI, you’ve gotta explicitly set up your embedding model):

from crewai_tools import CSVSearchTool
import os

os.environ["GOOGLE_API_KEY"] = "<YOUR-KEY>"

embedchain_config = {
    "embedder": {
        "provider": "google",
        "config": {
            "model": "models/text-embedding-004",
            "task_type": "RETRIEVAL_DOCUMENT"
        }
    }
}

tool = CSVSearchTool(
    csv="<PATH-TO-YOUR-FILE>.csv",
    config=embedchain_config
)

# Test a query
tool.run("<YOUR-QUERY>")

Thanks. This helps. I was able to proceed with tool error. However bumped into this issue List index out of range msg_i - #5 by Dom. Was able to perform the workaround as mentioned

1 Like