DSPy: The framework for programming—not prompting—language models
Python
databricks_rm: slicing up to top-k the sorted results
[email protected]7e1f33e4c87b
diff --git a/dspy/retrieve/databricks_rm.py b/dspy/retrieve/databricks_rm.pyindex d29a61bc5..15d20711e 100644--- a/dspy/retrieve/databricks_rm.py+++ b/dspy/retrieve/databricks_rm.py@@ -217,7 +217,7 @@ class DatabricksRM(dspy.Retrieve):items += [item]# Sorting results by score in descending order- sorted_docs = sorted(items, key=lambda x: x["score"], reverse=True)+ sorted_docs = sorted(items, key=lambda x: x["score"], reverse=True)[:self.k]# Returning the predictionreturn Prediction(