Azure / azure-search-vector-samples

A repository of code samples for Vector search capabilities in Azure AI Search.
https://azure.microsoft.com/products/search
MIT License
690 stars 285 forks source link

HttpResponseError while creating indexer #239

Open smaddinieni opened 1 month ago

smaddinieni commented 1 month ago

HttpResponseError: () Error with data source: Unexpected character encountered while parsing value: �. Path '', line 0, position 0. Please adjust your data source definition in order to proceed. Code: Message: Error with data source: Unexpected character encountered while parsing value: �. Path '', line 0, position 0. Please adjust your data source definition in order to proceed.

smaddinieni commented 1 month ago

I was able to create the data source, skillset and index.

mattgotteiner commented 1 month ago

Sorry - it's hard to reproduce this issue without any code or HTTP request shared

smaddinieni commented 1 month ago

Im trying demo-python/code/e2e-demos/azure-ai-search-multimodal-build-demo.ipynb

this is the code I'm trying to execute to create image indexer

def create_and_run_indexer( indexer_client, indexer_name, skillset_name, index_name, data_source_name ): indexer = SearchIndexer( name=indexer_name, description="Indexer to index documents and generate embeddings", skillset_name=skillset_name, target_index_name=index_name, data_source_name=data_source_name, parameters=IndexingParameters( configuration=IndexingParametersConfiguration( parsing_mode=BlobIndexerParsingMode.JSON_ARRAY, query_timeout=None, ), ), field_mappings=[FieldMapping(source_field_name="id", target_field_name="id")], output_field_mappings=[ FieldMapping( source_field_name="/document/captionVector", target_field_name="captionVector", ), FieldMapping( source_field_name="/document/imageVector", target_field_name="imageVector", ), ], )

indexer_client.create_or_update_indexer(indexer)
print(f"{indexer_name} created or updated.")

indexer_client.run_indexer(indexer_name)
print(
    f"{indexer_name} is running. If queries return no results, please wait a bit and try again."
)

indexer_client = SearchIndexerClient( endpoint=SEARCH_SERVICE_ENDPOINT, credential=azure_search_credential ) data_source_name = f"{INDEX_NAME}-blob" indexer_name = f"{INDEX_NAME}-indexer"

create_and_run_indexer(indexer_client, indexer_name, skillset_name, INDEX_NAME, data_source_name)

smaddinieni commented 1 month ago

INFO:azure.core.pipeline.policies.http_logging_policy:Request URL: 'https://cognitivesearch-openai-semantic.search.windows.net/indexers('build-multimodal-demo-indexer')?api-version=REDACTED' Request method: 'PUT' Request headers: 'Content-Type': 'application/json' 'Content-Length': '1050' 'api-key': 'REDACTED' 'Prefer': 'REDACTED' 'Accept': 'application/json;odata.metadata=minimal' 'x-ms-client-request-id': 'd9a2bc71-1db0-11ef-840f-145afc07673a' 'User-Agent': 'azsdk-python-search-documents/11.6.0b4 Python/3.11.7 (Windows-10-10.0.19045-SP0)' A body is sent with the request DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): cognitivesearch-openai-semantic.search.windows.net:443 DEBUG:urllib3.connectionpool:https://cognitivesearch-openai-semantic.search.windows.net:443 "PUT /indexers('build-multimodal-demo-indexer')?api-version=2024-05-01-preview HTTP/1.1" 400 209 INFO:azure.core.pipeline.policies.http_logging_policy:Response status: 400 Response headers: 'Cache-Control': 'no-cache,no-store' 'Pragma': 'no-cache' 'Content-Length': '209' 'Content-Type': 'application/json; charset=utf-8' 'Content-Language': 'REDACTED' 'Expires': '-1' 'Server': 'Microsoft-IIS/10.0' 'request-id': 'd9a2bc71-1db0-11ef-840f-145afc07673a' 'elapsed-time': 'REDACTED' 'Strict-Transport-Security': 'REDACTED' 'Date': 'Wed, 29 May 2024 11:44:48 GMT'

mattgotteiner commented 1 month ago

Can you try this notebook and see if it works?

https://github.com/Azure/azure-search-vector-samples/blob/main/demo-python/code/embeddings/multimodal-embeddings/multimodal-embeddings.ipynb

You'll need azd as it also sets up a sample service and AI services with an indexer for you