|
4 | 4 | - _ensure_metadata_loaded() - single runtime creation for both schema and agent model |
5 | 5 | - _get_agent_model() - cached agent model retrieval |
6 | 6 | - get_schema() - cached schema retrieval |
7 | | -- _find_agent_model_in_runtime() - recursive delegate traversal |
8 | | -- LLMAgentRuntimeProtocol - protocol implementation detection |
9 | 7 | """ |
10 | 8 |
|
11 | 9 | import uuid |
|
31 | 29 | UiPathEvalRuntime, |
32 | 30 | ) |
33 | 31 | from uipath._cli.cli_eval import ( |
34 | | - _find_agent_model_in_runtime, |
35 | 32 | _get_agent_model, |
36 | 33 | ) |
37 | 34 | from uipath._events._event_bus import EventBus |
@@ -156,50 +153,6 @@ def test_protocol_rejects_wrapper_without_method(self): |
156 | 153 | assert not isinstance(wrapper, LLMAgentRuntimeProtocol) |
157 | 154 |
|
158 | 155 |
|
159 | | -class TestFindAgentModelInRuntime: |
160 | | - """Tests for _find_agent_model_in_runtime recursive search.""" |
161 | | - |
162 | | - def test_finds_model_in_direct_runtime(self): |
163 | | - """Test finding agent model directly on runtime.""" |
164 | | - runtime = AgentModelRuntime("gpt-4o") |
165 | | - result = _find_agent_model_in_runtime(runtime) |
166 | | - assert result == "gpt-4o" |
167 | | - |
168 | | - def test_finds_model_in_wrapped_runtime(self): |
169 | | - """Test finding agent model through wrapper's delegate.""" |
170 | | - inner = AgentModelRuntime("claude-3") |
171 | | - wrapper = WrapperRuntime(inner) |
172 | | - result = _find_agent_model_in_runtime(wrapper) |
173 | | - assert result == "claude-3" |
174 | | - |
175 | | - def test_finds_model_in_deeply_wrapped_runtime(self): |
176 | | - """Test finding agent model through multiple wrapper layers.""" |
177 | | - inner = AgentModelRuntime("gpt-4-turbo") |
178 | | - wrapper1 = WrapperRuntime(inner) |
179 | | - wrapper2 = WrapperRuntime(wrapper1) |
180 | | - result = _find_agent_model_in_runtime(wrapper2) |
181 | | - assert result == "gpt-4-turbo" |
182 | | - |
183 | | - def test_finds_model_via_private_delegate(self): |
184 | | - """Test finding agent model through _delegate attribute.""" |
185 | | - inner = AgentModelRuntime("gemini-pro") |
186 | | - wrapper = PrivateDelegateRuntime(inner) |
187 | | - result = _find_agent_model_in_runtime(wrapper) |
188 | | - assert result == "gemini-pro" |
189 | | - |
190 | | - def test_returns_none_when_no_model(self): |
191 | | - """Test returns None when no runtime implements the protocol.""" |
192 | | - runtime = BaseTestRuntime() |
193 | | - result = _find_agent_model_in_runtime(runtime) |
194 | | - assert result is None |
195 | | - |
196 | | - def test_returns_none_for_none_model(self): |
197 | | - """Test returns None when runtime returns None for model.""" |
198 | | - runtime = AgentModelRuntime(None) |
199 | | - result = _find_agent_model_in_runtime(runtime) |
200 | | - assert result is None |
201 | | - |
202 | | - |
203 | 156 | class TestGetAgentModel: |
204 | 157 | """Tests for _get_agent_model function.""" |
205 | 158 |
|
@@ -235,24 +188,6 @@ async def test_returns_model_consistently(self): |
235 | 188 |
|
236 | 189 | assert model1 == model2 == "consistent-model" |
237 | 190 |
|
238 | | - @pytest.mark.asyncio |
239 | | - async def test_handles_exception_gracefully(self, monkeypatch): |
240 | | - """Test that _get_agent_model returns None when _find_agent_model_in_runtime raises exception.""" |
241 | | - runtime = BaseTestRuntime() |
242 | | - schema = MockRuntimeSchema() |
243 | | - |
244 | | - # Mock _find_agent_model_in_runtime to raise an exception |
245 | | - def mock_find_agent_model_error(r): |
246 | | - raise RuntimeError("Unexpected error during model lookup") |
247 | | - |
248 | | - monkeypatch.setattr( |
249 | | - "uipath._cli.cli_eval._find_agent_model_in_runtime", |
250 | | - mock_find_agent_model_error, |
251 | | - ) |
252 | | - |
253 | | - model = await _get_agent_model(runtime, schema) |
254 | | - assert model is None |
255 | | - |
256 | 191 |
|
257 | 192 | class TestGetSchema: |
258 | 193 | """Tests for get_schema method.""" |
@@ -314,25 +249,3 @@ async def create_runtime(): |
314 | 249 | # Should be the same object |
315 | 250 | assert schema1 is schema2 |
316 | 251 | assert schema1.file_path == schema2.file_path == "test.py" |
317 | | - |
318 | | - |
319 | | -class TestWrappedRuntimeModelResolution: |
320 | | - """Tests for model resolution through realistic wrapper chains.""" |
321 | | - |
322 | | - def test_resolves_model_through_resumable_telemetry_chain(self): |
323 | | - """Test model resolution through ResumableRuntime -> TelemetryWrapper -> BaseRuntime chain. |
324 | | -
|
325 | | - This mimics the real wrapper chain: |
326 | | - UiPathResumableRuntime -> TelemetryRuntimeWrapper -> AgentsLangGraphRuntime |
327 | | - """ |
328 | | - # Base runtime with model |
329 | | - base_runtime = AgentModelRuntime("gpt-4o-from-agent-json") |
330 | | - |
331 | | - # Simulate TelemetryRuntimeWrapper |
332 | | - telemetry_wrapper = WrapperRuntime(base_runtime) |
333 | | - |
334 | | - # Simulate UiPathResumableRuntime |
335 | | - resumable_runtime = WrapperRuntime(telemetry_wrapper) |
336 | | - |
337 | | - model = _find_agent_model_in_runtime(resumable_runtime) |
338 | | - assert model == "gpt-4o-from-agent-json" |
0 commit comments