Skip to content

Commit 0ed9569

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: Renaming.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#6967 from googleapis:release-please--branches--main 4a0d1d2 PiperOrigin-RevId: 945668576
1 parent 3335750 commit 0ed9569

130 files changed

Lines changed: 23427 additions & 23634 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
@@ -106,7 +106,7 @@ def _get_api_client_with_location(
106106

107107
def _get_agent_engine_instance(
108108
agent_name: str, api_client: BaseApiClient
109-
) -> Union[types.AgentEngine, Any]:
109+
) -> Union[types.Runtime, Any]:
110110
"""Gets or creates an agent engine instance for the current thread."""
111111
if not hasattr(_thread_local_data, "agent_engine_instances"):
112112
_thread_local_data.agent_engine_instances = {}
@@ -116,7 +116,7 @@ def _get_agent_engine_instance(
116116
location=api_client.location,
117117
)
118118
_thread_local_data.agent_engine_instances[agent_name] = (
119-
client.agent_engines.get(name=agent_name)
119+
client.runtimes.get(name=agent_name)
120120
)
121121
return _thread_local_data.agent_engine_instances[agent_name]
122122

@@ -1421,7 +1421,7 @@ def _execute_inference_concurrently(
14211421
model_or_fn: Optional[Union[str, Callable[[Any], Any]]] = None,
14221422
gemini_config: Optional[genai_types.GenerateContentConfig] = None,
14231423
inference_fn: Optional[Callable[..., Any]] = None,
1424-
agent_engine: Optional[Union[str, types.AgentEngine]] = None,
1424+
agent_engine: Optional[Union[str, types.Runtime]] = None,
14251425
agent: Optional["LlmAgent"] = None, # type: ignore # noqa: F821
14261426
user_simulator_config: Optional[types.evals.UserSimulatorConfig] = None,
14271427
) -> list[
@@ -2211,7 +2211,7 @@ def _execute_inference(
22112211
api_client: BaseApiClient,
22122212
src: Union[str, pd.DataFrame],
22132213
model: Optional[Union[Callable[[Any], Any], str]] = None,
2214-
agent_engine: Optional[Union[str, types.AgentEngine]] = None,
2214+
agent_engine: Optional[Union[str, types.Runtime]] = None,
22152215
agent: Optional["LlmAgent"] = None, # type: ignore # noqa: F821
22162216
gemini_agent: Optional[str] = None,
22172217
dest: Optional[str] = None,
@@ -2230,7 +2230,7 @@ def _execute_inference(
22302230
model: The model to use for inference. Can be a callable function or a
22312231
string representing a model.
22322232
agent_engine: The agent engine to use for inference. Can be a resource
2233-
name string or an `AgentEngine` instance.
2233+
name string or an `Runtime` instance.
22342234
agent: The local agent to use for inference. Can be an ADK agent instance.
22352235
gemini_agent: The Gemini Agents API agent resource name to run inference
22362236
against via the Interactions API.
@@ -2320,14 +2320,14 @@ def _execute_inference(
23202320
and not isinstance(agent_engine, str)
23212321
and not (
23222322
hasattr(agent_engine, "api_client")
2323-
and type(agent_engine).__name__ == "AgentEngine"
2323+
and type(agent_engine).__name__ == "Runtime"
23242324
)
23252325
):
23262326
raise TypeError(
23272327
f"Unsupported agent_engine type: {type(agent_engine)}. Expecting a"
23282328
" string (agent engine resource name in"
23292329
" 'projects/{project_id}/locations/{location_id}/reasoningEngines/{reasoning_engine_id}'"
2330-
" format) or a types.AgentEngine instance."
2330+
" format) or a types.Runtime instance."
23312331
)
23322332
if (
23332333
_evals_constant.INTERMEDIATE_EVENTS in prompt_dataset.columns
@@ -2955,7 +2955,7 @@ def _create_agent_results_dataframe(
29552955

29562956
def _run_agent_internal(
29572957
api_client: BaseApiClient,
2958-
agent_engine: Optional[Union[str, types.AgentEngine]],
2958+
agent_engine: Optional[Union[str, types.Runtime]],
29592959
agent: Optional["LlmAgent"], # type: ignore # noqa: F821
29602960
prompt_dataset: pd.DataFrame,
29612961
user_simulator_config: Optional[types.evals.UserSimulatorConfig] = None,
@@ -3006,7 +3006,7 @@ def _run_agent_internal(
30063006

30073007
def _run_agent(
30083008
api_client: BaseApiClient,
3009-
agent_engine: Optional[Union[str, types.AgentEngine]],
3009+
agent_engine: Optional[Union[str, types.Runtime]],
30103010
agent: Optional["LlmAgent"], # type: ignore # noqa: F821
30113011
prompt_dataset: pd.DataFrame,
30123012
user_simulator_config: Optional[types.evals.UserSimulatorConfig] = None,
@@ -3077,7 +3077,7 @@ def _run_agent(
30773077

30783078
def _create_agent_engine_session(
30793079
*,
3080-
agent_engine: types.AgentEngine,
3080+
agent_engine: types.Runtime,
30813081
user_id: str,
30823082
session_state: Optional[dict[str, Any]] = None,
30833083
) -> Any:
@@ -3089,7 +3089,7 @@ def _create_agent_engine_session(
30893089
Sessions API.
30903090
30913091
Args:
3092-
agent_engine: The AgentEngine instance.
3092+
agent_engine: The Runtime instance.
30933093
user_id: The user ID for the session.
30943094
session_state: Optional initial state for the session.
30953095
@@ -3124,7 +3124,7 @@ def _create_agent_engine_session(
31243124
operation = agent_engine.api_client.sessions.create(
31253125
name=agent_engine.api_resource.name,
31263126
user_id=user_id,
3127-
config=types.CreateAgentEngineSessionConfig(
3127+
config=types.CreateRuntimeSessionConfig(
31283128
session_state=session_state,
31293129
),
31303130
)
@@ -3146,7 +3146,7 @@ def _create_agent_engine_session(
31463146
def _execute_agent_run_with_retry(
31473147
row: pd.Series,
31483148
contents: Union[genai_types.ContentListUnion, genai_types.ContentListUnionDict],
3149-
agent_engine: types.AgentEngine,
3149+
agent_engine: types.Runtime,
31503150
max_retries: int = 3,
31513151
) -> Union[list[dict[str, Any]], dict[str, Any]]:
31523152
"""Executes agent run over agent engine for a single prompt."""
@@ -3193,7 +3193,7 @@ def _execute_agent_run_with_retry(
31933193
author=ag_event.author or "user",
31943194
invocation_id="history",
31953195
timestamp=base_ts + datetime.timedelta(seconds=i),
3196-
config=types.AppendAgentEngineSessionEventConfig(
3196+
config=types.AppendRuntimeSessionEventConfig(
31973197
content=ag_event.content,
31983198
),
31993199
)

0 commit comments

Comments
 (0)