dspy
dspy copied to clipboard
Confusion about return types of retrievers
when we set a rm in dspy, and we call the dspy.Retrieve, the following lines will be executed
https://github.com/stanfordnlp/dspy/blob/b05394bb20722444648a33b4447156bcef202fd6/dsp/primitives/search.py#L8-L24
so we can see in L12, the passages
return by retrievers should be a list of dotdict which has long_text
attribute.
But we can find the base class of retrievers should return Prediction
https://github.com/stanfordnlp/dspy/blob/b05394bb20722444648a33b4447156bcef202fd6/dspy/retrieve/retrieve.py#L32-L32
the official example which uses dspy.ColBERTv2
returns List[dotdict] instead of Prediction (although it is not a dspy.Retrieve)
https://github.com/stanfordnlp/dspy/blob/b05394bb20722444648a33b4447156bcef202fd6/dsp/modules/colbertv2.py#L35
and we now have two kinds of retrievers, one return List[dotdict]
- azureaisearch_rm.py
- chromadb_rm.py
- clarifai_rm.py
- vectara_rm.py
another one return dspy.Prediction
- databricks_rm.py
- mongodb_atlas_rm.py
- pinecone_rm.py
- ragatouille_rm.py