azure.search.documents.indexes.models.AIServicesVisionVectorizer used in AI Search throws "Could not complete vectorization action. The vectorization endpoint returned status code '400' (BadRequest)"

Bogdan 0 Reputation points
2025-02-18T17:42:46.9266667+00:00

Hi!
I'm facing an issue with using AIServicesVisionVectorizer vectorizer when doing either a text or image vector query search against the AI Search index.
I used azure-python-sdk library azure-search-documents 11.6.0b9 version.

This is the sample code used to create the index:

azure_vision_endpoint = os.getenv("AZURE_VISION_ENDPOINT")
azure_vision_key = os.getenv("AZURE_VISION_KEY")
...
AIServicesVisionVectorizer(
            vectorizer_name="myImageVectorizer",
            kind="aiServicesVision",
            ai_services_vision_parameters=AIServicesVisionParameters(
                model_version="latest",
                resource_uri=azure_vision_endpoint,
                api_key=azure_vision_key
            )
        )

Generated index JSON definition:

"vectorizers": [
	...,
	{
        "name": "myImageVectorizer",
        "kind": "aiServicesVision",
        "aiServicesVisionParameters": {
          "modelVersion": "latest",
          "apiKey": "<redacted>",
          "resourceUri": "https://not-the-real-used-uri.cognitiveservices.azure.com"
        }
	}
]

Related documentation: https://learn.microsoft.com/en-us/azure/search/vector-search-vectorizer-ai-services-vision

The search client returns:

Response status: '502'
Response headers:
	'Cache-Control': 'no-cache,no-store'
	
	
	
	
	
	
	
	
	
	
Response content:
{"error":{"code":"","message":"Could not complete vectorization action. The vectorization endpoint returned status code '400' (BadRequest)."}}

I tried different variations for the apiKey, modelVersion, resourceURI with no success, both from python code or directly editing the index's JSON definition.
Same error is received directly from the Portal, from the Search explorer.

Using the same apiKey, modelVersion, resourceURI I managed to obtain the vectors/embeddings with a direct HTTP POST call:

Also, I managed to obtain an image analysis using the same apiKey, modelVersion, resourceURI with the help of: https://learn.microsoft.com/en-us/python/api/overview/azure/ai-vision-imageanalysis-readme?view=azure-python-preview

I also followed these samples for this test:

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,195 questions
Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
402 questions
0 comments No comments
{count} votes

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.