Skip to content

Commit

Permalink
fix retrieval resource positon missed
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnJyong committed Oct 10, 2024
1 parent a80712e commit 3419e96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion api/core/rag/entities/context_entities.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pydantic import BaseModel
from typing import Optional

from pydantic import BaseModel


class DocumentContext(BaseModel):
"""
Expand Down
4 changes: 1 addition & 3 deletions api/core/rag/retrieval/dataset_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,7 @@ def retrieve(
source["content"] = segment.content
retrieval_resource_list.append(source)
if hit_callback and retrieval_resource_list:
retrieval_resource_list = sorted(
retrieval_resource_list, key=lambda x: x.get("score"), reverse=True
)
retrieval_resource_list = sorted(retrieval_resource_list, key=lambda x: x.get("score"), reverse=True)
for position, item in enumerate(retrieval_resource_list, start=1):
item["position"] = position
hit_callback.return_retriever_resource_info(retrieval_resource_list)
Expand Down

0 comments on commit 3419e96

Please sign in to comment.