Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow negative min score in SearchQuery #1184

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion src/documentation/elo_qa_eval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@
"outputs": [],
"source": [
"newly_added_models = [\n",
" Llama3InstructModel(name=\"llama-3.1-70b-instruct\", client=aa_client),\n",
" Llama3InstructModel(name=\"llama-3.3-70b-instruct\", client=aa_client),\n",
"]\n",
"\n",
"for model in newly_added_models:\n",
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
4 changes: 2 additions & 2 deletions src/intelligence_layer/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def __init__(
)
if name not in [model["name"] for model in self._client.models()]:
warnings.warn(
"The provided model is not a recommended model for this model class."
"The provided model is not a recommended model for this model class. "
"Make sure that the model you have selected is suited to be use for the prompt template used in this model class."
)
self._complete: Task[CompleteInput, CompleteOutput] = _Complete(
Expand Down Expand Up @@ -414,7 +414,7 @@ def __init__(
) -> None:
if name not in self.RECOMMENDED_MODELS or name == "":
warnings.warn(
"The provided model is not a recommended model for this model class."
"The provided model is not a recommended model for this model class. "
"Make sure that the model you have selected is suited to be use for the prompt template used in this model class."
)
super().__init__(name, client)
Expand Down
Loading