@@ -605,28 +605,32 @@ async def aget_evidence(
605
605
if summary_llm_model is None :
606
606
summary_llm_model = evidence_settings .get_summary_llm ()
607
607
608
- exclude_text_filter = exclude_text_filter or set ()
609
- exclude_text_filter |= {c .text .name for c in session .contexts }
610
-
611
- _k = answer_config .evidence_k
612
- if exclude_text_filter :
613
- # Increase k to retrieve so we have enough to down-select after retrieval
614
- _k += len (exclude_text_filter )
608
+ if exclude_text_filter is not None :
609
+ text_name = Text .__name__
610
+ warnings .warn (
611
+ (
612
+ "The 'exclude_text_filter' argument did not work as intended"
613
+ f" due to a mix-up in excluding { text_name } .name vs { text_name } ."
614
+ f" This bug enabled us to have 2+ contexts per { text_name } , so to"
615
+ " first-class that capability and simplify our implementation,"
616
+ " we're removing the 'exclude_text_filter' argument."
617
+ " This deprecation will conclude in version 6"
618
+ ),
619
+ category = DeprecationWarning ,
620
+ stacklevel = 2 ,
621
+ )
615
622
616
623
if answer_config .evidence_retrieval :
617
624
matches = await self .retrieve_texts (
618
625
session .question ,
619
- _k ,
626
+ answer_config . evidence_k ,
620
627
evidence_settings ,
621
628
embedding_model ,
622
629
partitioning_fn = partitioning_fn ,
623
630
)
624
631
else :
625
632
matches = self .texts
626
633
627
- if exclude_text_filter :
628
- matches = [m for m in matches if m .text not in exclude_text_filter ]
629
-
630
634
matches = (
631
635
matches [: answer_config .evidence_k ]
632
636
if answer_config .evidence_retrieval
0 commit comments