Skip to content

Commit 068df04

Browse files
google-genai-botcopybara-github
authored andcommitted
fix: import deprecated from typing_extensions
Fixes #1125 and add it to pyproject.toml. This was added to typing_extensions in 4.5.0. I followed versioning guidance from https://typing-extensions.readthedocs.io/en/latest/index.html#versioning-and-backwards-compatibility. PiperOrigin-RevId: 767317467
1 parent 86e15ca commit 068df04

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ dependencies = [
4444
"PyYAML>=6.0.2", # For APIHubToolset.
4545
"sqlalchemy>=2.0", # SQL database ORM
4646
"tzlocal>=5.3", # Time zone utilities
47+
"typing-extensions>=4.5, <5",
4748
"uvicorn>=0.34.0", # ASGI server for FastAPI
4849
# go/keep-sorted end
4950
]

src/google/adk/cli/utils/evals.py

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

15+
from __future__ import annotations
16+
1517
from typing import Any
1618
from typing import Tuple
1719

18-
from deprecated import deprecated
1920
from google.genai import types as genai_types
21+
from typing_extensions import deprecated
2022

2123
from ...evaluation.eval_case import IntermediateData
2224
from ...evaluation.eval_case import Invocation
2325
from ...sessions.session import Session
2426

2527

26-
@deprecated(reason='Use convert_session_to_eval_invocations instead.')
28+
@deprecated('Use convert_session_to_eval_invocations instead.')
2729
def convert_session_to_eval_format(session: Session) -> list[dict[str, Any]]:
2830
"""Converts a session data into eval format.
2931

src/google/adk/evaluation/response_evaluator.py

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

15+
from __future__ import annotations
16+
1517
from typing import Any
1618
from typing import Optional
1719

18-
from deprecated import deprecated
1920
from google.genai import types as genai_types
2021
import pandas as pd
2122
from tabulate import tabulate
23+
from typing_extensions import deprecated
2224
from typing_extensions import override
2325
from vertexai.preview.evaluation import EvalTask
2426
from vertexai.preview.evaluation import MetricPromptTemplateExamples
@@ -124,10 +126,8 @@ def _get_eval_status(self, score: float):
124126

125127
@staticmethod
126128
@deprecated(
127-
reason=(
128-
"This method has been deprecated and will be removed soon. Please use"
129-
" evaluate_invocations instead."
130-
)
129+
"This method has been deprecated and will be removed soon. Please use"
130+
" evaluate_invocations instead."
131131
)
132132
def evaluate(
133133
raw_eval_dataset: list[list[dict[str, Any]]],

src/google/adk/evaluation/trajectory_evaluator.py

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

15+
from __future__ import annotations
16+
1517
from typing import Any
1618
from typing import cast
1719

18-
from deprecated import deprecated
1920
from google.genai import types as genai_types
2021
import pandas as pd
2122
from tabulate import tabulate
23+
from typing_extensions import deprecated
2224
from typing_extensions import override
2325

2426
from .eval_case import Invocation
@@ -100,10 +102,8 @@ def _get_eval_status(self, score: float):
100102

101103
@staticmethod
102104
@deprecated(
103-
reason=(
104-
"This method has been deprecated and will be removed soon. Please use"
105-
" evaluate_invocations instead."
106-
)
105+
"This method has been deprecated and will be removed soon. Please use"
106+
" evaluate_invocations instead."
107107
)
108108
def evaluate(
109109
eval_dataset: list[list[dict[str, Any]]],
@@ -218,7 +218,10 @@ def _evaluate_row(row):
218218
return new_row, failure
219219

220220
@staticmethod
221-
@deprecated()
221+
@deprecated(
222+
"are_tools_equal is deprecated and will be removed soon. Please use"
223+
" TrajectoryEvaluator._are_tool_calls_equal instead."
224+
)
222225
def are_tools_equal(list_a_original, list_b_original):
223226
# Remove other entries that we don't want to evaluate
224227
list_a = [

0 commit comments

Comments
 (0)