Skip to content

Commit d6b3be7

Browse files
committed
Additional changes
1 parent 01db41a commit d6b3be7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

langchain_postgres/v2/async_vectorstore.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ async def __query_collection(
670670
dense_results,
671671
sparse_results,
672672
**hybrid_search_config.fusion_function_parameters,
673+
distance_strategy=self.distance_strategy
673674
)
674675
return combined_results
675676
return dense_results

langchain_postgres/v2/hybrid_search_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def weighted_sum_ranking(
7171
distance_strategy = kwargs.get("distance_strategy", DistanceStrategy.COSINE_DISTANCE)
7272
is_primary_distance = distance_strategy != DistanceStrategy.INNER_PRODUCT
7373

74-
# 1. Normalize both sets of results onto a 0-1 scale
74+
# Normalize both sets of results onto a 0-1 scale
7575
normalized_primary = _normalize_scores(
7676
[dict(row) for row in primary_search_results],
7777
is_distance_metric=is_primary_distance
@@ -89,7 +89,7 @@ def weighted_sum_ranking(
8989
# Process primary results
9090
for item in normalized_primary:
9191
doc_id = str(list(item.values())[0])
92-
# Overwrite the 'distance' key with the weighted primary score
92+
# Set the 'distance' key with the weighted primary score
9393
item["distance"] = item["normalized_score"] * primary_results_weight
9494
weighted_scores[doc_id] = item
9595

0 commit comments

Comments
 (0)