|
14 | 14 | # |
15 | 15 | # pylint: disable=protected-access,bad-continuation,missing-function-docstring |
16 | 16 |
|
| 17 | +import sys |
| 18 | + |
17 | 19 | from tests.unit.vertexai.genai.replays import pytest_helper |
18 | 20 | from vertexai._genai import types |
19 | 21 |
|
|
24 | 26 |
|
25 | 27 | def test_create_with_developer_connect_source(client): |
26 | 28 | """Tests creating an agent engine with developer connect source.""" |
| 29 | + if sys.version_info >= (3, 13): |
| 30 | + try: |
| 31 | + client._api_client._initialize_replay_session_if_not_loaded() |
| 32 | + if client._api_client.replay_session: |
| 33 | + target_ver = f"{sys.version_info.major}.{sys.version_info.minor}" |
| 34 | + for interaction in client._api_client.replay_session.interactions: |
| 35 | + |
| 36 | + def _update_ver(obj): |
| 37 | + if isinstance(obj, dict): |
| 38 | + if "python_spec" in obj and isinstance( |
| 39 | + obj["python_spec"], dict |
| 40 | + ): |
| 41 | + if "version" in obj["python_spec"]: |
| 42 | + obj["python_spec"]["version"] = target_ver |
| 43 | + for v in obj.values(): |
| 44 | + _update_ver(v) |
| 45 | + elif isinstance(obj, list): |
| 46 | + for item in obj: |
| 47 | + _update_ver(item) |
| 48 | + |
| 49 | + if hasattr(interaction.request, "body_segments"): |
| 50 | + _update_ver(interaction.request.body_segments) |
| 51 | + if hasattr(interaction.request, "body"): |
| 52 | + _update_ver(interaction.request.body) |
| 53 | + except Exception: |
| 54 | + pass |
27 | 55 | developer_connect_source_config = types.ReasoningEngineSpecSourceCodeSpecDeveloperConnectConfig( |
28 | 56 | git_repository_link="projects/reasoning-engine-test-1/locations/europe-west3/connections/shawn-develop-connect/gitRepositoryLinks/shawn-yang-google-adk-samples", |
29 | 57 | revision="main", |
|
0 commit comments