Fixed llm_indices from document search api (#1853)

This commit is contained in:
hagen-danswer
2024-07-17 14:52:49 -07:00
committed by GitHub
parent cdf6089b3e
commit 1c77395503

View File

@@ -278,17 +278,17 @@ def search_postprocessing(
_log_top_section_links(search_query.search_type.value, reranked_sections) _log_top_section_links(search_query.search_type.value, reranked_sections)
yield reranked_sections yield reranked_sections
llm_section_selection = cast( llm_selected_section_ids = (
list[str] | None, [
post_processing_results.get(str(llm_filter_task_id)) section.center_chunk.unique_id
if llm_filter_task_id for section in post_processing_results.get(str(llm_filter_task_id), [])
else None,
)
if llm_section_selection is not None:
yield [
index
for index, section in enumerate(reranked_sections or retrieved_sections)
if section.center_chunk.unique_id in llm_section_selection
] ]
else: if llm_filter_task_id
yield cast(list[int], []) else []
)
yield [
index
for index, section in enumerate(reranked_sections or retrieved_sections)
if section.center_chunk.unique_id in llm_selected_section_ids
]