Priyanshu Khare
Priyanshu Khare

Reputation: 115

CREW AI tool not using ChatGroq

Here is my tools.py file

import os 
from dotenv import load_dotenv
from langchain_groq import ChatGroq
from crewai_tools import PDFSearchTool, SerperDevTool

load_dotenv()

# Initialize the ChatGroq model
llm = ChatGroq(
    model="llama-3.1-70b-versatile",
    temperature=0.7,
    groq_api_key=os.getenv('GROQ_API_KEY'),
    verbose=True
)


os.environ['SERPER_API_KEY'] = os.getenv('SERPER_API_KEY')

# Initialize the tool allowing for any PDF content search if the path is provided during execution
pdf_tool = PDFSearchTool()

# Initialize the tool for internet searching capabilities
serper_tool = SerperDevTool()

also I have added

llm = ChatGroq(
    model="llama-3.1-70b-versatile",
    temperature=0.7,
    groq_api_key=os.getenv('GROQ_API_KEY'),
    verbose=True
)

in my agents.py also and mentioned in every Agent.

But when I run

python crew.py

the error comes:

UserWarning: Valid config keys have changed in V2:

Please help me

I know about the document from crewai that I should try this way

tool = PDFSearchTool(
    config=dict(
        llm=dict(
            provider="ollama", # or google, openai, anthropic, llama2, ...
            config=dict(
                model="llama2",
                # temperature=0.5,
                # top_p=1,
                # stream=true,
            ),
        ),
        embedder=dict(
            provider="google", # or openai, ollama, ...
            config=dict(
                model="models/embedding-001",
                task_type="retrieval_document",
                # title="Embeddings",
            ),
        ),
    )
)

But how to use ChatGroq with it.

Upvotes: -3

Views: 431

Answers (1)

Guilherme Garcia
Guilherme Garcia

Reputation: 115

You only need to follow these steps; CrewAI natively supports Groq:

Set up Groq API key: Define the environment variable GROQ_API_KEY with your API key.

os.environ["GROQ_API_KEY"] = os.environ.get('GROQ_API_KEY')

Specify Groq model: In your CrewAI agent, use llm='groq/model' to select the model, example: Llama3.

Agent(
            config=self.agents_config['agent_example'],
            verbose=True,
            memory=True,
            llm='groq/llama3-70b-8192'
    )

Upvotes: 0

Related Questions