mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-04-19 04:30:01 +08:00
Added similarity scores in reference chunks (#6918)
- Returning 3 similarity scores to the chat completion's `reference` field. It gives the user more transparency and added flexibility to display/rerank the reference when needed Co-authored-by: Yingfeng <yingfeng.zhang@gmail.com>
This commit is contained in:
parent
9283e91aa0
commit
43cf321942
@ -39,7 +39,10 @@ def chunks_format(reference):
|
|||||||
"dataset_id": get_value(chunk, "kb_id", "dataset_id"),
|
"dataset_id": get_value(chunk, "kb_id", "dataset_id"),
|
||||||
"image_id": get_value(chunk, "image_id", "img_id"),
|
"image_id": get_value(chunk, "image_id", "img_id"),
|
||||||
"positions": get_value(chunk, "positions", "position_int"),
|
"positions": get_value(chunk, "positions", "position_int"),
|
||||||
"url": chunk.get("url")
|
"url": chunk.get("url"),
|
||||||
|
"similarity": chunk.get("similarity"),
|
||||||
|
"vector_similarity": chunk.get("vector_similarity"),
|
||||||
|
"term_similarity": chunk.get("term_similarity"),
|
||||||
} for chunk in reference.get("chunks", [])]
|
} for chunk in reference.get("chunks", [])]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user