fix: rewoo citation (#441) #none

This commit is contained in:
Tuan Anh Nguyen Dang (Tadashi_Cin) 2024-10-30 16:20:21 +07:00 committed by GitHub
parent 66e565649e
commit 280f0d58ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -271,13 +271,12 @@ class RewooAgentPipeline(BaseReasoning):
if "citation" in answer.metadata and answer.metadata["citation"] is not None: if "citation" in answer.metadata and answer.metadata["citation"] is not None:
context = answer.metadata["worker_log"] context = answer.metadata["worker_log"]
for fact_with_evidence in answer.metadata["citation"].answer: for evidence in answer.metadata["citation"].evidences:
for quote in fact_with_evidence.substring_quote: matches = find_text(evidence, context)
matches = find_text(quote, context) for match in matches:
for match in matches: split_indices.append(match[0])
split_indices.append(match[0]) split_indices.append(match[1])
split_indices.append(match[1]) start_indices.add(match[0])
start_indices.add(match[0])
split_indices = sorted(list(set(split_indices))) split_indices = sorted(list(set(split_indices)))
spans = [] spans = []
prev = 0 prev = 0