Skip to content

Commit 4ae4c69

Browse files
ankursharmascopybara-github
authored andcommitted
fix: ModuleNotFound error should be caught when dependencies of LocalEvalService are not installed
Once caught we publish the clarifying message to install the extra. PiperOrigin-RevId: 785999033
1 parent 32df937 commit 4ae4c69

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/google/adk/cli/fast_api.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -675,23 +675,24 @@ async def run_eval(
675675
app_name: str, eval_set_id: str, req: RunEvalRequest
676676
) -> list[RunEvalResult]:
677677
"""Runs an eval given the details in the eval request."""
678-
from ..evaluation.local_eval_service import LocalEvalService
679-
from .cli_eval import _collect_eval_results
680-
from .cli_eval import _collect_inferences
681-
682678
# Create a mapping from eval set file to all the evals that needed to be
683679
# run.
684-
eval_set = eval_sets_manager.get_eval_set(app_name, eval_set_id)
680+
try:
681+
from ..evaluation.local_eval_service import LocalEvalService
682+
from .cli_eval import _collect_eval_results
683+
from .cli_eval import _collect_inferences
685684

686-
if not eval_set:
687-
raise HTTPException(
688-
status_code=400, detail=f"Eval set `{eval_set_id}` not found."
689-
)
685+
eval_set = eval_sets_manager.get_eval_set(app_name, eval_set_id)
690686

691-
root_agent = agent_loader.load_agent(app_name)
687+
if not eval_set:
688+
raise HTTPException(
689+
status_code=400, detail=f"Eval set `{eval_set_id}` not found."
690+
)
691+
692+
root_agent = agent_loader.load_agent(app_name)
693+
694+
eval_case_results = []
692695

693-
eval_case_results = []
694-
try:
695696
eval_service = LocalEvalService(
696697
root_agent=root_agent,
697698
eval_sets_manager=eval_sets_manager,

0 commit comments

Comments
 (0)