Spaces:
Running
on
T4
Running
on
T4
Update utils/retriever.py
Browse files- utils/retriever.py +4 -4
utils/retriever.py
CHANGED
@@ -131,8 +131,8 @@ def rerank_documents(query: str, documents: List[Dict[str, Any]]) -> List[Dict[s
|
|
131 |
langchain_docs = []
|
132 |
for doc in documents:
|
133 |
# Use correct keys from the data storage test module
|
134 |
-
content = doc.get(
|
135 |
-
metadata = doc.get(
|
136 |
|
137 |
if not content:
|
138 |
logging.warning(f"Document missing content: {doc}")
|
@@ -156,8 +156,8 @@ def rerank_documents(query: str, documents: List[Dict[str, Any]]) -> List[Dict[s
|
|
156 |
result = []
|
157 |
for doc in reranked_docs:
|
158 |
result.append({
|
159 |
-
|
160 |
-
|
161 |
})
|
162 |
|
163 |
logging.info(f"Successfully reranked {len(documents)} documents to top {len(result)}")
|
|
|
131 |
langchain_docs = []
|
132 |
for doc in documents:
|
133 |
# Use correct keys from the data storage test module
|
134 |
+
content = doc.get("answer", "")
|
135 |
+
metadata = doc.get("answer_metadata", {})
|
136 |
|
137 |
if not content:
|
138 |
logging.warning(f"Document missing content: {doc}")
|
|
|
156 |
result = []
|
157 |
for doc in reranked_docs:
|
158 |
result.append({
|
159 |
+
"answer": doc.page_content,
|
160 |
+
"answer_metadata": doc.metadata,
|
161 |
})
|
162 |
|
163 |
logging.info(f"Successfully reranked {len(documents)} documents to top {len(result)}")
|