fix to pass api key to openai embedding (#754)

This commit is contained in:
Vincent 2024-04-05 13:28:10 -04:00 committed by GitHub
parent a202b2550f
commit da12d70bc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,7 +21,8 @@ if embedding_strategy == "llama2":
elif embedding_strategy == "openai":
from llama_index.embeddings.openai import OpenAIEmbedding
embed_model = OpenAIEmbedding(
model="text-embedding-ada-002"
model="text-embedding-ada-002",
api_key=config.get_or_error("LLM_API_KEY")
)
elif embedding_strategy == "azureopenai":
from llama_index.embeddings.azure_openai import AzureOpenAIEmbedding # Need to instruct to set these env variables in documentation