Skip to content

Local Language Models from Ollama not recognizing tools in crewai #674

@nishkaloc

Description

@nishkaloc

I get the below error
Crewai when using ollama isn't recognizing how to use the tools defined.

> Entering new CrewAgentExecutor chain...
Thought: I now can give a great answer
Action: Internet Search Tool(user_query) - Scrapes the weblinks for the query based on user input.
Action Input: {"query": "who is Virat Kohlis son?"}

Action 'Internet Search Tool(user_query) - Scrapes the weblinks for the query based on user input.' don't exist, these are the only available Actions:
 Internet Search Tool: Internet Search Tool(user_query) - Scrapes the weblinks for the query based on user input.
Returns:
List[str]: A list containing information about the query.

It seems when I am giving the local llm from ollama I face this issue, once I replace it with openai everything works perfectly.
Any suggestion on how to fix it?
I define the local llm as follows

from langchain_community.llms import Ollama

os.environ["OPENAI_API_KEY"]="NA"

llm = ChatOpenAI(
        model="phi3",
        base_url="http://localhost:11434/v1"
    )

I am trying this and been stuck at it since long time.
Please help me fix it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions