crewAIInc / crewAI

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
https://crewai.com
MIT License
19k stars 2.62k forks source link

tools custom config not working asking for open ai key even while using huggingface #1032

Open testcolab1 opened 1 month ago

testcolab1 commented 1 month ago

from langchain_huggingface import HuggingFaceEndpoint from crewai_tools import WebsiteSearchTool

Webtool = WebsiteSearchTool( config=dict( llm=dict( provider="huggingface", # or google, openai, anthropic, llama2, ... config=dict( model="mistralai/Mistral-7B-Instruct-v0.3",

temperature=0.5,

            # top_p=1,
            # stream=true,
        ),
    ),
    embedder=dict(
        provider="huggingface", # or openai, ollama, ...
        config=dict(
            model="mixedbread-ai/mxbai-embed-large-v1",
            #task_type="retrieval_document",
            # title="Embeddings",
        ),
    ),
)

) Webtool=WebsiteSearchTool(website="https://cloud.google.com/bigquery/docs/migration/netezza-sql")

i am using the above code to config the websitesearchtool but while executing the webtool i get the following error

/usr/lib/python3.10/os.py in getitem(self, key) 678 except KeyError: 679 # raise KeyError with the original key value --> 680 raise KeyError(key) from None 681 return self.decodevalue(value) 682

KeyError: 'OPENAI_API_KEY'

theCyberTech commented 1 month ago

Where have you configured your hugging face API key?

chandan-vk6 commented 1 month ago

Same error here,

Tools

pdf_tool = PDFSearchTool( config=dict( llm=dict( provider="openai", config=dict( model=os.getenv("OPENAI_MODEL_NAME"), ), ), embedder=dict( provider="google", config=dict( model="models/embedding-001", task_type="retrieval_document", ), ), ) )

OPENAI_API_KEY=" groq api key" OPENAI_MODEL_NAME=''llama3-groq-70b-8192-tool-use-preview'' OPENAI_API_BASE="https://api.groq.com/openai/v1" GOOGLE_API_KEY=" google api key"

ERROR:

NotFoundError: Error code: 404 - {'error': {'message': 'The model text-embedding-ada-002 does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'code': 'model_not_found'}}

even i tried Agents with groq,

llm = ChatGroq(model="llama3-groq-70b-8192-tool-use-preview",api_key="api_key") summarizer = Agent( role='Information Summarizer', goal='Summarize the searched information from resume.', verbose=True, memory=True, backstory="You excel at condensing large amounts of information into concise, informative summaries.", allow_delegation=False,

step_callback=step_callback,

llm=llm

)

ERROR:

openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: fake. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}

chandan-vk6 commented 1 month ago

Got the solution or i should i call it Bug!!

I am using groq through openai.

OPENAI_API_KEY=" groq api key" OPENAI_MODEL_NAME=''llama3-groq-70b-8192-tool-use-preview'' OPENAI_API_BASE="https://api.groq.com/openai/v1"

when you set " memory" = True in while setting Crew we get below error NotFoundError: Error code: 404 - {'error': {'message': 'The model text-embedding-ada-002 does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'code': 'model_not_found'}}

crew = Crew( agents=self.agents, tasks=self.agents, process=Process.sequential, verbose=2, memory=False # set this to False if we need memory then we need set in each individual agent i think )