Chris4K commited on
Commit
31095a2
1 Parent(s): 52d5b06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -400,7 +400,10 @@ def compare_embeddings(file, query, model_types, model_names, split_strategy, ch
400
  # Storing embeddings into the results for future use
401
  for doc in results_raw:
402
  print(doc) # or print(dir(doc)) to see available attributes
403
- result_embeddings = [doc.metadata['embedding'] for doc in results_raw] # Adjust this based on the actual attribute names
 
 
 
404
  # result_embeddings = [doc['embedding'] for doc in results_raw] # Assuming each result has an embedding
405
 
406
  stats = calculate_statistics(results_raw, search_time, vector_store, num_tokens, embedding_model, query, top_k)
 
400
  # Storing embeddings into the results for future use
401
  for doc in results_raw:
402
  print(doc) # or print(dir(doc)) to see available attributes
403
+
404
+ #embedding = doc.metadata.get('embedding', None) # Use .get() to avoid KeyError
405
+
406
+ result_embeddings = [doc.metadata.get('embedding', None) for doc in results_raw] # Adjust this based on the actual attribute names
407
  # result_embeddings = [doc['embedding'] for doc in results_raw] # Assuming each result has an embedding
408
 
409
  stats = calculate_statistics(results_raw, search_time, vector_store, num_tokens, embedding_model, query, top_k)