From 1dbb24e30a852b76c0a7326d8fd76ff1b06bd5b9 Mon Sep 17 00:00:00 2001 From: Fraser Date: Fri, 31 Mar 2023 22:05:20 -0400 Subject: [PATCH] limit to a max of 3 blocks from any one source --- api/get_blocks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/get_blocks.py b/api/get_blocks.py index 965d41f..d4af74e 100644 --- a/api/get_blocks.py +++ b/api/get_blocks.py @@ -88,6 +88,8 @@ def get_top_k_blocks(data, user_query: str, k: int = 10) -> List[Block]: for key, group in itertools.groupby(blocks_plus_old_index, key=key): group = list(group) if len(group) == 0: continue + + group = group[:3] # limit to a max of 3 blocks from any one source text = "\n\n\n.....\n\n\n".join([block[0].text for block in group])