Skip to content

Commit

Permalink
Merge pull request #1575 from vespa-engine/thomasht86/exploreaddition…
Browse files Browse the repository at this point in the history
…alhits

(colpalidemo) Thomasht86/exploreadditionalhits
  • Loading branch information
thomasht86 authored Nov 12, 2024
2 parents 2d4d709 + e85d2f6 commit 1df5d7d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions visual-retrieval-colpali/src/backend/vespa_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ async def query_vespa_default(
) -> dict:
"""
Query Vespa using the default ranking profile.
This corresponds to the "Hybrid ColPali+BM25" radio button in the UI.
Args:
query (str): The query text.
Expand Down Expand Up @@ -162,6 +163,7 @@ async def query_vespa_bm25(
) -> dict:
"""
Query Vespa using the BM25 ranking profile.
This corresponds to the "BM25" radio button in the UI.
Args:
query (str): The query text.
Expand Down Expand Up @@ -422,13 +424,15 @@ async def query_vespa_nearest_neighbor(
query: str,
q_emb: torch.Tensor,
target_hits_per_query_tensor: int = 100,
hnsw_explore_additional_hits: int = 300,
hits: int = 3,
timeout: str = "10s",
sim_map: bool = False,
**kwargs,
) -> dict:
"""
Query Vespa using nearest neighbor search with mixed tensors for MaxSim calculations.
This corresponds to the "ColPali" radio button in the UI.
Args:
query (str): The query text.
Expand Down Expand Up @@ -468,6 +472,8 @@ async def query_vespa_nearest_neighbor(
"timeout": timeout,
"hits": hits,
"query": query,
"hnsw.exploreAdditionalHits": hnsw_explore_additional_hits,
"ranking.rerankCount": 100,
**kwargs,
},
)
Expand Down

0 comments on commit 1df5d7d

Please sign in to comment.