crewAI-tools icon indicating copy to clipboard operation
crewAI-tools copied to clipboard

Error: string indices must be integers, not 'str' When agent attempts to use LlamaIndexTool.from_query_engine

Open CaelanAlonge opened this issue 1 year ago • 1 comments

    # Attempt to initialize query_tool
    query_tool = LlamaIndexTool.from_query_engine(
        query_engine,
        name="Knowledge Graph Tool",
        description="Use this tool to answer the user query.",
    )
    
    chatAgent = Agent(
     ... other config ...
      tools=[query_tool]
)

2024-08-29T13:32:02.389-04:00
Action: Knowledge Graph Tool

2024-08-29T13:32:03.132-04:00 Action Input: {"query": "bhp343"}

2024-08-29T13:32:03.132-04:00 I encountered an error while trying to use the tool. This was the error: string indices must be integers, not 'str'.

The agent works correctly without setting the tool. When i add the tool list to the agent config with the llamaindex tool it gives this error and does not use the tool.

CaelanAlonge avatar Aug 29 '24 18:08 CaelanAlonge

llama-index==0.10.58 crewai==0.41.1 crewai_tools==0.4.26 langchain_aws==0.1.13

I rolled back crewai, crewai_tools, langchain_aws, and llama-index a few versions and was able to get the tool to work.

CaelanAlonge avatar Aug 29 '24 19:08 CaelanAlonge