ppsingh commited on
Commit
69ffcc3
·
verified ·
1 Parent(s): c7e3ba0

Update utils/retriever.py

Browse files
Files changed (1) hide show
  1. 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('answer', '')
135
- metadata = doc.get('answer_metadata', {})
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
- 'answer': doc.page_content,
160
- 'answer_metadata': doc.metadata,
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)}")