Azure / Azure/azure-sdk-for-python
Search query_answer_count does not actually work
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 3.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 193
Description
- **Package Name**: azure-search-documents
- **Package Version**: 11.5.2
- **Operating System**: Windows
- **Python Version**: 3.12.9
**Describe the bug**
When I try to run a semantic search with extractive answers, the SDK provides a `query_answer_count` option. However, when I try to use it, I get an error:
```
Exception Details: (InvalidAnswersOption) The value 'queryanswertype.extractive' is invalid mode for 'answers' parameter. Please specify one of the following options: none, extractive.
Code: InvalidAnswersOption
Message: The value 'queryanswertype.extractive' is invalid mode for 'answers' parameter. Please specify one of the following options: none, extractive.
```
Without that parameter it works fine (except that I only get one answer).
Instead, I have to change this:
```python
query_answer=QueryAnswerType.EXTRACTIVE,
```
to this:
```python
query_answer="extractive|count-3"
```
This is what the REST API expects. It seems like this was split out into two parameters in the SDK to try and be more intuitive... except that it simply doesn't work.
**To Reproduce**
Steps to reproduce the behavior:
1. Perform a semantic search and set `query_answer` and `query_answer_count` properties. It will fail.
**Expected behavior**
Either these properties should be removed and you should tell people to use the "REST-compatible" string with `query_answer`... or these should work correctly.
**Additional context**
`query_answer_threshold` also does not work.
Contributor guide
Assessment
This issue has not been assessed yet.