Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Getting Import error in vertexai package on AgentEvaluator run #1946

@raghul-velt

Description

@raghul-velt

I'm trying to run eval cases using pytest using Agent Evaluator. But the test is throwing error saying "cannot import name 'types' from 'vertextai'

Full error

============================================================= FAILURES =============================================================
_____________________________________________________________ test_all _____________________________________________________________

@pytest.mark.asyncio
async def test_all():
    """Test the agent's basic ability on a few examples."""
  await AgentEvaluator.evaluate(
        "console_agent",
        str(pathlib.Path(__file__).parent / "data/DataAgent.evalset.json"),
        num_runs=1,
    )

eval/test_eval.py:34:


/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/google/adk/evaluation/agent_evaluator.py:219: in evaluate
await AgentEvaluator.evaluate_eval_set(
/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/google/adk/evaluation/agent_evaluator.py:145: in evaluate_eval_set
metric_evaluator = AgentEvaluator._get_metric_evaluator(
/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/google/adk/evaluation/agent_evaluator.py:392: in _get_metric_evaluator
from .response_evaluator import ResponseEvaluator


# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

from typing import Optional

from typing_extensions import override

from vertexai import types as vertexai_types
E ImportError: cannot import name 'types' from 'vertexai' (/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/vertexai/init.py)

/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/google/adk/evaluation/response_evaluator.py:20: ImportError

Current Setup
google-adk>=1.6.1
uvicorn>=0.18.0
google-genai>=0.3.0
aiohttp>=3.8.0
pytest-asyncio>=0.21.0
Python : 3.13.5

Metadata

Metadata

Assignees

Labels

bot triaged[Bot] This issue is triaged by ADK boteval[Component] This issue is related to evaluation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions