Issue with Base URL and API Version when using AzureOpenAI #862

When using Azure OpenAI through Private Org BaseURL, the following error occurs

ValueError: Error during query: [{'locations': [{'column': 6, 'line': 1}], 'message': 'explorer: get class: vectorize params: vectorize params: vectorize params: vectorize keywords: remote client vectorize: send POST request: Post "https://azure-llm.openai.azure.com/openai/deployments/text-embedding-ada-002/embeddings?api-version=2022-12-01": read tcp 100.64.95.5:59158->20.232.91.180:443: read: connection reset by peer', 'path': ['Get', 'OAAIndexOpenAITest']}]

The program is sending request to https://azure-llm.openai.azure.com/openai/deployments/text-embedding-ada-002/embeddings?api-version=2022-12-01 even after specifying the X-OpenAI-BaseURL". Instead of routing to https://<baseURL>/openai/deployments/<deploymentID>/chat/completions?api-version=<api-version>

This is occurring when retrieving the indexed documents from Weaviate.

import weaviate

auth_client_secret = weaviate.AuthApiKey(Config.WEAVIATE_READER_APIKEY)
additional_headers = {"X-Azure-Api-Key": Config.OPENAI_API_KEY,
                                      "X-OpenAI-BaseURL":Config.OPENAI_API_BASE,
                                      "X-OpenAI-Organization":Config.OPENAI_ORGANIZATION}
wv_conn = weaviate.Client(url=os.environ["WEAVIATE_URL"],
                                             auth_client_secret=auth_client_secret,
                                             additional_headers=additional_headers)

The index is created using create_class

vectorizer = "text2vec-openai"
module_config = {vectorizer: {"resourceName": Config.OPENAI_RESOURCE_NAME,
                                                    "baseURL" : Config.OPENAI_API_BASE,
                                                    "deploymentId": Constants.OPENAI_DEPLOYMENT}}
wv_conn.schema.create_class({"class": "temp_class",
                                                      "vectorizer": vectorizer ,
                                                       "moduleConfig": module_config})

These updates are made in weaviate repo, see below PRs. Aren’t these supposed to be reflected here too?

Version: 4.4.2
Summary: A python native Weaviate client
Home-page: https://github.com/weaviate/weaviate-python-client
Author: Weaviate
Author-email: hello@weaviate.io,
License: BSD 3-clause
Location: /Users/vedala/Documents/projects/OA/oa-answers/oaa/lib/python3.9/site-packages
Requires: authlib, grpcio, grpcio-health-checking, grpcio-tools, httpx, pydantic, requests, validators```

Hi @pi_crust !

What is the server and client version?

Can you reproduce this on latest version of both Weaviate and the python client (4.X?)

Thanks!