Weaviate python client setup with Azure OpenAI keys

Hi community,

I just want to know how can I pass Azure OpenAI key variables in weaviate client for python.

client = weaviate.Client(
    auth_client_secret=auth_config,  # Only necessary if authentication enabled
        "X-OpenAI-Api-Key": "YOUR-OPENAI-API-KEY",            # Replace with your OpenAI key

Instead of using OpenAI api key, we have azure openai key. Any help would be good.

1 Like

Hi! Welcome to our Community :hugs:

Looking into Weaviate code, I found this reference:

And at docs this one:

I have never used OpenAI on Azure, but X-Azure-Api-Key should work, AFAIK.

Let me know if that helps :slight_smile:

Hi @shkamboj

Configuring Azure OpenAI for text2vec-openai requires different parameters.

For example, "X-Azure-Api-Key": "YOUR-AZURE-API-KEY" is used to set the Azure OpenAI key. Please take a look at this page for this and other configurations, like resourceName or deploymentId for example.

1 Like

Thanks @jphwang @DudaNogueira

1 Like

Hi @c-lara - sorry for the late response!

Do you have a code snippet that we can take a look at? Given the nature of Azure openai it may be slightly difficult for us to test internally, but we can see if there are anything we can pick up in the code.

Is there a way to confirm that the key & the Azure setup is working, outside of Weaviate? For example, through a REST call or something like that?

Thank you @jphwang for giving this information, this would be helpful for me! Thank you again!