pygeai 0.6.0b6__py3-none-any.whl → 0.6.0b10__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.
Files changed (227) hide show
  1. pygeai/_docs/source/conf.py +78 -6
  2. pygeai/_docs/source/content/api_reference/admin.rst +161 -0
  3. pygeai/_docs/source/content/api_reference/assistant.rst +326 -0
  4. pygeai/_docs/source/content/api_reference/auth.rst +379 -0
  5. pygeai/_docs/source/content/api_reference/embeddings.rst +31 -1
  6. pygeai/_docs/source/content/api_reference/evaluation.rst +590 -0
  7. pygeai/_docs/source/content/api_reference/feedback.rst +237 -0
  8. pygeai/_docs/source/content/api_reference/files.rst +592 -0
  9. pygeai/_docs/source/content/api_reference/gam.rst +401 -0
  10. pygeai/_docs/source/content/api_reference/health.rst +58 -0
  11. pygeai/_docs/source/content/api_reference/project.rst +20 -18
  12. pygeai/_docs/source/content/api_reference/proxy.rst +318 -0
  13. pygeai/_docs/source/content/api_reference/rerank.rst +94 -0
  14. pygeai/_docs/source/content/api_reference/secrets.rst +495 -0
  15. pygeai/_docs/source/content/api_reference/usage_limits.rst +390 -0
  16. pygeai/_docs/source/content/api_reference.rst +13 -1
  17. pygeai/_docs/source/content/debugger.rst +376 -83
  18. pygeai/_docs/source/content/migration.rst +528 -0
  19. pygeai/_docs/source/content/modules.rst +1 -1
  20. pygeai/_docs/source/index.rst +59 -7
  21. pygeai/_docs/source/pygeai.auth.rst +29 -0
  22. pygeai/_docs/source/pygeai.cli.commands.rst +16 -0
  23. pygeai/_docs/source/pygeai.cli.rst +8 -0
  24. pygeai/_docs/source/pygeai.core.utils.rst +16 -0
  25. pygeai/_docs/source/pygeai.rst +1 -0
  26. pygeai/_docs/source/pygeai.tests.auth.rst +21 -0
  27. pygeai/_docs/source/pygeai.tests.cli.commands.rst +16 -0
  28. pygeai/_docs/source/pygeai.tests.cli.rst +16 -0
  29. pygeai/_docs/source/pygeai.tests.core.base.rst +8 -0
  30. pygeai/_docs/source/pygeai.tests.core.embeddings.rst +16 -0
  31. pygeai/_docs/source/pygeai.tests.core.files.rst +8 -0
  32. pygeai/_docs/source/pygeai.tests.core.plugins.rst +21 -0
  33. pygeai/_docs/source/pygeai.tests.core.rst +1 -0
  34. pygeai/_docs/source/pygeai.tests.evaluation.dataset.rst +21 -0
  35. pygeai/_docs/source/pygeai.tests.evaluation.plan.rst +21 -0
  36. pygeai/_docs/source/pygeai.tests.evaluation.result.rst +21 -0
  37. pygeai/_docs/source/pygeai.tests.evaluation.rst +20 -0
  38. pygeai/_docs/source/pygeai.tests.integration.lab.processes.rst +8 -0
  39. pygeai/_docs/source/pygeai.tests.organization.rst +8 -0
  40. pygeai/_docs/source/pygeai.tests.rst +2 -0
  41. pygeai/_docs/source/pygeai.tests.snippets.auth.rst +10 -0
  42. pygeai/_docs/source/pygeai.tests.snippets.chat.rst +40 -0
  43. pygeai/_docs/source/pygeai.tests.snippets.dbg.rst +45 -0
  44. pygeai/_docs/source/pygeai.tests.snippets.embeddings.rst +40 -0
  45. pygeai/_docs/source/pygeai.tests.snippets.evaluation.dataset.rst +197 -0
  46. pygeai/_docs/source/pygeai.tests.snippets.evaluation.plan.rst +133 -0
  47. pygeai/_docs/source/pygeai.tests.snippets.evaluation.result.rst +37 -0
  48. pygeai/_docs/source/pygeai.tests.snippets.evaluation.rst +10 -0
  49. pygeai/_docs/source/pygeai.tests.snippets.organization.rst +40 -0
  50. pygeai/_docs/source/pygeai.tests.snippets.rst +2 -0
  51. pygeai/admin/clients.py +12 -32
  52. pygeai/assistant/clients.py +16 -44
  53. pygeai/assistant/data/clients.py +1 -0
  54. pygeai/assistant/data_analyst/clients.py +6 -13
  55. pygeai/assistant/rag/clients.py +24 -67
  56. pygeai/auth/clients.py +88 -14
  57. pygeai/auth/endpoints.py +4 -0
  58. pygeai/chat/clients.py +192 -25
  59. pygeai/chat/endpoints.py +2 -1
  60. pygeai/cli/commands/auth.py +178 -2
  61. pygeai/cli/commands/chat.py +227 -1
  62. pygeai/cli/commands/embeddings.py +56 -8
  63. pygeai/cli/commands/lab/ai_lab.py +0 -2
  64. pygeai/cli/commands/migrate.py +994 -434
  65. pygeai/cli/commands/organization.py +241 -0
  66. pygeai/cli/error_handler.py +116 -0
  67. pygeai/cli/geai.py +28 -10
  68. pygeai/cli/parsers.py +8 -2
  69. pygeai/core/base/clients.py +4 -1
  70. pygeai/core/common/exceptions.py +11 -10
  71. pygeai/core/embeddings/__init__.py +19 -0
  72. pygeai/core/embeddings/clients.py +20 -9
  73. pygeai/core/embeddings/mappers.py +16 -2
  74. pygeai/core/embeddings/responses.py +9 -2
  75. pygeai/core/feedback/clients.py +4 -8
  76. pygeai/core/files/clients.py +10 -25
  77. pygeai/core/files/managers.py +42 -0
  78. pygeai/core/llm/clients.py +11 -26
  79. pygeai/core/models.py +107 -0
  80. pygeai/core/plugins/clients.py +4 -7
  81. pygeai/core/rerank/clients.py +4 -8
  82. pygeai/core/secrets/clients.py +14 -37
  83. pygeai/core/services/rest.py +1 -1
  84. pygeai/core/utils/parsers.py +32 -0
  85. pygeai/core/utils/validators.py +10 -0
  86. pygeai/dbg/__init__.py +3 -0
  87. pygeai/dbg/debugger.py +565 -70
  88. pygeai/evaluation/clients.py +2 -1
  89. pygeai/evaluation/dataset/clients.py +46 -44
  90. pygeai/evaluation/plan/clients.py +28 -26
  91. pygeai/evaluation/result/clients.py +38 -5
  92. pygeai/gam/clients.py +10 -25
  93. pygeai/health/clients.py +4 -7
  94. pygeai/lab/agents/clients.py +21 -54
  95. pygeai/lab/agents/endpoints.py +2 -0
  96. pygeai/lab/clients.py +1 -0
  97. pygeai/lab/models.py +3 -3
  98. pygeai/lab/processes/clients.py +45 -127
  99. pygeai/lab/strategies/clients.py +11 -25
  100. pygeai/lab/tools/clients.py +23 -67
  101. pygeai/lab/tools/endpoints.py +3 -0
  102. pygeai/migration/__init__.py +31 -0
  103. pygeai/migration/strategies.py +404 -155
  104. pygeai/migration/tools.py +170 -3
  105. pygeai/organization/clients.py +135 -51
  106. pygeai/organization/endpoints.py +6 -1
  107. pygeai/organization/limits/clients.py +32 -91
  108. pygeai/organization/managers.py +157 -1
  109. pygeai/organization/mappers.py +76 -2
  110. pygeai/organization/responses.py +25 -1
  111. pygeai/proxy/clients.py +4 -1
  112. pygeai/tests/admin/test_clients.py +16 -11
  113. pygeai/tests/assistants/rag/test_clients.py +35 -23
  114. pygeai/tests/assistants/test_clients.py +22 -15
  115. pygeai/tests/auth/test_clients.py +191 -7
  116. pygeai/tests/chat/test_clients.py +211 -1
  117. pygeai/tests/cli/commands/test_embeddings.py +32 -9
  118. pygeai/tests/cli/commands/test_evaluation.py +7 -0
  119. pygeai/tests/cli/commands/test_migrate.py +112 -243
  120. pygeai/tests/cli/test_error_handler.py +225 -0
  121. pygeai/tests/cli/test_geai_driver.py +154 -0
  122. pygeai/tests/cli/test_parsers.py +5 -5
  123. pygeai/tests/core/embeddings/test_clients.py +144 -0
  124. pygeai/tests/core/embeddings/test_managers.py +171 -0
  125. pygeai/tests/core/embeddings/test_mappers.py +142 -0
  126. pygeai/tests/core/feedback/test_clients.py +2 -0
  127. pygeai/tests/core/files/test_clients.py +1 -0
  128. pygeai/tests/core/llm/test_clients.py +14 -9
  129. pygeai/tests/core/plugins/test_clients.py +5 -3
  130. pygeai/tests/core/rerank/test_clients.py +1 -0
  131. pygeai/tests/core/secrets/test_clients.py +19 -13
  132. pygeai/tests/dbg/test_debugger.py +453 -75
  133. pygeai/tests/evaluation/dataset/test_clients.py +3 -1
  134. pygeai/tests/evaluation/plan/test_clients.py +4 -2
  135. pygeai/tests/evaluation/result/test_clients.py +7 -5
  136. pygeai/tests/gam/test_clients.py +1 -1
  137. pygeai/tests/health/test_clients.py +1 -0
  138. pygeai/tests/lab/agents/test_clients.py +9 -0
  139. pygeai/tests/lab/processes/test_clients.py +36 -0
  140. pygeai/tests/lab/processes/test_mappers.py +3 -0
  141. pygeai/tests/lab/strategies/test_clients.py +14 -9
  142. pygeai/tests/migration/test_strategies.py +45 -218
  143. pygeai/tests/migration/test_tools.py +133 -9
  144. pygeai/tests/organization/limits/test_clients.py +17 -0
  145. pygeai/tests/organization/test_clients.py +206 -1
  146. pygeai/tests/organization/test_managers.py +122 -1
  147. pygeai/tests/proxy/test_clients.py +2 -0
  148. pygeai/tests/proxy/test_integration.py +1 -0
  149. pygeai/tests/snippets/auth/__init__.py +0 -0
  150. pygeai/tests/snippets/chat/chat_completion_with_reasoning_effort.py +18 -0
  151. pygeai/tests/snippets/chat/get_response.py +15 -0
  152. pygeai/tests/snippets/chat/get_response_streaming.py +20 -0
  153. pygeai/tests/snippets/chat/get_response_with_files.py +16 -0
  154. pygeai/tests/snippets/chat/get_response_with_tools.py +36 -0
  155. pygeai/tests/snippets/dbg/__init__.py +0 -0
  156. pygeai/tests/snippets/dbg/basic_debugging.py +32 -0
  157. pygeai/tests/snippets/dbg/breakpoint_management.py +48 -0
  158. pygeai/tests/snippets/dbg/stack_navigation.py +45 -0
  159. pygeai/tests/snippets/dbg/stepping_example.py +40 -0
  160. pygeai/tests/snippets/embeddings/cache_example.py +31 -0
  161. pygeai/tests/snippets/embeddings/cohere_example.py +41 -0
  162. pygeai/tests/snippets/embeddings/openai_base64_example.py +27 -0
  163. pygeai/tests/snippets/embeddings/openai_example.py +30 -0
  164. pygeai/tests/snippets/embeddings/similarity_example.py +42 -0
  165. pygeai/tests/snippets/evaluation/dataset/__init__.py +0 -0
  166. pygeai/tests/snippets/evaluation/dataset/complete_workflow_example.py +195 -0
  167. pygeai/tests/snippets/evaluation/dataset/create_dataset.py +26 -0
  168. pygeai/tests/snippets/evaluation/dataset/create_dataset_from_file.py +11 -0
  169. pygeai/tests/snippets/evaluation/dataset/create_dataset_row.py +17 -0
  170. pygeai/tests/snippets/evaluation/dataset/create_expected_source.py +18 -0
  171. pygeai/tests/snippets/evaluation/dataset/create_filter_variable.py +19 -0
  172. pygeai/tests/snippets/evaluation/dataset/delete_dataset.py +9 -0
  173. pygeai/tests/snippets/evaluation/dataset/delete_dataset_row.py +10 -0
  174. pygeai/tests/snippets/evaluation/dataset/delete_expected_source.py +15 -0
  175. pygeai/tests/snippets/evaluation/dataset/delete_filter_variable.py +15 -0
  176. pygeai/tests/snippets/evaluation/dataset/get_dataset.py +9 -0
  177. pygeai/tests/snippets/evaluation/dataset/get_dataset_row.py +10 -0
  178. pygeai/tests/snippets/evaluation/dataset/get_expected_source.py +15 -0
  179. pygeai/tests/snippets/evaluation/dataset/get_filter_variable.py +15 -0
  180. pygeai/tests/snippets/evaluation/dataset/list_dataset_rows.py +9 -0
  181. pygeai/tests/snippets/evaluation/dataset/list_datasets.py +6 -0
  182. pygeai/tests/snippets/evaluation/dataset/list_expected_sources.py +10 -0
  183. pygeai/tests/snippets/evaluation/dataset/list_filter_variables.py +10 -0
  184. pygeai/tests/snippets/evaluation/dataset/update_dataset.py +15 -0
  185. pygeai/tests/snippets/evaluation/dataset/update_dataset_row.py +20 -0
  186. pygeai/tests/snippets/evaluation/dataset/update_expected_source.py +18 -0
  187. pygeai/tests/snippets/evaluation/dataset/update_filter_variable.py +19 -0
  188. pygeai/tests/snippets/evaluation/dataset/upload_dataset_rows_file.py +10 -0
  189. pygeai/tests/snippets/evaluation/plan/__init__.py +0 -0
  190. pygeai/tests/snippets/evaluation/plan/add_plan_system_metric.py +13 -0
  191. pygeai/tests/snippets/evaluation/plan/complete_workflow_example.py +136 -0
  192. pygeai/tests/snippets/evaluation/plan/create_evaluation_plan.py +24 -0
  193. pygeai/tests/snippets/evaluation/plan/create_rag_evaluation_plan.py +22 -0
  194. pygeai/tests/snippets/evaluation/plan/delete_evaluation_plan.py +9 -0
  195. pygeai/tests/snippets/evaluation/plan/delete_plan_system_metric.py +13 -0
  196. pygeai/tests/snippets/evaluation/plan/execute_evaluation_plan.py +11 -0
  197. pygeai/tests/snippets/evaluation/plan/get_evaluation_plan.py +9 -0
  198. pygeai/tests/snippets/evaluation/plan/get_plan_system_metric.py +13 -0
  199. pygeai/tests/snippets/evaluation/plan/get_system_metric.py +9 -0
  200. pygeai/tests/snippets/evaluation/plan/list_evaluation_plans.py +7 -0
  201. pygeai/tests/snippets/evaluation/plan/list_plan_system_metrics.py +9 -0
  202. pygeai/tests/snippets/evaluation/plan/list_system_metrics.py +7 -0
  203. pygeai/tests/snippets/evaluation/plan/update_evaluation_plan.py +22 -0
  204. pygeai/tests/snippets/evaluation/plan/update_plan_system_metric.py +14 -0
  205. pygeai/tests/snippets/evaluation/result/__init__.py +0 -0
  206. pygeai/tests/snippets/evaluation/result/complete_workflow_example.py +150 -0
  207. pygeai/tests/snippets/evaluation/result/get_evaluation_result.py +26 -0
  208. pygeai/tests/snippets/evaluation/result/list_evaluation_results.py +17 -0
  209. pygeai/tests/snippets/migrate/__init__.py +45 -0
  210. pygeai/tests/snippets/migrate/agent_migration.py +110 -0
  211. pygeai/tests/snippets/migrate/assistant_migration.py +64 -0
  212. pygeai/tests/snippets/migrate/orchestrator_examples.py +179 -0
  213. pygeai/tests/snippets/migrate/process_migration.py +64 -0
  214. pygeai/tests/snippets/migrate/project_migration.py +42 -0
  215. pygeai/tests/snippets/migrate/tool_migration.py +64 -0
  216. pygeai/tests/snippets/organization/create_project.py +2 -2
  217. pygeai/tests/snippets/organization/get_memberships.py +12 -0
  218. pygeai/tests/snippets/organization/get_organization_members.py +6 -0
  219. pygeai/tests/snippets/organization/get_project_members.py +6 -0
  220. pygeai/tests/snippets/organization/get_project_memberships.py +12 -0
  221. pygeai/tests/snippets/organization/get_project_roles.py +6 -0
  222. {pygeai-0.6.0b6.dist-info → pygeai-0.6.0b10.dist-info}/METADATA +1 -1
  223. {pygeai-0.6.0b6.dist-info → pygeai-0.6.0b10.dist-info}/RECORD +227 -124
  224. {pygeai-0.6.0b6.dist-info → pygeai-0.6.0b10.dist-info}/WHEEL +0 -0
  225. {pygeai-0.6.0b6.dist-info → pygeai-0.6.0b10.dist-info}/entry_points.txt +0 -0
  226. {pygeai-0.6.0b6.dist-info → pygeai-0.6.0b10.dist-info}/licenses/LICENSE +0 -0
  227. {pygeai-0.6.0b6.dist-info → pygeai-0.6.0b10.dist-info}/top_level.txt +0 -0
@@ -2,6 +2,7 @@ import unittest
2
2
  from unittest.mock import patch, MagicMock
3
3
 
4
4
  from pygeai.evaluation.result.clients import EvaluationResultClient
5
+ from pygeai.core.base.session import Session
5
6
 
6
7
 
7
8
  class TestEvaluationResultClient(unittest.TestCase):
@@ -10,12 +11,13 @@ class TestEvaluationResultClient(unittest.TestCase):
10
11
  """
11
12
 
12
13
  def setUp(self):
13
- self.client = EvaluationResultClient()
14
+ self.client = EvaluationResultClient(api_key="test-key", base_url="http://test.com", eval_url="http://eval.com")
14
15
  self.mock_response = MagicMock()
16
+ self.mock_response.status_code = 200
15
17
 
16
18
  @patch('pygeai.core.services.rest.ApiService.get')
17
19
  def test_list_evaluation_results_success(self, mock_get):
18
- self.mock_response.content = b'[{"id": "result-1", "status": "completed"}, {"id": "result-2", "status": "pending"}]'
20
+ self.mock_response.json.return_value = [{"id": "result-1", "status": "completed"}, {"id": "result-2", "status": "pending"}]
19
21
  mock_get.return_value = self.mock_response
20
22
 
21
23
  result = self.client.list_evaluation_results("plan-123")
@@ -27,7 +29,7 @@ class TestEvaluationResultClient(unittest.TestCase):
27
29
 
28
30
  @patch('pygeai.core.services.rest.ApiService.get')
29
31
  def test_list_evaluation_results_empty(self, mock_get):
30
- self.mock_response.content = b'[]'
32
+ self.mock_response.json.return_value = []
31
33
  mock_get.return_value = self.mock_response
32
34
 
33
35
  result = self.client.list_evaluation_results("plan-456")
@@ -37,7 +39,7 @@ class TestEvaluationResultClient(unittest.TestCase):
37
39
 
38
40
  @patch('pygeai.core.services.rest.ApiService.get')
39
41
  def test_get_evaluation_result_success(self, mock_get):
40
- self.mock_response.content = b'{"id": "result-123", "status": "completed", "score": 0.95}'
42
+ self.mock_response.json.return_value = {"id": "result-123", "status": "completed", "score": 0.95}
41
43
  mock_get.return_value = self.mock_response
42
44
 
43
45
  result = self.client.get_evaluation_result("result-123")
@@ -49,7 +51,7 @@ class TestEvaluationResultClient(unittest.TestCase):
49
51
 
50
52
  @patch('pygeai.core.services.rest.ApiService.get')
51
53
  def test_get_evaluation_result_with_details(self, mock_get):
52
- self.mock_response.content = b'{"id": "result-789", "status": "failed", "error": "Test error"}'
54
+ self.mock_response.json.return_value = {"id": "result-789", "status": "failed", "error": "Test error"}
53
55
  mock_get.return_value = self.mock_response
54
56
 
55
57
  result = self.client.get_evaluation_result("result-789")
@@ -15,7 +15,7 @@ class TestGAMClient(unittest.TestCase):
15
15
  self.mock_response = MagicMock()
16
16
  self.mock_response.json.return_value = {"status": "success"}
17
17
  self.mock_response.text = "success text"
18
- self.mock_response.status_code = 500
18
+ self.mock_response.status_code = 200
19
19
  self.client.api_service.base_url = "https://api.example.com"
20
20
 
21
21
  def test_generate_signing_url_success(self):
@@ -20,6 +20,7 @@ class TestHealthClient(unittest.TestCase):
20
20
  expected_response = {"status": "healthy", "version": "1.0.0"}
21
21
  mock_response = mock_get.return_value
22
22
  mock_response.json.return_value = expected_response
23
+ mock_response.status_code = 200
23
24
 
24
25
  result = self.client.check_api_status()
25
26
 
@@ -29,6 +29,7 @@ class TestAgentClient(unittest.TestCase):
29
29
  expected_response = {"agents": [{"id": "agent-1", "name": "Agent1"}]}
30
30
  mock_response = mock_get.return_value
31
31
  mock_response.json.return_value = expected_response
32
+ mock_response.status_code = 200
32
33
 
33
34
  result = self.client.list_agents(
34
35
  status="active",
@@ -73,6 +74,7 @@ class TestAgentClient(unittest.TestCase):
73
74
  expected_response = {"id": "agent-123", "name": "Test Agent"}
74
75
  mock_response = mock_post.return_value
75
76
  mock_response.json.return_value = expected_response
77
+ mock_response.status_code = 200
76
78
 
77
79
  result = self.client.create_agent(
78
80
  name="Test Agent",
@@ -114,6 +116,7 @@ class TestAgentClient(unittest.TestCase):
114
116
  expected_response = {"id": "agent-123", "name": "Test Agent"}
115
117
  mock_response = mock_post.return_value
116
118
  mock_response.json.return_value = expected_response
119
+ mock_response.status_code = 200
117
120
 
118
121
  result = self.client.create_agent(
119
122
  name="Test Agent",
@@ -179,6 +182,7 @@ class TestAgentClient(unittest.TestCase):
179
182
  expected_response = {"id": self.agent_id, "name": "Test Agent"}
180
183
  mock_response = mock_get.return_value
181
184
  mock_response.json.return_value = expected_response
185
+ mock_response.status_code = 200
182
186
 
183
187
  result = self.client.get_agent(
184
188
  agent_id=self.agent_id,
@@ -223,6 +227,7 @@ class TestAgentClient(unittest.TestCase):
223
227
  expected_response = {"link": "http://example.com/share"}
224
228
  mock_response = mock_get.return_value
225
229
  mock_response.json.return_value = expected_response
230
+ mock_response.status_code = 200
226
231
 
227
232
  result = self.client.create_sharing_link(
228
233
  agent_id=self.agent_id
@@ -263,6 +268,7 @@ class TestAgentClient(unittest.TestCase):
263
268
  expected_response = {"status": "published"}
264
269
  mock_response = mock_post.return_value
265
270
  mock_response.json.return_value = expected_response
271
+ mock_response.status_code = 200
266
272
 
267
273
  result = self.client.publish_agent_revision(
268
274
  agent_id=self.agent_id,
@@ -334,6 +340,7 @@ class TestAgentClient(unittest.TestCase):
334
340
  expected_response = {"id": self.agent_id, "name": "Updated Agent"}
335
341
  mock_response = mock_put.return_value
336
342
  mock_response.json.return_value = expected_response
343
+ mock_response.status_code = 200
337
344
 
338
345
  result = self.client.update_agent(
339
346
  agent_id=self.agent_id,
@@ -377,6 +384,7 @@ class TestAgentClient(unittest.TestCase):
377
384
  expected_response = {"id": self.agent_id, "name": "Upserted Agent"}
378
385
  mock_response = mock_put.return_value
379
386
  mock_response.json.return_value = expected_response
387
+ mock_response.status_code = 200
380
388
 
381
389
  result = self.client.update_agent(
382
390
  agent_id=self.agent_id,
@@ -406,6 +414,7 @@ class TestAgentClient(unittest.TestCase):
406
414
  expected_response = {"id": self.agent_id, "name": "Updated Agent No Pools"}
407
415
  mock_response = mock_put.return_value
408
416
  mock_response.json.return_value = expected_response
417
+ mock_response.status_code = 200
409
418
 
410
419
  result = self.client.update_agent(
411
420
  agent_id=self.agent_id,
@@ -35,6 +35,7 @@ class TestAgenticProcessClient(unittest.TestCase):
35
35
  expected_response = {"id": "process-123", "name": "Test Process"}
36
36
  mock_response = mock_post.return_value
37
37
  mock_response.json.return_value = expected_response
38
+ mock_response.status_code = 200
38
39
 
39
40
  result = self.client.create_process(
40
41
  key="test-key",
@@ -94,6 +95,7 @@ class TestAgenticProcessClient(unittest.TestCase):
94
95
  expected_response = {"id": self.process_id, "name": "Updated Process"}
95
96
  mock_response_put = mock_put.return_value
96
97
  mock_response_put.json.return_value = expected_response
98
+ mock_response_put.status_code = 200
97
99
 
98
100
  mock_response_get = mock_get.return_value
99
101
  mock_response_get.json.return_value = {
@@ -102,6 +104,7 @@ class TestAgenticProcessClient(unittest.TestCase):
102
104
  "agenticActivities": [{"name": "current-activity"}]
103
105
  }
104
106
  }
107
+ mock_response_get.status_code = 200
105
108
 
106
109
  result = self.client.update_process(
107
110
  process_id=self.process_id,
@@ -130,6 +133,7 @@ class TestAgenticProcessClient(unittest.TestCase):
130
133
  expected_response = {"id": "process-123", "name": "Updated Process"}
131
134
  mock_response_put = mock_put.return_value
132
135
  mock_response_put.json.return_value = expected_response
136
+ mock_response_put.status_code = 200
133
137
 
134
138
  mock_response_get = mock_get.return_value
135
139
  mock_response_get.json.return_value = {
@@ -138,6 +142,7 @@ class TestAgenticProcessClient(unittest.TestCase):
138
142
  "agenticActivities": [{"name": "current-activity"}]
139
143
  }
140
144
  }
145
+ mock_response_get.status_code = 200
141
146
 
142
147
  result = self.client.update_process(
143
148
  name=self.process_name,
@@ -160,6 +165,7 @@ class TestAgenticProcessClient(unittest.TestCase):
160
165
  expected_response = {"id": self.process_id, "name": "Upserted Process"}
161
166
  mock_response = mock_put.return_value
162
167
  mock_response.json.return_value = expected_response
168
+ mock_response.status_code = 200
163
169
 
164
170
  result = self.client.update_process(
165
171
  process_id=self.process_id,
@@ -194,6 +200,7 @@ class TestAgenticProcessClient(unittest.TestCase):
194
200
  "agenticActivities": [{"name": "current-activity"}]
195
201
  }
196
202
  }
203
+ mock_response_get.status_code = 200
197
204
 
198
205
  with self.assertRaises(InvalidAPIResponseException) as context:
199
206
  self.client.update_process(
@@ -211,6 +218,7 @@ class TestAgenticProcessClient(unittest.TestCase):
211
218
  expected_response = {"id": self.process_id, "name": "Test Process"}
212
219
  mock_response = mock_get.return_value
213
220
  mock_response.json.return_value = expected_response
221
+ mock_response.status_code = 200
214
222
 
215
223
  result = self.client.get_process(
216
224
  process_id=self.process_id,
@@ -237,6 +245,7 @@ class TestAgenticProcessClient(unittest.TestCase):
237
245
  expected_response = {"id": "process-123", "name": self.process_name}
238
246
  mock_response = mock_get.return_value
239
247
  mock_response.json.return_value = expected_response
248
+ mock_response.status_code = 200
240
249
 
241
250
  result = self.client.get_process(
242
251
  process_name=self.process_name
@@ -274,6 +283,7 @@ class TestAgenticProcessClient(unittest.TestCase):
274
283
  expected_response = {"processes": [{"id": "process-1", "name": "Process1"}]}
275
284
  mock_response = mock_get.return_value
276
285
  mock_response.json.return_value = expected_response
286
+ mock_response.status_code = 200
277
287
 
278
288
  result = self.client.list_processes(
279
289
  id="process-1",
@@ -318,6 +328,7 @@ class TestAgenticProcessClient(unittest.TestCase):
318
328
  expected_response = {"instances": [{"id": "instance-1"}]}
319
329
  mock_response = mock_get.return_value
320
330
  mock_response.json.return_value = expected_response
331
+ mock_response.status_code = 200
321
332
 
322
333
  result = self.client.list_process_instances(
323
334
  process_id=self.process_id,
@@ -418,6 +429,7 @@ class TestAgenticProcessClient(unittest.TestCase):
418
429
  expected_response = {"status": "published"}
419
430
  mock_response = mock_post.return_value
420
431
  mock_response.json.return_value = expected_response
432
+ mock_response.status_code = 200
421
433
 
422
434
  result = self.client.publish_process_revision(
423
435
  process_id=self.process_id,
@@ -438,6 +450,7 @@ class TestAgenticProcessClient(unittest.TestCase):
438
450
  expected_response = {"status": "published"}
439
451
  mock_response = mock_post.return_value
440
452
  mock_response.json.return_value = expected_response
453
+ mock_response.status_code = 200
441
454
 
442
455
  result = self.client.publish_process_revision(
443
456
  process_name=self.process_name,
@@ -486,6 +499,7 @@ class TestAgenticProcessClient(unittest.TestCase):
486
499
  expected_response = {"id": "task-123", "name": "Test Task"}
487
500
  mock_response = mock_post.return_value
488
501
  mock_response.json.return_value = expected_response
502
+ mock_response.status_code = 200
489
503
 
490
504
  result = self.client.create_task(
491
505
  name="Test Task",
@@ -533,6 +547,7 @@ class TestAgenticProcessClient(unittest.TestCase):
533
547
  expected_response = {"id": self.task_id, "name": "Test Task"}
534
548
  mock_response = mock_get.return_value
535
549
  mock_response.json.return_value = expected_response
550
+ mock_response.status_code = 200
536
551
 
537
552
  result = self.client.get_task(
538
553
  task_id=self.task_id
@@ -551,6 +566,7 @@ class TestAgenticProcessClient(unittest.TestCase):
551
566
  expected_response = {"id": "task-123", "name": self.task_name}
552
567
  mock_response = mock_get.return_value
553
568
  mock_response.json.return_value = expected_response
569
+ mock_response.status_code = 200
554
570
 
555
571
  result = self.client.get_task(
556
572
  task_id=self.task_id,
@@ -588,6 +604,7 @@ class TestAgenticProcessClient(unittest.TestCase):
588
604
  expected_response = {"tasks": [{"id": "task-1", "name": "Task1"}]}
589
605
  mock_response = mock_get.return_value
590
606
  mock_response.json.return_value = expected_response
607
+ mock_response.status_code = 200
591
608
 
592
609
  result = self.client.list_tasks(
593
610
  id="task-1",
@@ -628,6 +645,7 @@ class TestAgenticProcessClient(unittest.TestCase):
628
645
  expected_response = {"id": self.task_id, "name": "Updated Task"}
629
646
  mock_response = mock_put.return_value
630
647
  mock_response.json.return_value = expected_response
648
+ mock_response.status_code = 200
631
649
 
632
650
  result = self.client.update_task(
633
651
  task_id=self.task_id,
@@ -660,6 +678,7 @@ class TestAgenticProcessClient(unittest.TestCase):
660
678
  expected_response = {"id": self.task_id, "name": "Upserted Task"}
661
679
  mock_response = mock_put.return_value
662
680
  mock_response.json.return_value = expected_response
681
+ mock_response.status_code = 200
663
682
 
664
683
  result = self.client.update_task(
665
684
  task_id=self.task_id,
@@ -755,6 +774,7 @@ class TestAgenticProcessClient(unittest.TestCase):
755
774
  expected_response = {"status": "published"}
756
775
  mock_response = mock_post.return_value
757
776
  mock_response.json.return_value = expected_response
777
+ mock_response.status_code = 200
758
778
 
759
779
  result = self.client.publish_task_revision(
760
780
  task_id=self.task_id,
@@ -775,6 +795,7 @@ class TestAgenticProcessClient(unittest.TestCase):
775
795
  expected_response = {"status": "published"}
776
796
  mock_response = mock_post.return_value
777
797
  mock_response.json.return_value = expected_response
798
+ mock_response.status_code = 200
778
799
 
779
800
  result = self.client.publish_task_revision(
780
801
  task_id=self.task_id,
@@ -826,6 +847,7 @@ class TestAgenticProcessClient(unittest.TestCase):
826
847
  expected_response = {"id": "instance-123", "status": "started"}
827
848
  mock_response = mock_post.return_value
828
849
  mock_response.json.return_value = expected_response
850
+ mock_response.status_code = 200
829
851
 
830
852
  result = self.client.start_instance(
831
853
  process_name=self.process_name,
@@ -866,6 +888,7 @@ class TestAgenticProcessClient(unittest.TestCase):
866
888
  expected_response = {"status": "aborted"}
867
889
  mock_response = mock_post.return_value
868
890
  mock_response.json.return_value = expected_response
891
+ mock_response.status_code = 200
869
892
 
870
893
  result = self.client.abort_instance(
871
894
  instance_id=self.instance_id
@@ -926,6 +949,7 @@ class TestAgenticProcessClient(unittest.TestCase):
926
949
  expected_response = {"history": [{"event": "start", "time": "2023-01-01"}]}
927
950
  mock_response = mock_get.return_value
928
951
  mock_response.json.return_value = expected_response
952
+ mock_response.status_code = 200
929
953
 
930
954
  result = self.client.get_instance_history(
931
955
  instance_id=self.instance_id
@@ -965,6 +989,7 @@ class TestAgenticProcessClient(unittest.TestCase):
965
989
  expected_response = {"thread": {"id": self.thread_id, "status": "active"}}
966
990
  mock_response = mock_get.return_value
967
991
  mock_response.json.return_value = expected_response
992
+ mock_response.status_code = 200
968
993
 
969
994
  result = self.client.get_thread_information(
970
995
  thread_id=self.thread_id
@@ -1004,6 +1029,7 @@ class TestAgenticProcessClient(unittest.TestCase):
1004
1029
  expected_response = {"status": "signal sent"}
1005
1030
  mock_response = mock_post.return_value
1006
1031
  mock_response.json.return_value = expected_response
1032
+ mock_response.status_code = 200
1007
1033
 
1008
1034
  result = self.client.send_user_signal(
1009
1035
  instance_id=self.instance_id,
@@ -1057,6 +1083,7 @@ class TestAgenticProcessClient(unittest.TestCase):
1057
1083
  expected_response = {"id": "kb-123", "name": "Test KB"}
1058
1084
  mock_response = mock_post.return_value
1059
1085
  mock_response.json.return_value = expected_response
1086
+ mock_response.status_code = 200
1060
1087
 
1061
1088
  result = self.client.create_kb(
1062
1089
  name="Test KB",
@@ -1098,6 +1125,7 @@ class TestAgenticProcessClient(unittest.TestCase):
1098
1125
  expected_response = {"id": self.kb_id, "name": "Test KB"}
1099
1126
  mock_response = mock_get.return_value
1100
1127
  mock_response.json.return_value = expected_response
1128
+ mock_response.status_code = 200
1101
1129
 
1102
1130
  result = self.client.get_kb(
1103
1131
  kb_id=self.kb_id
@@ -1116,6 +1144,7 @@ class TestAgenticProcessClient(unittest.TestCase):
1116
1144
  expected_response = {"id": "kb-123", "name": self.kb_name}
1117
1145
  mock_response = mock_get.return_value
1118
1146
  mock_response.json.return_value = expected_response
1147
+ mock_response.status_code = 200
1119
1148
 
1120
1149
  result = self.client.get_kb(
1121
1150
  kb_name=self.kb_name
@@ -1153,6 +1182,7 @@ class TestAgenticProcessClient(unittest.TestCase):
1153
1182
  expected_response = {"kbs": [{"id": "kb-1", "name": "KB1"}]}
1154
1183
  mock_response = mock_get.return_value
1155
1184
  mock_response.json.return_value = expected_response
1185
+ mock_response.status_code = 200
1156
1186
 
1157
1187
  result = self.client.list_kbs(
1158
1188
  name="KB1",
@@ -1247,6 +1277,7 @@ class TestAgenticProcessClient(unittest.TestCase):
1247
1277
  expected_response = {"jobs": [{"id": "job-1", "name": "Job1"}]}
1248
1278
  mock_response = mock_get.return_value
1249
1279
  mock_response.json.return_value = expected_response
1280
+ mock_response.status_code = 200
1250
1281
 
1251
1282
  result = self.client.list_jobs(
1252
1283
  start="0",
@@ -1291,6 +1322,7 @@ class TestAgenticProcessClient(unittest.TestCase):
1291
1322
  expected_response = {"id": self.process_id, "name": "Updated Process"}
1292
1323
  mock_response_put = mock_put.return_value
1293
1324
  mock_response_put.json.return_value = expected_response
1325
+ mock_response_put.status_code = 200
1294
1326
 
1295
1327
  mock_response_get = mock_get.return_value
1296
1328
  mock_response_get.json.return_value = {
@@ -1299,6 +1331,7 @@ class TestAgenticProcessClient(unittest.TestCase):
1299
1331
  "agenticActivities": [{"name": "current-activity"}]
1300
1332
  }
1301
1333
  }
1334
+ mock_response_get.status_code = 200
1302
1335
 
1303
1336
  result = self.client.update_process(
1304
1337
  process_id=self.process_id,
@@ -1327,6 +1360,7 @@ class TestAgenticProcessClient(unittest.TestCase):
1327
1360
  expected_response = {"id": "process-123", "name": "Updated Process"}
1328
1361
  mock_response_put = mock_put.return_value
1329
1362
  mock_response_put.json.return_value = expected_response
1363
+ mock_response_put.status_code = 200
1330
1364
 
1331
1365
  mock_response_get = mock_get.return_value
1332
1366
  mock_response_get.json.return_value = {
@@ -1335,6 +1369,7 @@ class TestAgenticProcessClient(unittest.TestCase):
1335
1369
  "agenticActivities": [{"name": "current-activity"}]
1336
1370
  }
1337
1371
  }
1372
+ mock_response_get.status_code = 200
1338
1373
 
1339
1374
  result = self.client.update_process(
1340
1375
  name=self.process_name,
@@ -1367,6 +1402,7 @@ class TestAgenticProcessClient(unittest.TestCase):
1367
1402
  "agenticActivities": [{"name": "current-activity"}]
1368
1403
  }
1369
1404
  }
1405
+ mock_response_get.status_code = 200
1370
1406
 
1371
1407
  with self.assertRaises(InvalidAPIResponseException) as context:
1372
1408
  self.client.update_process(
@@ -26,6 +26,7 @@ class TestAgenticProcessMapper(unittest.TestCase):
26
26
  self.revision = "1"
27
27
  self.mock_response = MagicMock()
28
28
  self.mock_response.json.return_value = {"status": "success"}
29
+ self.mock_response.status_code = 200
29
30
  self.mock_response.text = "success text"
30
31
 
31
32
  def test_map_to_agentic_process_full_data(self):
@@ -122,6 +123,7 @@ class TestAgenticProcessMapper(unittest.TestCase):
122
123
 
123
124
  def test_update_process_success_with_name(self):
124
125
  self.client.api_service.put.return_value = self.mock_response
126
+ self.client.api_service.get.return_value = self.mock_response
125
127
 
126
128
  result = self.client.update_process(
127
129
  name="Test Process",
@@ -151,6 +153,7 @@ class TestAgenticProcessMapper(unittest.TestCase):
151
153
  def test_update_process_json_decode_error(self):
152
154
  self.mock_response.json.side_effect = JSONDecodeError("Invalid JSON", "", 0)
153
155
  self.client.api_service.put.return_value = self.mock_response
156
+ self.client.api_service.get.return_value = self.mock_response
154
157
 
155
158
  try:
156
159
  result = self.client.update_process(
@@ -2,7 +2,7 @@ import unittest
2
2
  from unittest.mock import patch
3
3
  from json import JSONDecodeError
4
4
  from pygeai.lab.strategies.clients import ReasoningStrategyClient
5
- from pygeai.core.common.exceptions import InvalidAPIResponseException
5
+ from pygeai.core.common.exceptions import InvalidAPIResponseException, APIResponseError, APIResponseError
6
6
 
7
7
 
8
8
  class TestReasoningStrategyClient(unittest.TestCase):
@@ -20,6 +20,7 @@ class TestReasoningStrategyClient(unittest.TestCase):
20
20
  expected_response = {"strategies": [{"id": "strat-1", "name": "Strategy1"}]}
21
21
  mock_response = mock_get.return_value
22
22
  mock_response.json.return_value = expected_response
23
+ mock_response.status_code = 200
23
24
 
24
25
  result = self.client.list_reasoning_strategies(
25
26
  name="Strategy1",
@@ -46,11 +47,11 @@ class TestReasoningStrategyClient(unittest.TestCase):
46
47
  mock_response.text = "Raw response text"
47
48
  mock_response.status_code = 500
48
49
 
49
- with self.assertRaises(InvalidAPIResponseException) as context:
50
+ with self.assertRaises(APIResponseError) as context:
50
51
  self.client.list_reasoning_strategies()
51
52
 
52
53
  mock_get.assert_called_once()
53
- self.assertIn("Unable to list reasoning strategies", str(context.exception))
54
+ self.assertIn("API returned an error", str(context.exception)) # "Unable to list reasoning strategies", str(context.exception))
54
55
 
55
56
  def test_list_reasoning_strategies_invalid_access_scope(self):
56
57
  with self.assertRaises(ValueError) as context:
@@ -69,6 +70,7 @@ class TestReasoningStrategyClient(unittest.TestCase):
69
70
  expected_response = {"id": "strat-123", "name": name}
70
71
  mock_response = mock_post.return_value
71
72
  mock_response.json.return_value = expected_response
73
+ mock_response.status_code = 200
72
74
 
73
75
  result = self.client.create_reasoning_strategy(
74
76
  name=name,
@@ -101,14 +103,14 @@ class TestReasoningStrategyClient(unittest.TestCase):
101
103
  mock_response.text = "Raw response text"
102
104
  mock_response.status_code = 500
103
105
 
104
- with self.assertRaises(InvalidAPIResponseException) as context:
106
+ with self.assertRaises(APIResponseError) as context:
105
107
  self.client.create_reasoning_strategy(
106
108
  name=name,
107
109
  system_prompt=system_prompt
108
110
  )
109
111
 
110
112
  mock_post.assert_called_once()
111
- self.assertIn("Unable to create reasoning strategy", str(context.exception))
113
+ self.assertIn("API returned an error", str(context.exception)) # "Unable to create reasoning strategy", str(context.exception))
112
114
 
113
115
  @patch("pygeai.core.services.rest.ApiService.put")
114
116
  def test_update_reasoning_strategy_success(self, mock_put):
@@ -122,6 +124,7 @@ class TestReasoningStrategyClient(unittest.TestCase):
122
124
  expected_response = {"id": self.reasoning_strategy_id, "name": name}
123
125
  mock_response = mock_put.return_value
124
126
  mock_response.json.return_value = expected_response
127
+ mock_response.status_code = 200
125
128
 
126
129
  result = self.client.update_reasoning_strategy(
127
130
  reasoning_strategy_id=self.reasoning_strategy_id,
@@ -155,14 +158,14 @@ class TestReasoningStrategyClient(unittest.TestCase):
155
158
  mock_response.text = "Raw response text"
156
159
  mock_response.status_code = 500
157
160
 
158
- with self.assertRaises(InvalidAPIResponseException) as context:
161
+ with self.assertRaises(APIResponseError) as context:
159
162
  self.client.update_reasoning_strategy(
160
163
  reasoning_strategy_id=self.reasoning_strategy_id,
161
164
  name=name
162
165
  )
163
166
 
164
167
  mock_put.assert_called_once()
165
- self.assertIn("Unable to update reasoning strategy", str(context.exception))
168
+ self.assertIn("API returned an error", str(context.exception)) # "Unable to update reasoning strategy", str(context.exception))
166
169
 
167
170
  def test_update_reasoning_strategy_invalid_access_scope(self):
168
171
  with self.assertRaises(ValueError) as context:
@@ -187,6 +190,7 @@ class TestReasoningStrategyClient(unittest.TestCase):
187
190
  expected_response = {"id": self.reasoning_strategy_id, "name": "TestStrategy"}
188
191
  mock_response = mock_get.return_value
189
192
  mock_response.json.return_value = expected_response
193
+ mock_response.status_code = 200
190
194
 
191
195
  result = self.client.get_reasoning_strategy(
192
196
  reasoning_strategy_id=self.reasoning_strategy_id
@@ -202,6 +206,7 @@ class TestReasoningStrategyClient(unittest.TestCase):
202
206
  expected_response = {"name": self.reasoning_strategy_name}
203
207
  mock_response = mock_get.return_value
204
208
  mock_response.json.return_value = expected_response
209
+ mock_response.status_code = 200
205
210
 
206
211
  result = self.client.get_reasoning_strategy(
207
212
  reasoning_strategy_name=self.reasoning_strategy_name
@@ -217,13 +222,13 @@ class TestReasoningStrategyClient(unittest.TestCase):
217
222
  mock_response.text = "Raw response text"
218
223
  mock_response.status_code = 500
219
224
 
220
- with self.assertRaises(InvalidAPIResponseException) as context:
225
+ with self.assertRaises(APIResponseError) as context:
221
226
  self.client.get_reasoning_strategy(
222
227
  reasoning_strategy_id=self.reasoning_strategy_id
223
228
  )
224
229
 
225
230
  mock_get.assert_called_once()
226
- self.assertIn("Unable to retrieve reasoning strategy", str(context.exception))
231
+ self.assertIn("API returned an error", str(context.exception)) # "Unable to retrieve reasoning strategy", str(context.exception))
227
232
 
228
233
  def test_get_reasoning_strategy_invalid_input(self):
229
234
  with self.assertRaises(ValueError) as context: