Find answers from the community

Updated last year

Is it possible to implement agents, GenerativeAgent without OPENAI Key?

@kapa.ai Is it possible to implement agents, GenerativeAgent without OPENAI Key?
k
2 comments
Please stand by @Matthews as I search the knowledge base. I normally take about 20 seconds or so. :wave:
----------------------
Based on the information provided in the extracts, it appears that an OpenAI API key is required to use the OpenAIAgent implementation in LlamaIndex. The OpenAI API key is used to authenticate requests to OpenAI's API, which is necessary for the agent to function.

Here is an example of how to provide the OpenAI API key:

Plain Text
import openai

OPENAI_API_KEY = getpass.getpass("OpenAI API Key:")
openai.api_key = OPENAI_API_KEY

(Source: GitHub ())

You can also set the API key at a per-instance level:

Plain Text
from llama_index.llms import OpenAI

llm = OpenAI(model="text-davinci-003", api_key="BAD_KEY")
resp = OpenAI().complete("Paul Graham is ")
print(resp)

(Source: GitHub ())

Without the OpenAI API key, the agent would not be able to make requests to OpenAI's API and therefore would not function as expected.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord