Hi all,
I am trying to use Weaviate with Azure Open AI. I am aware that one needs to pass a different header when making a request like “X-Azure-Api-Key”" but I constantly get the error.
Either
API Key: no api key found
When I only pass the azure key like here:
client = weaviate.Client(
url=weaviate_url,
auth_client_secret=weaviate.auth.AuthApiKey(api_key=weaviate_secret_key),
additional_headers={
“X-Azure-Api-Key”: azure_openai_key,
},
)
or this error:
Incorrect API key provided
When I use this (as this was suggested somewhere:
client = weaviate.Client(
url=weaviate_url,
auth_client_secret=weaviate.auth.AuthApiKey(api_key=weaviate_secret_key),
additional_headers={
“X-Azure-Api-Key”: azure_openai_key,
“X-Openai-Api-Key”: azure_openai_key,
},
)
I tried so many variations (providing it in the docker compose file or not, having it in an .env file or in clear text) but I do not know how to resolve it;
This is my current set up
openai.api_type = “azure”
openai.api_version = “2023-07-01-preview”
openai.api_base = os.getenv(‘AZURE_API_ENDPOINT’)
openai.api_key = os.getenv(“AZURE_APIKEY”)
azure_openai_key = openai.api_key
client = weaviate.Client(
url=weaviate_url,
auth_client_secret=weaviate.auth.AuthApiKey(api_key=weaviate_secret_key),
additional_headers={
“X-Azure-Api-Key”: azure_openai_key,
“X-Openai-Api-Key”: azure_openai_key,
},
)
and in my schema I also define this:
"class": "ClassName",
"description": "A class description",
"vectorizer": "text2vec-openai",
"moduleConfig": {
"text2vec-openai": {
"model": "ada",
"resourceName": "XXX",
"deploymentId": "text-embedding-ada-002",
}
},
I would highly appreciate any help as I really do not know how to solve this
Many thanks!