Skip to content

Commit 6f5c4ed

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: Renaming.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#7003 from googleapis:release-please--branches--main 5905f2d PiperOrigin-RevId: 945668576
1 parent 922fa6a commit 6f5c4ed

131 files changed

Lines changed: 16689 additions & 18099 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

agentplatform/_genai/_evals_common.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _get_api_client_with_location(
125125

126126
def _get_agent_engine_instance(
127127
agent_name: str, api_client: BaseApiClient
128-
) -> Union[types.AgentEngine, Any]:
128+
) -> Union[types.Runtime, Any]:
129129
"""Gets or creates an agent engine instance for the current thread."""
130130
if not hasattr(_thread_local_data, "agent_engine_instances"):
131131
_thread_local_data.agent_engine_instances = {}
@@ -135,7 +135,7 @@ def _get_agent_engine_instance(
135135
location=api_client.location,
136136
)
137137
_thread_local_data.agent_engine_instances[agent_name] = (
138-
client.agent_engines.get(name=agent_name)
138+
client.runtimes.get(name=agent_name)
139139
)
140140
return _thread_local_data.agent_engine_instances[agent_name]
141141

@@ -1695,7 +1695,7 @@ def _execute_inference_concurrently(
16951695
model_or_fn: Optional[Union[str, Callable[[Any], Any]]] = None,
16961696
gemini_config: Optional[genai_types.GenerateContentConfig] = None,
16971697
inference_fn: Optional[Callable[..., Any]] = None,
1698-
agent_engine: Optional[Union[str, types.AgentEngine]] = None,
1698+
agent_engine: Optional[Union[str, types.Runtime]] = None,
16991699
agent: Optional["LlmAgent"] = None, # type: ignore # noqa: F821
17001700
user_simulator_config: Optional[types.evals.UserSimulatorConfig] = None,
17011701
) -> list[
@@ -2450,7 +2450,7 @@ def _execute_inference(
24502450
api_client: BaseApiClient,
24512451
src: Union[str, pd.DataFrame],
24522452
model: Optional[Union[Callable[[Any], Any], str]] = None,
2453-
agent_engine: Optional[Union[str, types.AgentEngine]] = None,
2453+
agent_engine: Optional[Union[str, types.Runtime]] = None,
24542454
agent: Optional["LlmAgent"] = None, # type: ignore # noqa: F821
24552455
gemini_agent: Optional[str] = None,
24562456
dest: Optional[str] = None,
@@ -2469,7 +2469,7 @@ def _execute_inference(
24692469
model: The model to use for inference. Can be a callable function or a
24702470
string representing a model.
24712471
agent_engine: The agent engine to use for inference. Can be a resource
2472-
name string or an `AgentEngine` instance.
2472+
name string or an `Runtime` instance.
24732473
agent: The local agent to use for inference. Can be an ADK agent instance.
24742474
gemini_agent: The Gemini Agents API agent resource name to run inference
24752475
against via the Interactions API.
@@ -2569,14 +2569,14 @@ def _execute_inference(
25692569
and not isinstance(agent_engine, str)
25702570
and not (
25712571
hasattr(agent_engine, "api_client")
2572-
and type(agent_engine).__name__ == "AgentEngine"
2572+
and type(agent_engine).__name__ == "Runtime"
25732573
)
25742574
):
25752575
raise TypeError(
25762576
f"Unsupported agent_engine type: {type(agent_engine)}. Expecting a"
25772577
" string (agent engine resource name in"
25782578
" 'projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}'"
2579-
" format) or a types.AgentEngine instance."
2579+
" format) or a types.Runtime instance."
25802580
)
25812581
if (
25822582
_evals_constant.INTERMEDIATE_EVENTS in prompt_dataset.columns
@@ -3204,7 +3204,7 @@ def _create_agent_results_dataframe(
32043204

32053205
def _run_agent_internal(
32063206
api_client: BaseApiClient,
3207-
agent_engine: Optional[Union[str, types.AgentEngine]],
3207+
agent_engine: Optional[Union[str, types.Runtime]],
32083208
agent: Optional["LlmAgent"], # type: ignore # noqa: F821
32093209
prompt_dataset: pd.DataFrame,
32103210
user_simulator_config: Optional[types.evals.UserSimulatorConfig] = None,
@@ -3255,7 +3255,7 @@ def _run_agent_internal(
32553255

32563256
def _run_agent(
32573257
api_client: BaseApiClient,
3258-
agent_engine: Optional[Union[str, types.AgentEngine]],
3258+
agent_engine: Optional[Union[str, types.Runtime]],
32593259
agent: Optional["LlmAgent"], # type: ignore # noqa: F821
32603260
prompt_dataset: pd.DataFrame,
32613261
user_simulator_config: Optional[types.evals.UserSimulatorConfig] = None,
@@ -3300,7 +3300,7 @@ def _run_agent(
33003300

33013301
def _create_agent_engine_session(
33023302
*,
3303-
agent_engine: types.AgentEngine,
3303+
agent_engine: types.Runtime,
33043304
user_id: str,
33053305
session_state: Optional[dict[str, Any]] = None,
33063306
) -> Any:
@@ -3312,7 +3312,7 @@ def _create_agent_engine_session(
33123312
Sessions API.
33133313
33143314
Args:
3315-
agent_engine: The AgentEngine instance.
3315+
agent_engine: The Runtime instance.
33163316
user_id: The user ID for the session.
33173317
session_state: Optional initial state for the session.
33183318
@@ -3347,7 +3347,7 @@ def _create_agent_engine_session(
33473347
operation = agent_engine.api_client.sessions.create(
33483348
name=agent_engine.api_resource.name,
33493349
user_id=user_id,
3350-
config=types.CreateAgentEngineSessionConfig(
3350+
config=types.CreateRuntimeSessionConfig(
33513351
session_state=session_state,
33523352
),
33533353
)
@@ -3369,7 +3369,7 @@ def _create_agent_engine_session(
33693369
def _execute_agent_run_with_retry(
33703370
row: pd.Series,
33713371
contents: Union[genai_types.ContentListUnion, genai_types.ContentListUnionDict],
3372-
agent_engine: types.AgentEngine,
3372+
agent_engine: types.Runtime,
33733373
max_retries: int = 3,
33743374
) -> Union[list[dict[str, Any]], dict[str, Any]]:
33753375
"""Executes agent run over agent engine for a single prompt."""
@@ -3416,7 +3416,7 @@ def _execute_agent_run_with_retry(
34163416
author=ag_event.author or "user",
34173417
invocation_id="history",
34183418
timestamp=base_ts + datetime.timedelta(seconds=i),
3419-
config=types.AppendAgentEngineSessionEventConfig(
3419+
config=types.AppendRuntimeSessionEventConfig(
34203420
content=ag_event.content,
34213421
),
34223422
)

0 commit comments

Comments
 (0)