Replies: 1 comment 10 replies
-
To fix the "OpenAIError: The api_key client option must be set" error when using the OpenAI Assistant Agent with Azure OpenAI, you need to ensure your API key is correctly set. This can be done in two ways:
import os
os.environ["OPENAI_API_KEY"] = "<your-api-key>"
os.environ["AZURE_OPENAI_ENDPOINT"] = "https://<your-resource-name>.openai.azure.com/"
os.environ["OPENAI_API_VERSION"] = "2023-07-01-preview" Replace
llm = AzureOpenAI(
engine="my-custom-llm",
model="gpt-35-turbo-16k",
temperature=0.0,
azure_endpoint="https://<your-resource-name>.openai.azure.com/",
api_key="<your-api-key>",
api_version="2023-07-01-preview",
) Make sure to replace For more detailed guidance, you can refer to the LlamaIndex documentation.
|
Beta Was this translation helpful? Give feedback.
-
I am using gpt-4 AzureOpenAI and like to use OpenAIAssistantAgent provided in the example: https://docs.llamaindex.ai/en/stable/examples/agent/openai_assistant_query_cookbook/
However I am getting error "OpenAIError: 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"
Please advise.
Beta Was this translation helpful? Give feedback.
All reactions