Skip to content

Commit

Permalink
fix: bug fix for VectorSearchType.SimilarityScoreThreshold (#290)
Browse files Browse the repository at this point in the history
* bug fix for VectorSearchType.SimilarityScoreThreshold

initializing ScoreThreshold value

* Update VectorStoreRetriever.cs

---------

Co-authored-by: Konstantin S <[email protected]>
  • Loading branch information
vikhyat90 and HavenDV authored May 3, 2024
1 parent 9e46ac5 commit a07e22c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Core/src/Retrievers/VectorStoreRetriever.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,13 @@ public VectorStoreRetriever(
float? scoreThreshold = null)
{
SearchType = searchType;
ScoreThreshold = scoreThreshold;

if (SearchType == VectorSearchType.SimilarityScoreThreshold && ScoreThreshold == null)
throw new ArgumentException($"ScoreThreshold required for {SearchType}");

EmbeddingModel = embeddingModel;
VectorCollection = vectorCollection;
SearchType = searchType;
ScoreThreshold = scoreThreshold;
}

/// <inheritdoc/>
Expand Down Expand Up @@ -71,4 +70,4 @@ public Task<IReadOnlyCollection<string>> AddDocumentsAsync(IReadOnlyCollection<D
{
return VectorCollection.AddDocumentsAsync(EmbeddingModel, documents);
}
}
}

0 comments on commit a07e22c

Please sign in to comment.