@@ -227,11 +227,12 @@ async def gather_evidence(self, question: str, state: EnvironmentState) -> str:
227
227
228
228
logger .info (f"{ self .TOOL_FN_NAME } starting for question { question !r} ." )
229
229
original_question = state .session .question
230
+ l1_all = l1_relevant = l0 = len (state .session .contexts )
231
+
230
232
try :
231
233
# Swap out the question with the more specific question
232
234
# TODO: remove this swap, as it prevents us from supporting parallel calls
233
235
state .session .question = question
234
- l0 = len (state .session .contexts )
235
236
236
237
# TODO: refactor answer out of this...
237
238
state .session = await state .docs .aget_evidence (
@@ -244,7 +245,14 @@ async def gather_evidence(self, question: str, state: EnvironmentState) -> str:
244
245
f"{ self .TOOL_FN_NAME } _aget_evidence"
245
246
),
246
247
)
247
- l1 = len (state .session .contexts )
248
+ l1_all = len (state .session .contexts )
249
+ l1_relevant = len (
250
+ [
251
+ c
252
+ for c in state .session .contexts
253
+ if c .score > state .RELEVANT_SCORE_CUTOFF
254
+ ]
255
+ )
248
256
finally :
249
257
state .session .question = original_question
250
258
@@ -275,7 +283,10 @@ async def gather_evidence(self, question: str, state: EnvironmentState) -> str:
275
283
)
276
284
)
277
285
278
- return f"Added { l1 - l0 } pieces of evidence.{ best_evidence } \n \n " + status
286
+ return (
287
+ f"Added { l1_all - l0 } pieces of evidence, { l1_relevant - l0 } of which were"
288
+ f" relevant.{ best_evidence } \n \n " + status
289
+ )
279
290
280
291
281
292
class GenerateAnswer (NamedTool ):
0 commit comments