Hi all,
using Azure with Weaviate required defining the “moduleConfig” in the schema.
"vectorizer": "text2vec-openai",
"moduleConfig": {
"text2vec-openai": {
"baseURL": "https://COMPANYINSTANCE.openai.azure.com/",
"resourceName": "COMPANYINSTANCE",
"deploymentId": "text-embedding-ada-002",
},
},
I would like to use the new Weaviate client V4. However, I cannot find any way to specify it with Azure e.g., when inserting data into a collection. Is that not possible yet? Or is there a way to similarly provide the ModuleConfig somewhere so that one can pass the baseURL and the deploymentId, which are needed to use the Azure instance?
I tried this:
azure_openai_key = os.getenv("AZURE_APIKEY")
weaviate_client = weaviate.WeaviateClient(
connection_params=weaviate.ConnectionParams.from_params(
http_host="0.0.0.0",
http_port="8080",
http_secure=False,
grpc_host="0.0.0.0",
grpc_port="50051",
grpc_secure=False,
),
auth_client_secret=weaviate.AuthApiKey(weaviate_secret_key),
additional_headers={
"X-Azure-Api-Key": azure_openai_key
},
)
parameters = {
"collection_name": "Test_Collection",
"vectorizer_config": wvc.Configure.Vectorizer.text2vec_openai(
base_url="https://COMPANYINSTANCE.openai.azure.com/", model="ada"
),
"properties": [
wvc.Property(name="property1", data_type=wvc.DataType.TEXT),
wvc.Property(name="property2", data_type=wvc.DataType.TEXT)
],
}
inserter = Inserter(weaviate_client, "weaviate", parameters)
data_to_insert = {"property1": "value1", "property2": "value2"}
inserter.insert_data(data_to_insert)
However, I get this error:
[{'message': 'update vector: API Key: no api key found neither in request header: X-Openai-Api-Key nor in environment variable under OPENAI_APIKEY'}]
The problem also happened before when using V3 and not providing the baseURL (see above config), so providing it is essential. But I have not found any documentation for v4 and Azure and I was wondering whether it is currently just not possible? We would also need to define the deploymentId and within the IDE it does not suggest me any parameter like this.
Many thanks in advance!