Spaces:
Running
Running
fix: pandas depreciated document handling
Browse files- retrieval/models/sentence_bert.py +0 -1
- retrieval/utils.py +3 -1
retrieval/models/sentence_bert.py
CHANGED
|
@@ -19,7 +19,6 @@ class DenseRetriever(BaseRetriever):
|
|
| 19 |
self.model = SentenceTransformer(model_name)
|
| 20 |
self.corpus_embeddings = None
|
| 21 |
self.embeddings_path = self._default_embeddings_path()
|
| 22 |
-
print(f"Using embeddings path: {self.embeddings_path}")
|
| 23 |
self.load_index() if self._embeddings_exist() else self.build_index()
|
| 24 |
|
| 25 |
def _default_embeddings_path(self) -> str:
|
|
|
|
| 19 |
self.model = SentenceTransformer(model_name)
|
| 20 |
self.corpus_embeddings = None
|
| 21 |
self.embeddings_path = self._default_embeddings_path()
|
|
|
|
| 22 |
self.load_index() if self._embeddings_exist() else self.build_index()
|
| 23 |
|
| 24 |
def _default_embeddings_path(self) -> str:
|
retrieval/utils.py
CHANGED
|
@@ -33,7 +33,9 @@ def load_documents(db_path: str, columns=["agent_name", "agent_description"]) ->
|
|
| 33 |
"""
|
| 34 |
agents_df = pd.read_csv(db_path)
|
| 35 |
agent_ids = agents_df["agent_id"] # keep agent IDs (mapping back after retrieval)
|
| 36 |
-
documents = agents_df[columns].
|
|
|
|
|
|
|
| 37 |
return agent_ids, documents
|
| 38 |
|
| 39 |
|
|
|
|
| 33 |
"""
|
| 34 |
agents_df = pd.read_csv(db_path)
|
| 35 |
agent_ids = agents_df["agent_id"] # keep agent IDs (mapping back after retrieval)
|
| 36 |
+
documents = agents_df[columns].apply(
|
| 37 |
+
lambda row: ' '.join(row.fillna('').astype(str)), axis=1
|
| 38 |
+
).tolist()
|
| 39 |
return agent_ids, documents
|
| 40 |
|
| 41 |
|