Appkey Configuration - Azure OpenAI

Error while connecting to Azure OpenAI:

WeaviateInsertManyAllFailedError: Every object failed during insertion. Here is the set of all errors: connection to: Azure OpenAI API failed with status: 400 error: please send a valid json string with appkey as {“appkey” : “value”} in ‘user’ parameter in request, reach out if you need an appkey
connection to: Azure OpenAI API failed with status: 429

We procured weaviate instance for our organization. And also we have procured Azure OpenAI License. Azure OpenAI connection will reuqired client id, client secret and an appkey.

From client id and client secret we can generate api key/ access token which i have configured in the additional headers

Headers:
‘X-Azure-Api-Key’: azure_openai_key,
‘X-Openai-Api-Key’ : azure_openai_key,

Vectors Config
from weaviate import classes as wvc

samples = client.collections.create(
name=“Samples”,
vectorizer_config=wvc.config.Configure.Vectorizer.text2vec_azure_openai(
resource_name=“XXX”,
deployment_id=“text-embedding-3-large”,
base_url=“https://chat-ai..com”
)
)

I need to pass additional parameters called “appkey”. Not able to find it in any documentation. Can somebody please help

hi @Rahul_Subramani !!

Welcome to our community!

Please, what is the version of client and server you are running?
Does it happen also on latest?

This message is coming directly from Azure/OpenAI. Have you set those accordingly?

Check here for more information on tet2vec-openai with azure:

Thanks!

Python Client V4
Version: 1.25.7

We can able to connect directly using the OpenAI module. Here’s the connection function. But inside weaviate we are not sure on the configuration

import os
from openai import AzureOpenAI

client = AzureOpenAI(
azure_endpoint = ‘https://..com’,
api_key=token_response.json()[“access_token”],
api_version=“2023-08-01-preview”
)

response = client.chat.completions.create(
model=“gpt-35-turbo”,
messages=messages,
user=f’{{“appkey”: “{app_key}”}}',
functions=functions,
function_call=“auto”
)

Hi!

can you check you are using the latest python client?

import weaviate
print(weaviate.__version__)