Azure/azure-sdk-for-python

Vector search returning empty response only on MacOS

somebodyawesome-dev opened this issue · 2 comments

  • Package Name: azure-search-documents
  • Package Version: 11.4.0
  • Operating System: Mac OS Monterey, 12.7.4 (21H1123)
  • Python Version: python 3.11.6

Describe the bug
Azure Search Documents Python package keep failing to return expected results on macOS when performing vector searches using Cognitive Search Service. The request log show the receive of an empty response, however executing the same request with the exact same arguments on a Windows machine or an Ubuntu VPS request returns results.

To Reproduce
Steps to reproduce the behavior:
we have script similar to these lines

    query_embedding = create_embedding(query) # simple api call to Openai

    vector_query = VectorizedQuery(
        vector=query_embedding, k_nearest_neighbors=k, fields="content_vector"
    )

    results = azureSearchClient.search(
        search_text=None,
        vector_queries=[vector_query],
        vector_filter_mode=VectorFilterMode.PRE_FILTER,
        filter=filters,
        select=select,
        query_answer_threshold=0.0,
        # logging_enable=False#True
    )

    results = azureSearchClient.search(
        search_text=None,
        vector_queries=[vector_query],
        vector_filter_mode=VectorFilterMode.PRE_FILTER,
        #...other params like: select, filter...
        logging_enable=True
    )
    # If vector search is not providing any results, raise error:
    if len(results_list) == 0:
        raise Exception("Vector search without result...")
    else:
        return results_list

Here is example of logs generated:

2024-04-25 14:28:02 Request method: 'POST'
2024-04-25 14:28:02 Request headers:
2024-04-25 14:28:02 'Content-Type': 'application/json'
2024-04-25 14:28:02 'Content-Length': '34948'
2024-04-25 14:28:02 'api-key': '...'
2024-04-25 14:28:02 'Accept': 'application/json;odata.metadata=none'
2024-04-25 14:28:02 'x-ms-client-request-id': '42a0f8a4-02ff-11ef-b5f1-0242ac120003'
2024-04-25 14:28:02 'User-Agent': 'azsdk-python-search-documents/11.4.0 Python/3.11.9 (Linux-5.15.49-linuxkit-pr-x86_64-with-glibc2.36)'
2024-04-25 14:28:02 Request body:
2024-04-25 14:28:02 {"filter": "search.in(db_id, '87 ,116 ,54 ,29 ,138 ,34 ,51 ,52 ,67 ,90 ,35 ,105 ,45 ,86 ,169 ,168 ,92 ,93 ,89 ,31 ,115 ,114 ,112 ,156 ,155 ,135 ,127 ,75 ,123 ,128 ,126 ,166 ,44 ,103 ,121 ,88 ,82 ,152 ,125 ,46 ,119 ,157 ,53 ,32 ,120 ,136 ,48 ,26 ,85 ,137 ,95 ,78 ,57 ,24 ,81 ,159 ,77 ,25 ,94 ,122 ,30 ,49 ,47 ,37 ,28 ,33 ,76 ,106 ,104 ,55 ,129 ,165 ,56 ,91 ,58')", "select": "id,db_id,order,content,job_position,company", "vectorQueries": [{"kind": "vector", "k": 4, "fields": "content_vector", "vector": ["Here goes vey long vector..."]}], "vectorFilterMode": "preFilter"}
2024-04-25 14:28:02 Request URL: 'https://domain-cognitive-search.search.windows.net/indexes('interview-dev')/docs/search.post.search?api-version=REDACTED'
2024-04-25 14:28:02 Request method: 'POST'
2024-04-25 14:28:02 Request headers:
2024-04-25 14:28:02 'Content-Type': 'application/json'
2024-04-25 14:28:02 'Content-Length': '34948'
2024-04-25 14:28:02 'api-key': 'REDACTED'
2024-04-25 14:28:02 'Accept': 'application/json;odata.metadata=none'
2024-04-25 14:28:02 'x-ms-client-request-id': '42a0f8a4-02ff-11ef-b5f1-0242ac120003'
2024-04-25 14:28:02 'User-Agent': 'azsdk-python-search-documents/11.4.0 Python/3.11.9 (Linux-5.15.49-linuxkit-pr-x86_64-with-glibc2.36)'
2024-04-25 14:28:02 A body is sent with the request
2024-04-25 14:28:03 Response status: 200
2024-04-25 14:28:03 Response headers:
2024-04-25 14:28:03 'Transfer-Encoding': 'chunked'
2024-04-25 14:28:03 'Content-Type': 'application/json; odata.metadata=none; odata.streaming=true; charset=utf-8'
2024-04-25 14:28:03 'Content-Encoding': 'REDACTED'
2024-04-25 14:28:03 'Vary': 'REDACTED'
2024-04-25 14:28:03 'Server': 'Microsoft-IIS/10.0'
2024-04-25 14:28:03 'Strict-Transport-Security': 'REDACTED'
2024-04-25 14:28:03 'Preference-Applied': 'REDACTED'
2024-04-25 14:28:03 'OData-Version': 'REDACTED'
2024-04-25 14:28:03 'request-id': '42a0f8a4-02ff-11ef-b5f1-0242ac120003'
2024-04-25 14:28:03 'elapsed-time': 'REDACTED'
2024-04-25 14:28:03 'Date': 'Thu, 25 Apr 2024 12:28:03 GMT'
2024-04-25 14:28:03 Response status: '200'
2024-04-25 14:28:03 Response headers:
2024-04-25 14:28:03 'Transfer-Encoding': 'chunked'
2024-04-25 14:28:03 'Content-Type': 'application/json; odata.metadata=none; odata.streaming=true; charset=utf-8'
2024-04-25 14:28:03 'Content-Encoding': 'gzip'
2024-04-25 14:28:03 'Vary': 'Accept-Encoding'
2024-04-25 14:28:03 'Server': 'Microsoft-IIS/10.0'
2024-04-25 14:28:03 'Strict-Transport-Security': 'max-age=2592000, max-age=15724800; includeSubDomains'
2024-04-25 14:28:03 'Preference-Applied': 'odata.include-annotations="*"'
2024-04-25 14:28:03 'OData-Version': '4.0'
2024-04-25 14:28:03 'request-id': '42a0f8a4-02ff-11ef-b5f1-0242ac120003'
2024-04-25 14:28:03 'elapsed-time': '35'
2024-04-25 14:28:03 'Date': 'Thu, 25 Apr 2024 12:28:03 GMT'
2024-04-25 14:28:03 Response content:
2024-04-25 14:28:03 {"value":[]}
2024-04-25 14:28:03 NoneType: None

Expected behavior
vector search return a response similar to the other environments.

Thank you for your feedback. Tagging and routing to the team member best able to assist.

Please open a service support ticket for it.