From 95d0047e5cd787706841774e0836150576292ab7 Mon Sep 17 00:00:00 2001 From: "xianzhe.xxz" Date: Fri, 26 Jul 2024 20:07:01 +0800 Subject: [PATCH] add score_recall manager --- memoryscope/storage/llama_index_es_memory_store.py | 3 ++- memoryscope/storage/llama_index_sync_elasticsearch.py | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/memoryscope/storage/llama_index_es_memory_store.py b/memoryscope/storage/llama_index_es_memory_store.py index af88f91c..96b1542f 100644 --- a/memoryscope/storage/llama_index_es_memory_store.py +++ b/memoryscope/storage/llama_index_es_memory_store.py @@ -144,7 +144,7 @@ class LlamaIndexEsMemoryStore(BaseMemoryStore): return TextNode(id_=memory_node.memory_id, text=memory_node.content, embedding=embedding, - metadata=memory_node.model_dump(exclude={"content", "vector"})) + metadata=memory_node.model_dump(exclude={"content", "vector", "score_recall", "score_rank", "score_rerank"})) @staticmethod def _text_node_2_memory_node(text_node: NodeWithScore) -> MemoryNode: @@ -158,4 +158,5 @@ class LlamaIndexEsMemoryStore(BaseMemoryStore): MemoryNode: The converted MemoryNode with text and metadata from the NodeWithScore. """ text_node.metadata["vector"] = text_node.embedding if text_node.embedding else [] + text_node.metadata["score_recall"] = text_node.score return MemoryNode(content=text_node.text, **text_node.metadata) diff --git a/memoryscope/storage/llama_index_sync_elasticsearch.py b/memoryscope/storage/llama_index_sync_elasticsearch.py index 5c74b0ba..0794b284 100644 --- a/memoryscope/storage/llama_index_sync_elasticsearch.py +++ b/memoryscope/storage/llama_index_sync_elasticsearch.py @@ -702,7 +702,6 @@ class SyncElasticsearchStore(BasePydanticVectorStore): ): total_rank = sum(top_k_scores) top_k_scores = [rank for rank in top_k_scores] - print("top_k_scores:", top_k_scores) # top_k_scores = [(total_rank - rank) / total_rank for rank in top_k_scores] # top_k_scores = [total_rank - rank / total_rank for rank in top_k_scores]