Skip to content

Commit

Permalink
fix: allow negative min score in SearchQuery
Browse files Browse the repository at this point in the history
Update the `SearchQuery` model in `document_index.py` to allow a
`min_score` between -1 and 1.
  • Loading branch information
Michael-JB committed Dec 17, 2024
1 parent 26c5a24 commit d10d2f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- Add method `DocumentIndexClient.chunks()` for retrieving all text chunks of a document.

### Fixes
...
- The Document Index `SearchQuery` now correctly allows searches with a negative `min_score`.

### Deprecations
...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,15 @@ class SearchQuery(BaseModel):
query: Actual text to be searched with.
max_results: Max number of search results to be retrieved by the query.
Must be larger than 0.
min_score: Filter out results with a similarity score below this value.
Must be between 0 and 1.
For searches on hybrid indexes, the Document Index applies the min_score
to the semantic results before fusion of result sets. As fusion re-scores results,
min_score: Filter out results with a similarity score below this value. Must be between
-1 and 1. For searches on hybrid indexes, the Document Index applies the min_score to
the semantic results before fusion of result sets. As fusion re-scores results,
returned scores may exceed this value.
"""

query: str
max_results: int = Field(ge=0, default=1)
min_score: float = Field(ge=0.0, le=1.0, default=0.0)
min_score: float = Field(ge=-1.0, le=1.0, default=0.0)
filters: Optional[list[Filters]] = None


Expand Down

0 comments on commit d10d2f2

Please sign in to comment.