Spaces:
Sleeping
Sleeping
Update retriever_m3.py
Browse files- retriever_m3.py +6 -5
retriever_m3.py
CHANGED
|
@@ -39,13 +39,14 @@ def find_similar_foundations_api(query: str, client, top_k: int = 5):
|
|
| 39 |
if "Title" not in df.columns or "Purpose" not in df.columns:
|
| 40 |
raise ValueError("Dataset must contain 'Title' and 'Purpose' columns.")
|
| 41 |
|
| 42 |
-
payload = {
|
| 43 |
-
"source_sentence": query,
|
| 44 |
-
"sentences": df["Purpose"].tolist()
|
| 45 |
-
}
|
| 46 |
|
| 47 |
# Compute similarity against all missions
|
| 48 |
-
results = client.sentence_similarity(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
# Results = list of floats aligned with df
|
| 51 |
scored = sorted(
|
|
|
|
| 39 |
if "Title" not in df.columns or "Purpose" not in df.columns:
|
| 40 |
raise ValueError("Dataset must contain 'Title' and 'Purpose' columns.")
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
# Compute similarity against all missions
|
| 44 |
+
results = client.sentence_similarity(
|
| 45 |
+
source_sentence=query,
|
| 46 |
+
other_sentences=df["Purpose"].tolist(),
|
| 47 |
+
model="BAAI/bge-m3"
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
|
| 51 |
# Results = list of floats aligned with df
|
| 52 |
scored = sorted(
|