devve1 commited on
Commit
1fdeca3
1 Parent(s): 9dd9d27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -71,8 +71,9 @@ def main(query: str, client: QdrantClient, collection_name: str, llm: Llama, den
71
  scored_points = query_hybrid_search(query, client, collection_name, dense_model, sparse_model)
72
  print(scored_points)
73
 
74
- docs = [(scored_point.payload['text'], scored_point.payload['metadata']) for scored_point in scored_points]
75
- contents, metadatas = [list(t) for t in zip(*docs)]
 
76
 
77
  context = "\n".join(contents)
78
 
@@ -284,8 +285,9 @@ def chunk_documents(texts: List[str], metadatas: List[dict], dense_model: Optimu
284
  final = end - start
285
  print(f'FINAL CHUNKING TIME: {final}')
286
 
287
- documents_and_metadatas = [(chunk.content, chunk.metadata) for sub_chunk in chunks for chunk in sub_chunk]
288
- documents, metadatas_docs = [list(t) for t in zip(*documents_and_metadatas)]
 
289
  print(f'CHUNKS : {documents}')
290
 
291
  start_dense = time.time()
 
71
  scored_points = query_hybrid_search(query, client, collection_name, dense_model, sparse_model)
72
  print(scored_points)
73
 
74
+ docs = [scored_point.payload for scored_point in scored_points]
75
+ contents = [t['text'] for t in docs]
76
+ metadatas = [t['metadata'] for t in docs]
77
 
78
  context = "\n".join(contents)
79
 
 
285
  final = end - start
286
  print(f'FINAL CHUNKING TIME: {final}')
287
 
288
+ docs = [for sub_chunk in chunks for chunk in sub_chunk]
289
+ documents = [doc.content for doc in docs]
290
+ metadatas_docs = [doc.metadata for doc in docs]
291
  print(f'CHUNKS : {documents}')
292
 
293
  start_dense = time.time()