Skip to content

Commit

Permalink
Allow arbitrary parameters to be sent to the retrieval model
Browse files Browse the repository at this point in the history
For example, a filter object:

dsp.retrieve('example query', k=1, metafilter=[{'index':'foo'}])
  • Loading branch information
detaos authored Jul 19, 2023
1 parent f9840c6 commit 3817bbe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dsp/primitives/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import dsp


def retrieve(query: str, k: int) -> list[str]:
def retrieve(query: str, k: int, **kwargs) -> list[str]:
"""Retrieves passages from the RM for the query and returns the top k passages."""
if not dsp.settings.rm:
raise AssertionError("No RM is loaded.")
passages = dsp.settings.rm(query, k=k)
passages = dsp.settings.rm(query, k=k, **kwargs)
passages = [psg.long_text for psg in passages]

if dsp.settings.reranker:
Expand Down

0 comments on commit 3817bbe

Please sign in to comment.