Skip to content
3 changes: 3 additions & 0 deletions syftr/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ class Paths(BaseModel):
tmp_dir / "huggingface"
)
index_cache: Annotated[Path, Field(validate_default=True)] = tmp_dir / "indexcache"
retrieval_cache: Annotated[Path, Field(validate_default=True)] = (
tmp_dir / "retrieval_cache"
)
onnx_dir: Annotated[Path, Field(validate_default=True)] = tmp_dir / "onnx"
sota_dir: Annotated[Path, Field(validate_default=True)] = data_dir / "sota"
lock_dir: Annotated[Path, Field(validate_default=True)] = tmp_dir / "syftr-locks"
Expand Down
14 changes: 8 additions & 6 deletions syftr/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,15 +371,17 @@ async def aretrieve_pair(
flow: RetrieverFlow,
rate_limiter: AsyncLimiter,
raise_on_exception: bool | None = EVAL__RAISE_ON_EXCEPTION,
) -> T.Tuple[T.List[NodeWithScore] | None, float, Exception | None]:
) -> T.Tuple[
T.List[NodeWithScore] | None, float, T.List[LLMCallData], Exception | None
]:
"""Get flow's retrieved documents from an Q&A pair asynchronously."""
result, run_time, exception = await exception_catcher(
nodes, duration, call_data, exception = await exception_catcher(
func=flow.aretrieve,
return_values_on_exception=(None, np.nan),
raise_on_exception=raise_on_exception,
query=qa_pair.question,
)
return result, run_time, exception
return nodes, duration, call_data, exception


async def _aeval_retriever_pair(
Expand All @@ -392,8 +394,8 @@ async def _aeval_retriever_pair(
"""Evaluate retrieval performance on a single Q&A item."""
if not qa_pair.gold_evidence:
raise ValueError("QAPair gold_evidence is empty: %s", qa_pair)
retrieval_results, run_time, retrieval_exception = await aretrieve_pair(
qa_pair, flow, rate_limiter
retrieval_results, run_time, call_data, retrieval_exception = await aretrieve_pair(
qa_pair, flow, rate_limiter, raise_on_exception
)
if retrieval_results:
retrieved_contexts: T.List[str] = [
Expand All @@ -412,7 +414,7 @@ async def _aeval_retriever_pair(
run_time=run_time,
generation_exception=retrieval_exception,
evaluation_exception=None,
llm_call_data=[],
llm_call_data=call_data,
retriever_recall=result.score,
retriever_context_length=retrieved_contexts_length,
passing=result.passing,
Expand Down
Loading