Parcourir la source

Adds retrieval result fields to Chunk (#8478)

### What problem does this PR solve?

This PR adds fields to the `Chunk` class to store retrieval results like
similarity scores, term similarity, vector similarity, positions, and
document type. This allows the chunk object to hold all the information
needed when returning search results from the vector database.

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
tags/v0.20.0
Tuan Le il y a 4 mois
Parent
révision
7353070f49
Aucun compte lié à l'adresse e-mail de l'auteur
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  1. 6
    0
      sdk/python/ragflow_sdk/modules/chunk.py

+ 6
- 0
sdk/python/ragflow_sdk/modules/chunk.py Voir le fichier

@@ -35,6 +35,12 @@ class Chunk(Base):
self.document_name = ""
self.document_id = ""
self.available = True
# Additional fields for retrieval results
self.similarity = 0.0
self.vector_similarity = 0.0
self.term_similarity = 0.0
self.positions = []
self.doc_type = ""
for k in list(res_dict.keys()):
if k not in self.__dict__:
res_dict.pop(k)

Chargement…
Annuler
Enregistrer