Generative-Azure-OpenAI module Error

Hi Weaviate Team,

I am trying to use the generative search functionality using the Python v4 Client library using Azure OpenAI.

Although I was able to use the vectorizer module successfully with these same base url, resource name and api key, I am unable to use the generative-openai module.

I see a different error depending on whether I try to use “single_prompt” or “grouped_task”.
Are you able to see something wrong in the configuration? Is there a way to see the url it is trying to use to connect?

Connecting to the client:

client = \
        weaviate.connect_to_custom(
            http_host=client_host_url,
            http_port=80,
            http_secure=False,
            grpc_host=grpc_host_url,
            grpc_port=50051,
            grpc_secure=False,
            auth_credentials=weaviate.auth.APIKey(weaviate_api_key),
            headers={
                   #Azure API key specified in values.yaml
            },
        )

Creating Collection:

incidents = client.collections.create(
            name="Incident",
            description="Incident Tickets",
            vectorizer_config=wvc.Configure.Vectorizer.text2vec_azure_openai(
                base_url=azure_base_url,
                resource_name=azure_resource_name,
                deployment_id="text-embedding-ada-002",
                vectorize_collection_name=True

            ),
            generative_config=wvc.Configure.Generative.azure_openai(
                base_url=azure_base_url,
                resource_name=azure_resource_name,
                deployment_id="gpt-35-turbo",
                frequency_penalty=None,
                presence_penalty=None,
                temperature=0.2,
                top_p=0.4
            ),

Using generative search:

response = incident.generate.bm25(
    query="Duplicate",
    limit=3,
    return_properties=['number', 'priority', 'Resolution_Code', 'Resolution_Notes'],
    grouped_task="What do these tickets have in common?",
    # single_prompt="Translate the following into French: {resolution_code}"
)

Grouped Task Error Message:

Traceback (most recent call last):
  File "/home/ec2-user/.local/lib/python3.9/site-packages/weaviate/collections/grpc/query.py", line 453, in __call
    res, _ = self._connection.grpc_stub.Search.with_call(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/grpc/_channel.py", line 1177, in with_call
    return _end_unary_response_blocking(state, call, True, None)
  File "/home/ec2-user/.local/lib/python3.9/site-packages/grpc/_channel.py", line 1003, in _end_unary_response_blocking
    raise _InactiveRpcError(state)  # pytype: disable=not-instantiable
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNKNOWN
        details = "connection to: Azure OpenAI API failed with status: 401 error: Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."
        debug_error_string = "UNKNOWN:Error received from peer  {created_time:"2024-01-19T17:07:09.126780607+00:00", grpc_status:2, grpc_message:"connection to: Azure OpenAI API failed with status: 401 error: Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."}"
>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ec2-user/environment/Orestis-incident-tickets/get.py", line 51, in <module>
    response = incident.generate.bm25(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/weaviate/collections/queries/bm25/generate.py", line 82, in bm25
    res = self._query().bm25(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/weaviate/collections/grpc/query.py", line 230, in bm25
    return self.__call()
  File "/home/ec2-user/.local/lib/python3.9/site-packages/weaviate/collections/grpc/query.py", line 564, in __call
    raise WeaviateQueryError(e.details(), "GRPC search")
weaviate.exceptions.WeaviateQueryError: Query call with protocol GRPC search failed with message connection to: Azure OpenAI API failed with status: 401 error: Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource..

Single Prompt Error Message:

Traceback (most recent call last):
  File "/home/ec2-user/.local/lib/python3.9/site-packages/weaviate/collections/grpc/query.py", line 453, in __call
    res, _ = self._connection.grpc_stub.Search.with_call(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/grpc/_channel.py", line 1177, in with_call
    return _end_unary_response_blocking(state, call, True, None)
  File "/home/ec2-user/.local/lib/python3.9/site-packages/grpc/_channel.py", line 1003, in _end_unary_response_blocking
    raise _InactiveRpcError(state)  # pytype: disable=not-instantiable
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNKNOWN
        details = "No results for generative search despite a search request. Is a generative module enabled?"
        debug_error_string = "UNKNOWN:Error received from peer  {created_time:"2024-01-19T17:05:27.387118548+00:00", grpc_status:2, grpc_message:"No results for generative search despite a search request. Is a generative module enabled?"}"
>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ec2-user/environment/Orestis-incident-tickets/get.py", line 51, in <module>
    response = incident.generate.bm25(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/weaviate/collections/queries/bm25/generate.py", line 82, in bm25
    res = self._query().bm25(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/weaviate/collections/grpc/query.py", line 230, in bm25
    return self.__call()
  File "/home/ec2-user/.local/lib/python3.9/site-packages/weaviate/collections/grpc/query.py", line 564, in __call
    raise WeaviateQueryError(e.details(), "GRPC search")
weaviate.exceptions.WeaviateQueryError: Query call with protocol GRPC search failed with message No results for generative search despite a search request. Is a generative module enabled?.

Any input would be appreciated, thank you!

Hi! Sorry for the delay here.

This seems to be an issue with your module configuration:

Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.

Hey @DudaNogueira The same variables are used for text2vec-openai and that module works without an issue.

Is there a way to verify the URL that generative-openai is using?