Tuesday, January 2, 2024

Azure AI Search: Semantic search is not enabled for this service.

You may encounter the following exception while testing Semantic Ranking with the Azure AI service. I was exploring the 'Quickstart: Semantic Ranking' guide on Azure AI Search, available on Microsoft Learn, using the Python library. The exception occurred during the execution of the following code snippet:

results =  search_client.search
(query_type='semantic', semantic_configuration_name='my-semantic-config',
    search_text="what hotel has a good restaurant on site",
    select='HotelName,Description,Category', query_caption='extractive')

for result in results:
    print(result["@search.reranker_score"])
    print(result["HotelName"])
    print(f"Description: {result['Description']}")

    captions = result["@search.captions"]
    if captions:
        caption = captions[0]
        if caption.highlights:
            print(f"Caption: {caption.highlights}\n")
        else:
            print(f"Caption: {caption.text}\n")

The exception encountered is likely due to the Semantic Ranking feature not being enabled for the Azure AI Search Service. To resolve this issue, ensure that Semantic Ranking is activated for the AI Search Service instance you are using for semantic searches. It's important to note that the Semantic Ranking feature is not available for the free tier of Azure AI Search.


Ensure that your Azure AI Search Service is set up with a pricing tier of Basic or higher.



Now, with the appropriate pricing tier selected, you should be able to enable the Smart Ranking plan, allowing your code to execute without any issues.




No comments:

Post a Comment