pygeai 0.4.0b12__py3-none-any.whl → 0.6.0b3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pygeai/__init__.py +1 -1
- pygeai/auth/__init__.py +0 -0
- pygeai/auth/clients.py +55 -0
- pygeai/auth/endpoints.py +2 -0
- pygeai/cli/__init__.py +0 -1
- pygeai/cli/commands/auth.py +123 -0
- pygeai/cli/commands/base.py +22 -1
- pygeai/cli/commands/docs.py +105 -0
- pygeai/cli/texts/help.py +157 -24
- pygeai/core/base/session.py +1 -1
- pygeai/core/files/responses.py +4 -3
- pygeai/lab/clients.py +3 -3
- pygeai/lab/tools/clients.py +4 -4
- pygeai/tests/admin/test_clients.py +143 -0
- pygeai/tests/auth/__init__.py +0 -0
- pygeai/tests/auth/test_clients.py +105 -0
- pygeai/tests/cli/commands/lab/test_ai_lab.py +41 -35
- pygeai/tests/cli/commands/lab/test_spec.py +24 -56
- pygeai/tests/cli/commands/test_chat.py +21 -3
- pygeai/tests/cli/commands/test_evaluation.py +649 -0
- pygeai/tests/cli/commands/test_secrets.py +171 -0
- pygeai/tests/cli/docker/__init__.py +0 -0
- pygeai/tests/core/base/data/models.py +7 -0
- pygeai/tests/core/base/test_mappers.py +43 -11
- pygeai/tests/core/base/test_models.py +3 -1
- pygeai/tests/core/base/test_responses.py +53 -0
- pygeai/tests/core/common/test_config.py +2 -3
- pygeai/tests/core/files/test_mappers.py +137 -0
- pygeai/tests/core/plugins/__init__.py +0 -0
- pygeai/tests/core/plugins/test_clients.py +64 -0
- pygeai/tests/evaluation/__init__.py +0 -0
- pygeai/tests/evaluation/dataset/__init__.py +0 -0
- pygeai/tests/evaluation/dataset/test_clients.py +263 -0
- pygeai/tests/evaluation/plan/__init__.py +0 -0
- pygeai/tests/evaluation/plan/test_clients.py +193 -0
- pygeai/tests/evaluation/result/__init__.py +0 -0
- pygeai/tests/evaluation/result/test_clients.py +64 -0
- pygeai/tests/integration/assistants/rag/test_create_rag.py +24 -5
- pygeai/tests/integration/chat/test_generate_image.py +2 -6
- pygeai/tests/integration/lab/agents/test_agents_list.py +1 -1
- pygeai/tests/integration/lab/agents/test_create_agent.py +16 -10
- pygeai/tests/integration/lab/agents/test_create_sharing_link.py +5 -2
- pygeai/tests/integration/lab/agents/test_delete_agent.py +2 -2
- pygeai/tests/integration/lab/agents/test_get_agent.py +1 -1
- pygeai/tests/integration/lab/agents/test_publish_agent_revision.py +2 -2
- pygeai/tests/integration/lab/agents/test_update_agent.py +18 -21
- pygeai/tests/integration/lab/processes/__init__.py +0 -0
- pygeai/tests/integration/lab/processes/test_create_process.py +345 -0
- pygeai/tests/integration/lab/processes/test_create_task.py +211 -0
- pygeai/tests/integration/lab/processes/test_delete_process.py +111 -0
- pygeai/tests/integration/lab/processes/test_get_process.py +201 -0
- pygeai/tests/integration/lab/processes/test_list_process_instances.py +91 -0
- pygeai/tests/integration/lab/processes/test_list_processes.py +138 -0
- pygeai/tests/integration/lab/processes/test_publish_process_revision.py +232 -0
- pygeai/tests/integration/lab/processes/test_update_process.py +289 -0
- pygeai/tests/integration/lab/reasoning_strategies/__init__.py +0 -0
- pygeai/tests/integration/lab/reasoning_strategies/test_get_reasoning_strategy.py +70 -0
- pygeai/tests/integration/lab/reasoning_strategies/test_list_reasoning_strategies.py +93 -0
- pygeai/tests/integration/lab/reasoning_strategies/test_update_reasoning_strategy.py +149 -0
- pygeai/tests/integration/lab/tools/test_create_tool.py +13 -17
- pygeai/tests/integration/lab/tools/test_delete_tool.py +4 -4
- pygeai/tests/integration/lab/tools/test_get_parameter.py +1 -1
- pygeai/tests/integration/lab/tools/test_get_tool.py +4 -4
- pygeai/tests/integration/lab/tools/test_list_tools.py +1 -1
- pygeai/tests/integration/lab/tools/test_publish_tool_revision.py +1 -1
- pygeai/tests/integration/lab/tools/test_set_parameter.py +1 -1
- pygeai/tests/integration/lab/tools/test_update_tool.py +9 -10
- pygeai/tests/lab/agents/test_clients.py +17 -34
- pygeai/tests/lab/processes/test_clients.py +30 -93
- pygeai/tests/lab/processes/test_mappers.py +12 -71
- pygeai/tests/lab/strategies/test_clients.py +63 -63
- pygeai/tests/lab/test_managers.py +3 -6
- pygeai/tests/lab/test_models.py +9 -8
- pygeai/tests/lab/tools/test_clients.py +22 -45
- pygeai/tests/migration/test_strategies.py +16 -16
- pygeai/tests/organization/test_mappers.py +11 -4
- pygeai/tests/organization/test_responses.py +137 -0
- pygeai/tests/snippets/lab/agentic_flow_example_4.py +23 -23
- pygeai/tests/snippets/lab/samples/summarize_files.py +3 -3
- pygeai/tests/snippets/lab/use_cases/file_summarizer_example.py +3 -3
- pygeai/tests/snippets/lab/use_cases/file_summarizer_example_2.py +11 -11
- pygeai/tests/snippets/lab/use_cases/update_web_reader.py +1 -2
- {pygeai-0.4.0b12.dist-info → pygeai-0.6.0b3.dist-info}/METADATA +44 -16
- {pygeai-0.4.0b12.dist-info → pygeai-0.6.0b3.dist-info}/RECORD +88 -53
- {pygeai-0.4.0b12.dist-info → pygeai-0.6.0b3.dist-info}/WHEEL +0 -0
- {pygeai-0.4.0b12.dist-info → pygeai-0.6.0b3.dist-info}/entry_points.txt +0 -0
- {pygeai-0.4.0b12.dist-info → pygeai-0.6.0b3.dist-info}/licenses/LICENSE +0 -0
- {pygeai-0.4.0b12.dist-info → pygeai-0.6.0b3.dist-info}/top_level.txt +0 -0
|
@@ -15,11 +15,12 @@ class TestAgentClient(unittest.TestCase):
|
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
17
|
def setUp(self):
|
|
18
|
-
self.client = AgentClient()
|
|
19
18
|
self.project_id = "test-project-id"
|
|
19
|
+
self.client = AgentClient(api_key="test_key", base_url="https://test.url", project_id=self.project_id)
|
|
20
20
|
self.agent_id = "test-agent-id"
|
|
21
21
|
self.agent_data_prompt = {"instructions": "Do this task"}
|
|
22
22
|
self.agent_data_llm_config = {"maxTokens": 100, "timeout": 30}
|
|
23
|
+
self.agent_data_strategy_name = "default"
|
|
23
24
|
self.agent_data_models = [{"name": "gpt-4o"}]
|
|
24
25
|
self.agent_data_resource_pools = [{"name": "pool1", "tools": [{"name": "tool1"}]}]
|
|
25
26
|
|
|
@@ -30,7 +31,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
30
31
|
mock_response.json.return_value = expected_response
|
|
31
32
|
|
|
32
33
|
result = self.client.list_agents(
|
|
33
|
-
project_id=self.project_id,
|
|
34
34
|
status="active",
|
|
35
35
|
start=0,
|
|
36
36
|
count=10,
|
|
@@ -63,7 +63,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
63
63
|
mock_response.text = "Invalid JSON response"
|
|
64
64
|
|
|
65
65
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
66
|
-
self.client.list_agents(
|
|
66
|
+
self.client.list_agents()
|
|
67
67
|
|
|
68
68
|
self.assertEqual(str(context.exception), f"Unable to list agents for project {self.project_id}: Invalid JSON response")
|
|
69
69
|
mock_get.assert_called_once()
|
|
@@ -75,7 +75,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
75
75
|
mock_response.json.return_value = expected_response
|
|
76
76
|
|
|
77
77
|
result = self.client.create_agent(
|
|
78
|
-
project_id=self.project_id,
|
|
79
78
|
name="Test Agent",
|
|
80
79
|
access_scope="private",
|
|
81
80
|
public_name="test-agent",
|
|
@@ -84,6 +83,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
84
83
|
description="Agent Description",
|
|
85
84
|
agent_data_prompt=self.agent_data_prompt,
|
|
86
85
|
agent_data_llm_config=self.agent_data_llm_config,
|
|
86
|
+
agent_data_strategy_name=self.agent_data_strategy_name,
|
|
87
87
|
agent_data_models=self.agent_data_models,
|
|
88
88
|
agent_data_resource_pools=self.agent_data_resource_pools,
|
|
89
89
|
automatic_publish=True
|
|
@@ -116,7 +116,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
116
116
|
mock_response.json.return_value = expected_response
|
|
117
117
|
|
|
118
118
|
result = self.client.create_agent(
|
|
119
|
-
project_id=self.project_id,
|
|
120
119
|
name="Test Agent",
|
|
121
120
|
access_scope="private",
|
|
122
121
|
public_name="test-agent",
|
|
@@ -125,6 +124,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
125
124
|
description="Agent Description",
|
|
126
125
|
agent_data_prompt=self.agent_data_prompt,
|
|
127
126
|
agent_data_llm_config=self.agent_data_llm_config,
|
|
127
|
+
agent_data_strategy_name=self.agent_data_strategy_name,
|
|
128
128
|
agent_data_models=self.agent_data_models,
|
|
129
129
|
automatic_publish=False
|
|
130
130
|
)
|
|
@@ -137,7 +137,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
137
137
|
def test_create_agent_invalid_access_scope(self):
|
|
138
138
|
with self.assertRaises(ValueError) as context:
|
|
139
139
|
self.client.create_agent(
|
|
140
|
-
project_id=self.project_id,
|
|
141
140
|
name="Test Agent",
|
|
142
141
|
access_scope="invalid_scope",
|
|
143
142
|
public_name="test-agent",
|
|
@@ -146,6 +145,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
146
145
|
description="Agent Description",
|
|
147
146
|
agent_data_prompt=self.agent_data_prompt,
|
|
148
147
|
agent_data_llm_config=self.agent_data_llm_config,
|
|
148
|
+
agent_data_strategy_name=self.agent_data_strategy_name,
|
|
149
149
|
agent_data_models=self.agent_data_models
|
|
150
150
|
)
|
|
151
151
|
self.assertEqual(str(context.exception), f"Access scope must be one of {', '.join(VALID_ACCESS_SCOPES)}.")
|
|
@@ -159,7 +159,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
159
159
|
|
|
160
160
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
161
161
|
self.client.create_agent(
|
|
162
|
-
project_id=self.project_id,
|
|
163
162
|
name="Test Agent",
|
|
164
163
|
access_scope="private",
|
|
165
164
|
public_name="test-agent",
|
|
@@ -168,6 +167,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
168
167
|
description="Agent Description",
|
|
169
168
|
agent_data_prompt=self.agent_data_prompt,
|
|
170
169
|
agent_data_llm_config=self.agent_data_llm_config,
|
|
170
|
+
agent_data_strategy_name=self.agent_data_strategy_name,
|
|
171
171
|
agent_data_models=self.agent_data_models
|
|
172
172
|
)
|
|
173
173
|
|
|
@@ -181,7 +181,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
181
181
|
mock_response.json.return_value = expected_response
|
|
182
182
|
|
|
183
183
|
result = self.client.get_agent(
|
|
184
|
-
project_id=self.project_id,
|
|
185
184
|
agent_id=self.agent_id,
|
|
186
185
|
revision="1",
|
|
187
186
|
version=2,
|
|
@@ -201,14 +200,9 @@ class TestAgentClient(unittest.TestCase):
|
|
|
201
200
|
headers = mock_get.call_args[1]['headers']
|
|
202
201
|
self.assertEqual(headers['ProjectId'], self.project_id)
|
|
203
202
|
|
|
204
|
-
def test_get_agent_missing_project_id(self):
|
|
205
|
-
with self.assertRaises(MissingRequirementException) as context:
|
|
206
|
-
self.client.get_agent(project_id="", agent_id=self.agent_id)
|
|
207
|
-
self.assertEqual(str(context.exception), "Cannot retrieve agent without specifying project_id")
|
|
208
|
-
|
|
209
203
|
def test_get_agent_missing_agent_id(self):
|
|
210
204
|
with self.assertRaises(MissingRequirementException) as context:
|
|
211
|
-
self.client.get_agent(
|
|
205
|
+
self.client.get_agent(agent_id="")
|
|
212
206
|
self.assertEqual(str(context.exception), "agent_id must be specified in order to retrieve the agent")
|
|
213
207
|
|
|
214
208
|
@patch("pygeai.core.services.rest.ApiService.get")
|
|
@@ -219,7 +213,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
219
213
|
mock_response.text = "Invalid JSON response"
|
|
220
214
|
|
|
221
215
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
222
|
-
self.client.get_agent(
|
|
216
|
+
self.client.get_agent(agent_id=self.agent_id)
|
|
223
217
|
|
|
224
218
|
self.assertEqual(str(context.exception), f"Unable to retrieve agent {self.agent_id} for project {self.project_id}: Invalid JSON response")
|
|
225
219
|
mock_get.assert_called_once()
|
|
@@ -231,7 +225,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
231
225
|
mock_response.json.return_value = expected_response
|
|
232
226
|
|
|
233
227
|
result = self.client.create_sharing_link(
|
|
234
|
-
project_id=self.project_id,
|
|
235
228
|
agent_id=self.agent_id
|
|
236
229
|
)
|
|
237
230
|
|
|
@@ -244,14 +237,9 @@ class TestAgentClient(unittest.TestCase):
|
|
|
244
237
|
headers = mock_get.call_args[1]['headers']
|
|
245
238
|
self.assertEqual(headers['ProjectId'], self.project_id)
|
|
246
239
|
|
|
247
|
-
def test_create_sharing_link_missing_project_id(self):
|
|
248
|
-
with self.assertRaises(MissingRequirementException) as context:
|
|
249
|
-
self.client.create_sharing_link(project_id="", agent_id=self.agent_id)
|
|
250
|
-
self.assertEqual(str(context.exception), "Cannot create sharing link without specifying project_id")
|
|
251
|
-
|
|
252
240
|
def test_create_sharing_link_missing_agent_id(self):
|
|
253
241
|
with self.assertRaises(MissingRequirementException) as context:
|
|
254
|
-
self.client.create_sharing_link(
|
|
242
|
+
self.client.create_sharing_link(agent_id="")
|
|
255
243
|
self.assertEqual(str(context.exception), "agent_id must be specified in order to create sharing link")
|
|
256
244
|
|
|
257
245
|
@patch("pygeai.core.services.rest.ApiService.get")
|
|
@@ -263,7 +251,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
263
251
|
|
|
264
252
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
265
253
|
self.client.create_sharing_link(
|
|
266
|
-
project_id=self.project_id,
|
|
267
254
|
agent_id=self.agent_id
|
|
268
255
|
)
|
|
269
256
|
|
|
@@ -278,7 +265,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
278
265
|
mock_response.json.return_value = expected_response
|
|
279
266
|
|
|
280
267
|
result = self.client.publish_agent_revision(
|
|
281
|
-
project_id=self.project_id,
|
|
282
268
|
agent_id=self.agent_id,
|
|
283
269
|
revision=revision
|
|
284
270
|
)
|
|
@@ -302,7 +288,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
302
288
|
|
|
303
289
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
304
290
|
self.client.publish_agent_revision(
|
|
305
|
-
project_id=self.project_id,
|
|
306
291
|
agent_id=self.agent_id,
|
|
307
292
|
revision=revision
|
|
308
293
|
)
|
|
@@ -312,12 +297,11 @@ class TestAgentClient(unittest.TestCase):
|
|
|
312
297
|
|
|
313
298
|
@patch("pygeai.core.services.rest.ApiService.delete")
|
|
314
299
|
def test_delete_agent_success(self, mock_delete):
|
|
315
|
-
expected_response = {
|
|
300
|
+
expected_response = {}
|
|
316
301
|
mock_response = mock_delete.return_value
|
|
317
|
-
mock_response.
|
|
302
|
+
mock_response.status_code = 204
|
|
318
303
|
|
|
319
304
|
result = self.client.delete_agent(
|
|
320
|
-
project_id=self.project_id,
|
|
321
305
|
agent_id=self.agent_id
|
|
322
306
|
)
|
|
323
307
|
|
|
@@ -339,7 +323,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
339
323
|
|
|
340
324
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
341
325
|
self.client.delete_agent(
|
|
342
|
-
project_id=self.project_id,
|
|
343
326
|
agent_id=self.agent_id
|
|
344
327
|
)
|
|
345
328
|
|
|
@@ -353,7 +336,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
353
336
|
mock_response.json.return_value = expected_response
|
|
354
337
|
|
|
355
338
|
result = self.client.update_agent(
|
|
356
|
-
project_id=self.project_id,
|
|
357
339
|
agent_id=self.agent_id,
|
|
358
340
|
name="Updated Agent",
|
|
359
341
|
access_scope="public",
|
|
@@ -363,6 +345,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
363
345
|
description="Updated Description",
|
|
364
346
|
agent_data_prompt=self.agent_data_prompt,
|
|
365
347
|
agent_data_llm_config=self.agent_data_llm_config,
|
|
348
|
+
agent_data_strategy_name=self.agent_data_strategy_name,
|
|
366
349
|
agent_data_models=self.agent_data_models,
|
|
367
350
|
agent_data_resource_pools=self.agent_data_resource_pools,
|
|
368
351
|
automatic_publish=True,
|
|
@@ -396,7 +379,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
396
379
|
mock_response.json.return_value = expected_response
|
|
397
380
|
|
|
398
381
|
result = self.client.update_agent(
|
|
399
|
-
project_id=self.project_id,
|
|
400
382
|
agent_id=self.agent_id,
|
|
401
383
|
name="Upserted Agent",
|
|
402
384
|
access_scope="private",
|
|
@@ -406,6 +388,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
406
388
|
description="Upserted Description",
|
|
407
389
|
agent_data_prompt=self.agent_data_prompt,
|
|
408
390
|
agent_data_llm_config=self.agent_data_llm_config,
|
|
391
|
+
agent_data_strategy_name=self.agent_data_strategy_name,
|
|
409
392
|
agent_data_models=self.agent_data_models,
|
|
410
393
|
automatic_publish=False,
|
|
411
394
|
upsert=True
|
|
@@ -425,7 +408,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
425
408
|
mock_response.json.return_value = expected_response
|
|
426
409
|
|
|
427
410
|
result = self.client.update_agent(
|
|
428
|
-
project_id=self.project_id,
|
|
429
411
|
agent_id=self.agent_id,
|
|
430
412
|
name="Updated Agent No Pools",
|
|
431
413
|
access_scope="private",
|
|
@@ -435,6 +417,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
435
417
|
description="Updated Description",
|
|
436
418
|
agent_data_prompt=self.agent_data_prompt,
|
|
437
419
|
agent_data_llm_config=self.agent_data_llm_config,
|
|
420
|
+
agent_data_strategy_name=self.agent_data_strategy_name,
|
|
438
421
|
agent_data_models=self.agent_data_models,
|
|
439
422
|
automatic_publish=False,
|
|
440
423
|
upsert=False
|
|
@@ -448,7 +431,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
448
431
|
def test_update_agent_invalid_access_scope(self):
|
|
449
432
|
with self.assertRaises(ValueError) as context:
|
|
450
433
|
self.client.update_agent(
|
|
451
|
-
project_id=self.project_id,
|
|
452
434
|
agent_id=self.agent_id,
|
|
453
435
|
name="Updated Agent",
|
|
454
436
|
access_scope="invalid_scope",
|
|
@@ -458,6 +440,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
458
440
|
description="Updated Description",
|
|
459
441
|
agent_data_prompt=self.agent_data_prompt,
|
|
460
442
|
agent_data_llm_config=self.agent_data_llm_config,
|
|
443
|
+
agent_data_strategy_name=self.agent_data_strategy_name,
|
|
461
444
|
agent_data_models=self.agent_data_models
|
|
462
445
|
)
|
|
463
446
|
self.assertEqual(str(context.exception), f"Access scope must be one of {', '.join(VALID_ACCESS_SCOPES)}.")
|
|
@@ -471,7 +454,6 @@ class TestAgentClient(unittest.TestCase):
|
|
|
471
454
|
|
|
472
455
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
473
456
|
self.client.update_agent(
|
|
474
|
-
project_id=self.project_id,
|
|
475
457
|
agent_id=self.agent_id,
|
|
476
458
|
name="Updated Agent",
|
|
477
459
|
access_scope="private",
|
|
@@ -481,6 +463,7 @@ class TestAgentClient(unittest.TestCase):
|
|
|
481
463
|
description="Updated Description",
|
|
482
464
|
agent_data_prompt=self.agent_data_prompt,
|
|
483
465
|
agent_data_llm_config=self.agent_data_llm_config,
|
|
466
|
+
agent_data_strategy_name=self.agent_data_strategy_name,
|
|
484
467
|
agent_data_models=self.agent_data_models
|
|
485
468
|
)
|
|
486
469
|
|