Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] CSVSearchTool Error #1969

Open
Haseebasif7 opened this issue Jan 25, 2025 · 0 comments
Open

[BUG] CSVSearchTool Error #1969

Haseebasif7 opened this issue Jan 25, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Haseebasif7
Copy link

Description

I encountered an issue while using the CSV Search Tool in CrewAI. The tool fails to execute the search, and the following error is raised:
APIStatusError.init() missing 2 required keyword-only arguments: 'response' and 'body'.

The tool is expected to take a search query and return semantic results from the CSV, but the error occurs during execution, leaving the tool unusable. This prevents the agent from accessing and analyzing the data in the CSV.

Steps to Reproduce

from crewai_tools import CSVSearchTool
from crewai import Agent, Task, Crew, Process, LLM
from textwrap import dedent
import os
from dotenv import load_dotenv

load_dotenv()

llm = LLM(
model="gemini/gemini-1.5-flash",
api_key=os.getenv("API")
)

tool_search = CSVSearchTool(csv='data.csv')

planner = Agent(
llm=llm,
role=dedent((
"""
Data Engineer:
Responsible for answering every question about the data and providing actionable insights.
"""
)),
backstory=dedent((
"""
I am a Data Engineer with 5 years of experience in data analysis and engineering.
I have expertise in handling, transforming, and analyzing complex datasets using advanced tools and technologies.
My focus is on uncovering patterns, ensuring data integrity, and delivering insights to support decision-making.
"""
)),
goal=dedent((
"""
Answer all questions related to the data, provide meaningful insights, identify trends,
and resolve complex data-related challenges to facilitate informed decision-making.

    Question: {question} 
    Provide an analysis and actionable recommendations.
    """
)),
allow_delegation=False,
verbose=True,
tools=[tool_search]

)

task = Task(
description=dedent((
"""
A proficient Data Engineer tasked with leveraging expertise in data analysis and engineering
Question : {question}
"""
)),
expected_output=dedent((
"""
The agent should provide detailed and accurate answers to data-related questions, actionable insights,
about {question} and identify trends and patterns in the dataset.
"""
)),
agent=planner
)

crew = Crew(
agents=[planner],
tasks=[task],
process=Process.sequential
)

subject = 'Explain all the data insights and trends in the dataset.'

template_input = {"question": subject}

result = crew.kickoff(inputs=template_input)

Expected behavior

I encountered an error while trying to use the tool. This was the error: APIStatusError.init() missing 2 required keyword-only arguments: 'response' and 'body'.
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 data.csv CSV's content.

Agent:

Final Answer:

I cannot provide any data insights or trends without access to the data in the CSV file. Please provide the CSV data so I can perform the analysis.

The path given is correct I had Verified

Screenshots/Code snippets

Image

Image

Operating System

Windows 11

Python Version

3.12

crewAI Version

crewai, version 0.95.0

crewAI Tools Version

4.1.0

Virtual Environment

Venv

Evidence

Given Above

Possible Solution

None

Additional context

None

@Haseebasif7 Haseebasif7 added the bug Something isn't working label Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant