Open XiyueSun opened 6 months ago
Can you share the actual error here?
Can you share the actual error here?
HttpResponseError Traceback (most recent call last)
Cell In[45], line 25
8 results = search_client.search(
9 search_text=query,
10 vector_queries=[vector_query],
(...)
13 top=1
14 )
16 # results = search_client.search(
17 # search_text=query,
18 # vector_queries=[vector_query],
(...)
22 # )
23 # print(result)
---> 25 semantic_answers = results.get_answers()
26 # semantic_answers = results["@search.answers"]
27 print ('Total Documents Matching Query:', results.get_count())
File c:......\Python\Python312\Lib\site-packages\azure\search\documents_paging.py:92, in SearchItemPaged.get_answers(self) 86 def get_answers(self) -> Optional[List[AnswerResult]]: 87 """Return answers. 88 89 :return: answers 90 :rtype: list[~azure.search.documents.models.AnswerResult] or None ... 790 if cls:
HttpResponseError: () An error has occurred. Code: Message: An error has occurred.
File c:...\Python\Python312\Lib\site-packages\azure\search\documents_paging.py:92, in SearchItemPaged.get_answers(self)
86 def get_answers(self) -> Optional[List[AnswerResult]]:
87 """Return answers.
88
89 :return: answers
90 :rtype: list[~azure.search.documents.models.AnswerResult] or None
91 """
---> 92 return cast(List[AnswerResult], self._first_iterator_instance().get_answers())
File c:...\Python\Python312\Lib\site-packages\azure\search\documents_paging.py:101, in _ensure_response.
File c:...\Python\Python312\Lib\site-packages\azure\search\documents_paging.py:123, in SearchPageIterator._get_next_cb(self, continuation_token) 121 def _get_next_cb(self, continuation_token): 122 if continuation_token is None: --> 123 return self._client.documents.search_post(search_request=self._initial_query.request, **self._kwargs)
File c:...\Python\Python312\Lib\site-packages\azure\core\tracing\decorator.py:78, in distributed_trace.
File c:...\Python\Python312\Lib\site-packages\azure\search\documents_generated\operations_documents_operations.py:786, in DocumentsOperations.search_post(self, search_request, request_options, **kwargs) 784 map_error(status_code=response.status_code, response=response, error_map=error_map) 785 error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response) --> 786 raise HttpResponseError(response=response, model=error)
HttpResponseError: () An error has occurred. Code: Message: An error has occurred.
I used the free monthly quota of 1,000 for the Azure AI Search semantic ranking service to send requests and it worked quiet well, but then an HttpResponseError occurred. So I changed the service plan for semantic ranking to the standard tier, but the error still persists.
here is my code, how to fix it? Except to the Error, there is not any other hints on the website. Pay for the standard semantic ranking service first?
`search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) vector_query = VectorizableTextQuery(text=query, k=1, fields="vector", exhaustive=True) results = search_client.search(
search_text=query, vector_queries=[vector_query], select=["parent_id", "chunk_id", "chunk"], query_type=QueryType.SEMANTIC, semantic_configuration_name='vector-helper-semantic-configuration', query_caption=QueryCaptionType.EXTRACTIVE, query_answer=QueryAnswerType.EXTRACTIVE, top=1 ) print(results)
semantic_answers = results.get_answers()`