Skip to content

Commit 4829907

Browse files
authored
Merge branch 'main' into raflFaisal/generaliseContainerEnvForAgent
2 parents 63856ff + 5d2a876 commit 4829907

32 files changed

+1043
-425
lines changed

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ asyncio_default_fixture_loop_scope = "function"
157157
asyncio_mode = "auto"
158158

159159
[tool.mypy]
160+
python_version = "3.9"
160161
exclude = "tests/"
161162
plugins = ["pydantic.mypy"]
162-
strict = true
163+
# Start with non-strict mode, and swtich to strict mode later.
164+
# strict = true
163165
disable_error_code = ["import-not-found", "import-untyped", "unused-ignore"]
166+
follow_imports = "skip"

src/google/adk/cli/browser/index.html

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

src/google/adk/cli/browser/main-G4TORPTW.js renamed to src/google/adk/cli/browser/main-GR6432WH.js

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/google/adk/cli/browser/main-WPI534GQ.js

Lines changed: 0 additions & 91 deletions
This file was deleted.

src/google/adk/cli/cli_eval.py

Lines changed: 6 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from __future__ import annotations
16+
1517
import importlib.util
1618
import json
1719
import logging
@@ -22,99 +24,20 @@
2224
from typing import Optional
2325
import uuid
2426

25-
from pydantic import BaseModel
26-
from pydantic import Field
27-
2827
from ..agents import Agent
2928
from ..artifacts.base_artifact_service import BaseArtifactService
3029
from ..evaluation.eval_case import EvalCase
31-
from ..evaluation.eval_case import Invocation
30+
from ..evaluation.eval_metrics import EvalMetric
31+
from ..evaluation.eval_metrics import EvalMetricResult
32+
from ..evaluation.eval_metrics import EvalMetricResultPerInvocation
33+
from ..evaluation.eval_result import EvalCaseResult
3234
from ..evaluation.evaluator import EvalStatus
3335
from ..evaluation.evaluator import Evaluator
3436
from ..sessions.base_session_service import BaseSessionService
35-
from ..sessions.session import Session
36-
from .utils import common
3737

3838
logger = logging.getLogger("google_adk." + __name__)
3939

4040

41-
class EvalMetric(common.BaseModel):
42-
"""A metric used to evaluate a particular aspect of an eval case."""
43-
44-
metric_name: str
45-
"""The name of the metric."""
46-
47-
threshold: float
48-
"""A threshold value. Each metric decides how to interpret this threshold."""
49-
50-
51-
class EvalMetricResult(EvalMetric):
52-
"""The actual computed score/value of a particular EvalMetric."""
53-
54-
score: Optional[float] = None
55-
eval_status: EvalStatus
56-
57-
58-
class EvalMetricResultPerInvocation(common.BaseModel):
59-
"""Eval metric results per invocation."""
60-
61-
actual_invocation: Invocation
62-
"""The actual invocation, usually obtained by inferencing the agent."""
63-
64-
expected_invocation: Invocation
65-
"""The expected invocation, usually the reference or golden invocation."""
66-
67-
eval_metric_results: list[EvalMetricResult] = []
68-
"""Eval resutls for each applicable metric."""
69-
70-
71-
class EvalCaseResult(common.BaseModel):
72-
"""Case-level evaluation results."""
73-
74-
eval_set_file: str = Field(
75-
deprecated=True,
76-
description="This field is deprecated, use eval_set_id instead.",
77-
)
78-
eval_set_id: str = ""
79-
"""The eval set id."""
80-
81-
eval_id: str = ""
82-
"""The eval case id."""
83-
84-
final_eval_status: EvalStatus
85-
"""Final eval status for this eval case."""
86-
87-
eval_metric_results: list[tuple[EvalMetric, EvalMetricResult]] = Field(
88-
deprecated=True,
89-
description=(
90-
"This field is deprecated, use overall_eval_metric_results instead."
91-
),
92-
)
93-
94-
overall_eval_metric_results: list[EvalMetricResult]
95-
"""Overall result for each metric for the entire eval case."""
96-
97-
eval_metric_result_per_invocation: list[EvalMetricResultPerInvocation]
98-
"""Result for each metric on a per invocation basis."""
99-
100-
session_id: str
101-
"""Session id of the session generated as result of inferencing/scraping stage of the eval."""
102-
103-
session_details: Optional[Session] = None
104-
"""Session generated as result of inferencing/scraping stage of the eval."""
105-
106-
user_id: Optional[str] = None
107-
"""User id used during inferencing/scraping stage of the eval."""
108-
109-
110-
class EvalSetResult(common.BaseModel):
111-
eval_set_result_id: str
112-
eval_set_result_name: str
113-
eval_set_id: str
114-
eval_case_results: list[EvalCaseResult] = Field(default_factory=list)
115-
creation_timestamp: float = 0.0
116-
117-
11841
MISSING_EVAL_DEPENDENCIES_MESSAGE = (
11942
"Eval module is not installed, please install via `pip install"
12043
" google-adk[eval]`."
@@ -228,8 +151,6 @@ async def run_evals(
228151
"""
229152
try:
230153
from ..evaluation.agent_evaluator import EvaluationGenerator
231-
from ..evaluation.response_evaluator import ResponseEvaluator
232-
from ..evaluation.trajectory_evaluator import TrajectoryEvaluator
233154
except ModuleNotFoundError as e:
234155
raise ModuleNotFoundError(MISSING_EVAL_DEPENDENCIES_MESSAGE) from e
235156

src/google/adk/cli/cli_tools_click.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
import logging
2020
import os
2121
import tempfile
22-
from typing import AsyncGenerator
23-
from typing import Coroutine
2422
from typing import Optional
2523
from typing import Tuple
2624

@@ -465,7 +463,7 @@ async def _collect_eval_results() -> list[EvalCaseResult]:
465463

466464
# Write eval set results.
467465
local_eval_set_results_manager = LocalEvalSetResultsManager(
468-
agent_dir=os.path.dirname(agent_module_file_path)
466+
agents_dir=os.path.dirname(agent_module_file_path)
469467
)
470468
eval_set_id_to_eval_results = collections.defaultdict(list)
471469
for eval_case_result in eval_results:
@@ -610,7 +608,7 @@ async def _lifespan(app: FastAPI):
610608
)
611609

612610
app = get_fast_api_app(
613-
agent_dir=agents_dir,
611+
agents_dir=agents_dir,
614612
session_db_url=session_db_url,
615613
allow_origins=allow_origins,
616614
web=True,
@@ -711,7 +709,7 @@ def cli_api_server(
711709

712710
config = uvicorn.Config(
713711
get_fast_api_app(
714-
agent_dir=agents_dir,
712+
agents_dir=agents_dir,
715713
session_db_url=session_db_url,
716714
allow_origins=allow_origins,
717715
web=False,

0 commit comments

Comments
 (0)