Azure / Azure/azure-sdk-for-python

Search query_answer_count does not actually work

Aperta
#40,497 1 commento 0 reazioni 1 assegnatario Rivendicata da @xiangyan99 Vedi su GitHub
Client Search
Lingua principale
Python
Stelle
5.6k
Fork
3.4k
Merge medio
2g 2h
PR unite (30g)
213

Descrizione

- **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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.