phidatahq / phidata

Build AI Agents with memory, knowledge, tools and reasoning. Chat with them using a beautiful Agent UI.
https://docs.phidata.com
Mozilla Public License 2.0
15.34k stars 2.12k forks source link

Example with knowledge ollama requests OpenAI key? #1459

Open trfetzer opened 2 hours ago

trfetzer commented 2 hours ago

I am running this example line-for-line:

cookbook/providers/ollama_tools/knowledge.py

but it throws an error:

ERROR Error processing document 'ThaiRecipes': The api_key client option must be set either by passing api_key
to the client or by setting the OPENAI_API_KEY environment variable

Or is there an intermediate step that is e.g. creating embeddings via OpenAI that is not explicitly mentioned in this example?

trfetzer commented 2 hours ago

Just to be clear it seems to be accessing stuff:

INFO Creating collection
INFO Loading knowledge base
INFO Reading: https://phi-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf
ERROR Error processing document 'ThaiRecipes': The api_key client option must be set either by passing api_key
to the client or by setting the OPENAI_API_KEY environment variable

MANISH007700 commented 2 hours ago

In order to run any Proprietary LLM, you need to access the model. To access the model, the only way is to use the API key from the respective org which you are using [in this case it's OpenAI].

Go to https://platform.openai.com/settings/organization/api-keys and create a new API key.

Set the OPENAI_API_KEY with your API key and re-execute the code. It should work fine then.

Thank you

cc @ashpreetbedi