Error code: 400 Validation error at #/dataSources/0: Unable to extract tag using discriminator 'type' on Azure OpenAI

BAHADIR ARAZ 15 Reputation points
2024-01-24T17:19:06.19+00:00

A few hours ago, my Azure OpenAI + Azure Cognitive Search API was working without any issues, but now, despite not making any changes to the code, it is giving this error.User's image

cognitive_client = AsyncAzureOpenAI(
    base_url=os.environ.get("AZURE_COGNITIVE_BASE_URL"),
    api_key=os.environ.get("AZURE_COGNITIVE_API_KEY"),
    api_version=os.environ.get("AZURE_COGNITIVE_API_VERSION"),
)
Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
1,185 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,664 questions
{count} votes

1 answer

Sort by: Most helpful
  1. navba-MSFT 27,465 Reputation points Microsoft Employee
    2024-01-25T06:14:28.5333333+00:00

    @BAHADIR ARAZ Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    Your line "typegit log": "AzureCognitiveSearch" is incorrect. It should be "type": "AzureCognitiveSearch"

    .
    Please see the sample code below:

    dataSources=[  # camelCase is intentional, as this is the format the API expects
            {
                "type": "AzureCognitiveSearch",
                "parameters": {
                    "endpoint": os.environ.get("SearchEndpoint"),
                    "key": os.environ.get("SearchKey"),
                    "indexName": os.environ.get("SearchIndex"),
                }
            }
    

    More info here. Hope this helps.

    ** Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.