From e5970e47b39d2f0421943bd1ba369d57bf8e762a Mon Sep 17 00:00:00 2001 From: Felix Fehse <155464791+FelixFehse@users.noreply.github.com> Date: Tue, 2 Jul 2024 11:14:50 +0200 Subject: [PATCH] fix: reverting refactor that broke `MultipleChunkRetrieverQA_combine_input_texts` (#941) --- CHANGELOG.md | 2 +- .../examples/qa/multiple_chunk_retriever_qa.py | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e9ed1bd6..26d0cf8c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ ... ### Fixes -... +- Reverted a bug introduced in `MultipleChunkRetrieverQa` text highlighting. ### Deprecations ... diff --git a/src/intelligence_layer/examples/qa/multiple_chunk_retriever_qa.py b/src/intelligence_layer/examples/qa/multiple_chunk_retriever_qa.py index 9b4ada941..794be3f85 100644 --- a/src/intelligence_layer/examples/qa/multiple_chunk_retriever_qa.py +++ b/src/intelligence_layer/examples/qa/multiple_chunk_retriever_qa.py @@ -156,15 +156,10 @@ def _combine_input_texts( start_indices: list[int] = [] combined_text = "" for i, chunk in enumerate(chunks): + combined_text += source_appendix.format(i=i + 1) start_indices.append(len(combined_text)) - - c = source_appendix.format(i=i + 1) - c += chunk + "\n\n" - c = c.strip() - if i != 0: - c = " " + c - combined_text += c - return (TextChunk(combined_text), start_indices) + combined_text += chunk + "\n\n" + return (TextChunk(combined_text.strip()), start_indices) @staticmethod def _get_highlights_per_chunk(