Description
Hi. I want to get a minimal working example of a collection in WCS that relies on Azure-OpenAI rather than core OpenAI, and is queryable using the coll.query.near_text('my query')
method, using the Weaviate client library V4 for Python 3. I’ve tried various configurations but am failing with various errors, most recently.
Query call with protocol GRPC search failed with message explorer: get class: vectorize params: vectorize params: vectorize params: vectorize keywords: remote client vectorize: connection to: Azure OpenAI API failed with status: 404 error: The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again..
This is my workflow:
client = wv.connect_to_wcs(
cluster_url = os.getenv('WEAVIATE_SANDBOX_URL'),
auth_credentials=wv.auth.AuthApiKey(api_key=os.getenv('WEAVIATE_SANDBOX_API_KEY')),
headers = {
"X-Azure-Api-Key": os.getenv('AZURE_OPENAI_API_KEY'),
"X-OpenAI-BaseURL": os.getenv('AZURE_OPENAI_API_BASE'),
},
)
VECTORIZER_CONFIG = wc.Configure.Vectorizer.text2vec_azure_openai(
resource_name="text-embedding-ada-002",
deployment_id=os.getenv('AZURE_OPENAI_EMBEDDINGS'),
base_url=os.getenv('AZURE_OPENAI_API_BASE'),
)
GENERATIVE_CONFIG = wc.Configure.Generative.azure_openai(
resource_name="gpt-4",
deployment_id=os.getenv('AZURE_OPENAI_GENERATIVE_DEPLOYMENT'),
base_url=os.getenv('AZURE_OPENAI_API_BASE'),
top_p=0.95,
max_tokens=800
)
I then have some basic code to stream in data from a pandas dataframe into a weaviate collection, which translates pandas data types to weaviate data types, and uses the above constants as the vectorizer and generative config for our new collection.
with coll.batch.fixed_size(
batch_size=self.weaviate_batch_size
) as batch:
for i, row in df.iterrows():
batch.add_object(
properties=row.to_dict(),
uuid=generate_uuid5(row.index)
)
My theory is that I’ve wrongly defined the API key, deployment or model names somewhere, but it’s not clear to me where I’d find them. I’ve followed the instructions from this post, but that didn’t work. Then I ended up at my current configuration.
Server Setup Information
- Weaviate Server Version: 1.24.13
- Deployment Method: WCS
- Multi Node? Number of Running Nodes: 1 – just a sandbox cluster to figure out how to build this
- Client Language and Version: Python 3.11.3, Weaviate 4.6.1
Any additional Information
This is a screenshot of my Azure deployments. The names match my environment variables.