pygeai 0.6.0b7__py3-none-any.whl → 0.6.0b11__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 (178) hide show
  1. pygeai/_docs/source/conf.py +78 -6
  2. pygeai/_docs/source/content/api_reference/embeddings.rst +31 -1
  3. pygeai/_docs/source/content/api_reference/evaluation.rst +590 -0
  4. pygeai/_docs/source/content/api_reference/feedback.rst +237 -0
  5. pygeai/_docs/source/content/api_reference/files.rst +592 -0
  6. pygeai/_docs/source/content/api_reference/gam.rst +401 -0
  7. pygeai/_docs/source/content/api_reference/proxy.rst +318 -0
  8. pygeai/_docs/source/content/api_reference/secrets.rst +495 -0
  9. pygeai/_docs/source/content/api_reference/usage_limits.rst +390 -0
  10. pygeai/_docs/source/content/api_reference.rst +7 -0
  11. pygeai/_docs/source/content/debugger.rst +376 -83
  12. pygeai/_docs/source/content/migration.rst +528 -0
  13. pygeai/_docs/source/content/modules.rst +1 -1
  14. pygeai/_docs/source/pygeai.cli.rst +8 -0
  15. pygeai/_docs/source/pygeai.tests.cli.rst +16 -0
  16. pygeai/_docs/source/pygeai.tests.core.embeddings.rst +16 -0
  17. pygeai/_docs/source/pygeai.tests.snippets.chat.rst +40 -0
  18. pygeai/_docs/source/pygeai.tests.snippets.dbg.rst +45 -0
  19. pygeai/_docs/source/pygeai.tests.snippets.embeddings.rst +40 -0
  20. pygeai/_docs/source/pygeai.tests.snippets.evaluation.dataset.rst +197 -0
  21. pygeai/_docs/source/pygeai.tests.snippets.evaluation.plan.rst +133 -0
  22. pygeai/_docs/source/pygeai.tests.snippets.evaluation.result.rst +37 -0
  23. pygeai/_docs/source/pygeai.tests.snippets.evaluation.rst +10 -0
  24. pygeai/_docs/source/pygeai.tests.snippets.rst +1 -0
  25. pygeai/admin/clients.py +5 -0
  26. pygeai/assistant/clients.py +7 -0
  27. pygeai/assistant/data_analyst/clients.py +2 -0
  28. pygeai/assistant/rag/clients.py +11 -0
  29. pygeai/chat/clients.py +236 -25
  30. pygeai/chat/endpoints.py +3 -1
  31. pygeai/cli/commands/chat.py +322 -1
  32. pygeai/cli/commands/embeddings.py +56 -8
  33. pygeai/cli/commands/migrate.py +994 -434
  34. pygeai/cli/error_handler.py +116 -0
  35. pygeai/cli/geai.py +28 -10
  36. pygeai/cli/parsers.py +8 -2
  37. pygeai/core/base/clients.py +3 -1
  38. pygeai/core/common/exceptions.py +11 -10
  39. pygeai/core/embeddings/__init__.py +19 -0
  40. pygeai/core/embeddings/clients.py +17 -2
  41. pygeai/core/embeddings/mappers.py +16 -2
  42. pygeai/core/embeddings/responses.py +9 -2
  43. pygeai/core/feedback/clients.py +1 -0
  44. pygeai/core/files/clients.py +5 -7
  45. pygeai/core/files/managers.py +42 -0
  46. pygeai/core/llm/clients.py +4 -0
  47. pygeai/core/plugins/clients.py +1 -0
  48. pygeai/core/rerank/clients.py +1 -0
  49. pygeai/core/secrets/clients.py +6 -0
  50. pygeai/core/services/rest.py +1 -1
  51. pygeai/dbg/__init__.py +3 -0
  52. pygeai/dbg/debugger.py +565 -70
  53. pygeai/evaluation/clients.py +1 -1
  54. pygeai/evaluation/dataset/clients.py +45 -44
  55. pygeai/evaluation/plan/clients.py +27 -26
  56. pygeai/evaluation/result/clients.py +37 -5
  57. pygeai/gam/clients.py +4 -0
  58. pygeai/health/clients.py +1 -0
  59. pygeai/lab/agents/clients.py +8 -1
  60. pygeai/lab/models.py +3 -3
  61. pygeai/lab/processes/clients.py +21 -0
  62. pygeai/lab/strategies/clients.py +4 -0
  63. pygeai/lab/tools/clients.py +1 -0
  64. pygeai/migration/__init__.py +31 -0
  65. pygeai/migration/strategies.py +404 -155
  66. pygeai/migration/tools.py +170 -3
  67. pygeai/organization/clients.py +13 -0
  68. pygeai/organization/limits/clients.py +15 -0
  69. pygeai/proxy/clients.py +3 -1
  70. pygeai/tests/admin/test_clients.py +16 -11
  71. pygeai/tests/assistants/rag/test_clients.py +35 -23
  72. pygeai/tests/assistants/test_clients.py +22 -15
  73. pygeai/tests/auth/test_clients.py +14 -6
  74. pygeai/tests/chat/test_clients.py +211 -1
  75. pygeai/tests/cli/commands/test_embeddings.py +32 -9
  76. pygeai/tests/cli/commands/test_evaluation.py +7 -0
  77. pygeai/tests/cli/commands/test_migrate.py +112 -243
  78. pygeai/tests/cli/test_error_handler.py +225 -0
  79. pygeai/tests/cli/test_geai_driver.py +154 -0
  80. pygeai/tests/cli/test_parsers.py +5 -5
  81. pygeai/tests/core/embeddings/test_clients.py +144 -0
  82. pygeai/tests/core/embeddings/test_managers.py +171 -0
  83. pygeai/tests/core/embeddings/test_mappers.py +142 -0
  84. pygeai/tests/core/feedback/test_clients.py +2 -0
  85. pygeai/tests/core/files/test_clients.py +1 -0
  86. pygeai/tests/core/llm/test_clients.py +14 -9
  87. pygeai/tests/core/plugins/test_clients.py +5 -3
  88. pygeai/tests/core/rerank/test_clients.py +1 -0
  89. pygeai/tests/core/secrets/test_clients.py +19 -13
  90. pygeai/tests/dbg/test_debugger.py +453 -75
  91. pygeai/tests/evaluation/dataset/test_clients.py +3 -1
  92. pygeai/tests/evaluation/plan/test_clients.py +4 -2
  93. pygeai/tests/evaluation/result/test_clients.py +7 -5
  94. pygeai/tests/gam/test_clients.py +1 -1
  95. pygeai/tests/health/test_clients.py +1 -0
  96. pygeai/tests/lab/agents/test_clients.py +9 -0
  97. pygeai/tests/lab/processes/test_clients.py +36 -0
  98. pygeai/tests/lab/processes/test_mappers.py +3 -0
  99. pygeai/tests/lab/strategies/test_clients.py +14 -9
  100. pygeai/tests/migration/test_strategies.py +45 -218
  101. pygeai/tests/migration/test_tools.py +133 -9
  102. pygeai/tests/organization/limits/test_clients.py +17 -0
  103. pygeai/tests/organization/test_clients.py +22 -0
  104. pygeai/tests/proxy/test_clients.py +2 -0
  105. pygeai/tests/proxy/test_integration.py +1 -0
  106. pygeai/tests/snippets/chat/chat_completion_with_reasoning_effort.py +18 -0
  107. pygeai/tests/snippets/chat/get_response.py +15 -0
  108. pygeai/tests/snippets/chat/get_response_streaming.py +20 -0
  109. pygeai/tests/snippets/chat/get_response_with_files.py +16 -0
  110. pygeai/tests/snippets/chat/get_response_with_tools.py +36 -0
  111. pygeai/tests/snippets/dbg/__init__.py +0 -0
  112. pygeai/tests/snippets/dbg/basic_debugging.py +32 -0
  113. pygeai/tests/snippets/dbg/breakpoint_management.py +48 -0
  114. pygeai/tests/snippets/dbg/stack_navigation.py +45 -0
  115. pygeai/tests/snippets/dbg/stepping_example.py +40 -0
  116. pygeai/tests/snippets/embeddings/cache_example.py +31 -0
  117. pygeai/tests/snippets/embeddings/cohere_example.py +41 -0
  118. pygeai/tests/snippets/embeddings/openai_base64_example.py +27 -0
  119. pygeai/tests/snippets/embeddings/openai_example.py +30 -0
  120. pygeai/tests/snippets/embeddings/similarity_example.py +42 -0
  121. pygeai/tests/snippets/evaluation/dataset/__init__.py +0 -0
  122. pygeai/tests/snippets/evaluation/dataset/complete_workflow_example.py +195 -0
  123. pygeai/tests/snippets/evaluation/dataset/create_dataset.py +26 -0
  124. pygeai/tests/snippets/evaluation/dataset/create_dataset_from_file.py +11 -0
  125. pygeai/tests/snippets/evaluation/dataset/create_dataset_row.py +17 -0
  126. pygeai/tests/snippets/evaluation/dataset/create_expected_source.py +18 -0
  127. pygeai/tests/snippets/evaluation/dataset/create_filter_variable.py +19 -0
  128. pygeai/tests/snippets/evaluation/dataset/delete_dataset.py +9 -0
  129. pygeai/tests/snippets/evaluation/dataset/delete_dataset_row.py +10 -0
  130. pygeai/tests/snippets/evaluation/dataset/delete_expected_source.py +15 -0
  131. pygeai/tests/snippets/evaluation/dataset/delete_filter_variable.py +15 -0
  132. pygeai/tests/snippets/evaluation/dataset/get_dataset.py +9 -0
  133. pygeai/tests/snippets/evaluation/dataset/get_dataset_row.py +10 -0
  134. pygeai/tests/snippets/evaluation/dataset/get_expected_source.py +15 -0
  135. pygeai/tests/snippets/evaluation/dataset/get_filter_variable.py +15 -0
  136. pygeai/tests/snippets/evaluation/dataset/list_dataset_rows.py +9 -0
  137. pygeai/tests/snippets/evaluation/dataset/list_datasets.py +6 -0
  138. pygeai/tests/snippets/evaluation/dataset/list_expected_sources.py +10 -0
  139. pygeai/tests/snippets/evaluation/dataset/list_filter_variables.py +10 -0
  140. pygeai/tests/snippets/evaluation/dataset/update_dataset.py +15 -0
  141. pygeai/tests/snippets/evaluation/dataset/update_dataset_row.py +20 -0
  142. pygeai/tests/snippets/evaluation/dataset/update_expected_source.py +18 -0
  143. pygeai/tests/snippets/evaluation/dataset/update_filter_variable.py +19 -0
  144. pygeai/tests/snippets/evaluation/dataset/upload_dataset_rows_file.py +10 -0
  145. pygeai/tests/snippets/evaluation/plan/__init__.py +0 -0
  146. pygeai/tests/snippets/evaluation/plan/add_plan_system_metric.py +13 -0
  147. pygeai/tests/snippets/evaluation/plan/complete_workflow_example.py +136 -0
  148. pygeai/tests/snippets/evaluation/plan/create_evaluation_plan.py +24 -0
  149. pygeai/tests/snippets/evaluation/plan/create_rag_evaluation_plan.py +22 -0
  150. pygeai/tests/snippets/evaluation/plan/delete_evaluation_plan.py +9 -0
  151. pygeai/tests/snippets/evaluation/plan/delete_plan_system_metric.py +13 -0
  152. pygeai/tests/snippets/evaluation/plan/execute_evaluation_plan.py +11 -0
  153. pygeai/tests/snippets/evaluation/plan/get_evaluation_plan.py +9 -0
  154. pygeai/tests/snippets/evaluation/plan/get_plan_system_metric.py +13 -0
  155. pygeai/tests/snippets/evaluation/plan/get_system_metric.py +9 -0
  156. pygeai/tests/snippets/evaluation/plan/list_evaluation_plans.py +7 -0
  157. pygeai/tests/snippets/evaluation/plan/list_plan_system_metrics.py +9 -0
  158. pygeai/tests/snippets/evaluation/plan/list_system_metrics.py +7 -0
  159. pygeai/tests/snippets/evaluation/plan/update_evaluation_plan.py +22 -0
  160. pygeai/tests/snippets/evaluation/plan/update_plan_system_metric.py +14 -0
  161. pygeai/tests/snippets/evaluation/result/__init__.py +0 -0
  162. pygeai/tests/snippets/evaluation/result/complete_workflow_example.py +150 -0
  163. pygeai/tests/snippets/evaluation/result/get_evaluation_result.py +26 -0
  164. pygeai/tests/snippets/evaluation/result/list_evaluation_results.py +17 -0
  165. pygeai/tests/snippets/migrate/__init__.py +45 -0
  166. pygeai/tests/snippets/migrate/agent_migration.py +110 -0
  167. pygeai/tests/snippets/migrate/assistant_migration.py +64 -0
  168. pygeai/tests/snippets/migrate/orchestrator_examples.py +179 -0
  169. pygeai/tests/snippets/migrate/process_migration.py +64 -0
  170. pygeai/tests/snippets/migrate/project_migration.py +42 -0
  171. pygeai/tests/snippets/migrate/tool_migration.py +64 -0
  172. pygeai/tests/snippets/organization/create_project.py +2 -2
  173. {pygeai-0.6.0b7.dist-info → pygeai-0.6.0b11.dist-info}/METADATA +1 -1
  174. {pygeai-0.6.0b7.dist-info → pygeai-0.6.0b11.dist-info}/RECORD +178 -96
  175. {pygeai-0.6.0b7.dist-info → pygeai-0.6.0b11.dist-info}/WHEEL +0 -0
  176. {pygeai-0.6.0b7.dist-info → pygeai-0.6.0b11.dist-info}/entry_points.txt +0 -0
  177. {pygeai-0.6.0b7.dist-info → pygeai-0.6.0b11.dist-info}/licenses/LICENSE +0 -0
  178. {pygeai-0.6.0b7.dist-info → pygeai-0.6.0b11.dist-info}/top_level.txt +0 -0
@@ -9,7 +9,7 @@ class EvaluationClient(BaseClient):
9
9
 
10
10
  def __init__(self, api_key: str = None, base_url: str = None, alias: str = "default", eval_url: str = None):
11
11
  super().__init__(api_key, base_url, alias)
12
- eval_url = self.session.eval_url if not eval_url else None
12
+ eval_url = self.session.eval_url if not eval_url else eval_url
13
13
  if not eval_url:
14
14
  raise MissingRequirementException("EVAL URL must be defined in order to use the Evaluation module.")
15
15
 
@@ -10,6 +10,7 @@ from pygeai.evaluation.dataset.endpoints import (
10
10
  UPLOAD_DATASET_ROWS_FILE
11
11
  )
12
12
  from pygeai.core.utils.validators import validate_status_code
13
+ from pygeai.core.utils.parsers import parse_json_response
13
14
 
14
15
 
15
16
  class EvaluationDatasetClient(EvaluationClient):
@@ -23,8 +24,8 @@ class EvaluationDatasetClient(EvaluationClient):
23
24
  response = self.api_service.get(
24
25
  endpoint=LIST_DATASETS
25
26
  )
26
- result = response.json()
27
- return result
27
+ validate_status_code(response)
28
+ return parse_json_response(response, "dataset operation")
28
29
 
29
30
  def create_dataset(
30
31
  self,
@@ -57,8 +58,8 @@ class EvaluationDatasetClient(EvaluationClient):
57
58
  endpoint=CREATE_DATASET,
58
59
  data=data
59
60
  )
60
- result = response.json()
61
- return result
61
+ validate_status_code(response)
62
+ return parse_json_response(response, "dataset operation")
62
63
 
63
64
  def create_dataset_from_file(self, file_path: str) -> dict:
64
65
  """
@@ -83,8 +84,8 @@ class EvaluationDatasetClient(EvaluationClient):
83
84
  headers=headers,
84
85
  file=file
85
86
  )
86
- result = response.json()
87
- return result
87
+ validate_status_code(response)
88
+ return parse_json_response(response, "upload dataset file")
88
89
  finally:
89
90
  if file:
90
91
  file.close()
@@ -101,8 +102,8 @@ class EvaluationDatasetClient(EvaluationClient):
101
102
  response = self.api_service.get(
102
103
  endpoint=endpoint
103
104
  )
104
- result = response.json()
105
- return result
105
+ validate_status_code(response)
106
+ return parse_json_response(response, "dataset operation")
106
107
 
107
108
  def update_dataset(
108
109
  self,
@@ -142,8 +143,8 @@ class EvaluationDatasetClient(EvaluationClient):
142
143
  endpoint=endpoint,
143
144
  data=data
144
145
  )
145
- result = response.json()
146
- return result
146
+ validate_status_code(response)
147
+ return parse_json_response(response, "dataset operation")
147
148
 
148
149
  def delete_dataset(self, dataset_id: str) -> dict:
149
150
  """
@@ -157,8 +158,8 @@ class EvaluationDatasetClient(EvaluationClient):
157
158
  response = self.api_service.delete(
158
159
  endpoint=endpoint
159
160
  )
160
- result = response.json()
161
- return result
161
+ validate_status_code(response)
162
+ return parse_json_response(response, "dataset operation")
162
163
 
163
164
  def create_dataset_row(self, dataset_id: str, row: dict) -> dict:
164
165
  """
@@ -174,8 +175,8 @@ class EvaluationDatasetClient(EvaluationClient):
174
175
  endpoint=endpoint,
175
176
  data=row
176
177
  )
177
- result = response.json()
178
- return result
178
+ validate_status_code(response)
179
+ return parse_json_response(response, "dataset operation")
179
180
 
180
181
  def list_dataset_rows(self, dataset_id: str) -> dict:
181
182
  """
@@ -189,8 +190,8 @@ class EvaluationDatasetClient(EvaluationClient):
189
190
  response = self.api_service.get(
190
191
  endpoint=endpoint
191
192
  )
192
- result = response.json()
193
- return result
193
+ validate_status_code(response)
194
+ return parse_json_response(response, "dataset operation")
194
195
 
195
196
  def get_dataset_row(self, dataset_id: str, dataset_row_id: str) -> dict:
196
197
  """
@@ -205,8 +206,8 @@ class EvaluationDatasetClient(EvaluationClient):
205
206
  response = self.api_service.get(
206
207
  endpoint=endpoint
207
208
  )
208
- result = response.json()
209
- return result
209
+ validate_status_code(response)
210
+ return parse_json_response(response, "dataset operation")
210
211
 
211
212
  def update_dataset_row(self, dataset_id: str, dataset_row_id: str, row: dict) -> dict:
212
213
  """
@@ -223,8 +224,8 @@ class EvaluationDatasetClient(EvaluationClient):
223
224
  endpoint=endpoint,
224
225
  data=row
225
226
  )
226
- result = response.json()
227
- return result
227
+ validate_status_code(response)
228
+ return parse_json_response(response, "dataset operation")
228
229
 
229
230
  def delete_dataset_row(self, dataset_id: str, dataset_row_id: str) -> dict:
230
231
  """
@@ -239,8 +240,8 @@ class EvaluationDatasetClient(EvaluationClient):
239
240
  response = self.api_service.delete(
240
241
  endpoint=endpoint
241
242
  )
242
- result = response.json()
243
- return result
243
+ validate_status_code(response)
244
+ return parse_json_response(response, "dataset operation")
244
245
 
245
246
  def create_expected_source(
246
247
  self,
@@ -271,8 +272,8 @@ class EvaluationDatasetClient(EvaluationClient):
271
272
  endpoint=endpoint,
272
273
  data=data
273
274
  )
274
- result = response.json()
275
- return result
275
+ validate_status_code(response)
276
+ return parse_json_response(response, "dataset operation")
276
277
 
277
278
  def list_expected_sources(self, dataset_id: str, dataset_row_id: str) -> dict:
278
279
  """
@@ -287,8 +288,8 @@ class EvaluationDatasetClient(EvaluationClient):
287
288
  response = self.api_service.get(
288
289
  endpoint=endpoint
289
290
  )
290
- result = response.json()
291
- return result
291
+ validate_status_code(response)
292
+ return parse_json_response(response, "dataset operation")
292
293
 
293
294
  def get_expected_source(self, dataset_id: str, dataset_row_id: str, expected_source_id: str) -> dict:
294
295
  """
@@ -304,8 +305,8 @@ class EvaluationDatasetClient(EvaluationClient):
304
305
  response = self.api_service.get(
305
306
  endpoint=endpoint
306
307
  )
307
- result = response.json()
308
- return result
308
+ validate_status_code(response)
309
+ return parse_json_response(response, "dataset operation")
309
310
 
310
311
  def update_expected_source(
311
312
  self,
@@ -338,8 +339,8 @@ class EvaluationDatasetClient(EvaluationClient):
338
339
  endpoint=endpoint,
339
340
  data=data
340
341
  )
341
- result = response.json()
342
- return result
342
+ validate_status_code(response)
343
+ return parse_json_response(response, "dataset operation")
343
344
 
344
345
  def delete_expected_source(self, dataset_id: str, dataset_row_id: str, expected_source_id: str) -> dict:
345
346
  """
@@ -355,8 +356,8 @@ class EvaluationDatasetClient(EvaluationClient):
355
356
  response = self.api_service.delete(
356
357
  endpoint=endpoint
357
358
  )
358
- result = response.json()
359
- return result
359
+ validate_status_code(response)
360
+ return parse_json_response(response, "dataset operation")
360
361
 
361
362
  def create_filter_variable(
362
363
  self,
@@ -390,8 +391,8 @@ class EvaluationDatasetClient(EvaluationClient):
390
391
  endpoint=endpoint,
391
392
  data=data
392
393
  )
393
- result = response.json()
394
- return result
394
+ validate_status_code(response)
395
+ return parse_json_response(response, "dataset operation")
395
396
 
396
397
  def list_filter_variables(self, dataset_id: str, dataset_row_id: str) -> dict:
397
398
  """
@@ -406,8 +407,8 @@ class EvaluationDatasetClient(EvaluationClient):
406
407
  response = self.api_service.get(
407
408
  endpoint=endpoint
408
409
  )
409
- result = response.json()
410
- return result
410
+ validate_status_code(response)
411
+ return parse_json_response(response, "dataset operation")
411
412
 
412
413
  def get_filter_variable(self, dataset_id: str, dataset_row_id: str, filter_variable_id: str) -> dict:
413
414
  """
@@ -423,8 +424,8 @@ class EvaluationDatasetClient(EvaluationClient):
423
424
  response = self.api_service.get(
424
425
  endpoint=endpoint
425
426
  )
426
- result = response.json()
427
- return result
427
+ validate_status_code(response)
428
+ return parse_json_response(response, "dataset operation")
428
429
 
429
430
  def update_filter_variable(
430
431
  self,
@@ -460,8 +461,8 @@ class EvaluationDatasetClient(EvaluationClient):
460
461
  endpoint=endpoint,
461
462
  data=data
462
463
  )
463
- result = response.json()
464
- return result
464
+ validate_status_code(response)
465
+ return parse_json_response(response, "dataset operation")
465
466
 
466
467
  def delete_filter_variable(self, dataset_id: str, dataset_row_id: str, filter_variable_id: str) -> dict:
467
468
  """
@@ -477,8 +478,8 @@ class EvaluationDatasetClient(EvaluationClient):
477
478
  response = self.api_service.delete(
478
479
  endpoint=endpoint
479
480
  )
480
- result = response.json()
481
- return result
481
+ validate_status_code(response)
482
+ return parse_json_response(response, "dataset operation")
482
483
 
483
484
  def upload_dataset_rows_file(self, dataset_id: str, file_path: str) -> dict:
484
485
  """
@@ -505,8 +506,8 @@ class EvaluationDatasetClient(EvaluationClient):
505
506
  headers=headers,
506
507
  file=file
507
508
  )
508
- result = response.json()
509
- return result
509
+ validate_status_code(response)
510
+ return parse_json_response(response, "upload dataset rows file")
510
511
  finally:
511
512
  if file:
512
513
  file.close()
@@ -6,6 +6,7 @@ from pygeai.evaluation.plan.endpoints import LIST_EVALUATION_PLANS, CREATE_EVALU
6
6
  ADD_EVALUATION_PLAN_SYSTEM_METRIC, GET_EVALUATION_PLAN_SYSTEM_METRIC, UPDATE_EVALUATION_PLAN_SYSTEM_METRIC, \
7
7
  DELETE_EVALUATION_PLAN_SYSTEM_METRIC, LIST_SYSTEM_METRICS, GET_SYSTEM_METRIC, EXECUTE_EVALUATION_PLAN
8
8
  from pygeai.core.utils.validators import validate_status_code
9
+ from pygeai.core.utils.parsers import parse_json_response
9
10
 
10
11
 
11
12
  class EvaluationPlanClient(EvaluationClient):
@@ -19,8 +20,8 @@ class EvaluationPlanClient(EvaluationClient):
19
20
  response = self.api_service.get(
20
21
  endpoint=LIST_EVALUATION_PLANS
21
22
  )
22
- result = json.loads(response.content)
23
- return result
23
+ validate_status_code(response)
24
+ return parse_json_response(response, "evaluation plan operation")
24
25
 
25
26
  def create_evaluation_plan(
26
27
  self,
@@ -69,8 +70,8 @@ class EvaluationPlanClient(EvaluationClient):
69
70
  endpoint=CREATE_EVALUATION_PLAN,
70
71
  data=data
71
72
  )
72
- result = json.loads(response.content)
73
- return result
73
+ validate_status_code(response)
74
+ return parse_json_response(response, "evaluation plan operation")
74
75
 
75
76
  def get_evaluation_plan(self, evaluation_plan_id: str) -> dict:
76
77
  """
@@ -84,8 +85,8 @@ class EvaluationPlanClient(EvaluationClient):
84
85
  response = self.api_service.get(
85
86
  endpoint=endpoint
86
87
  )
87
- result = json.loads(response.content)
88
- return result
88
+ validate_status_code(response)
89
+ return parse_json_response(response, "evaluation plan operation")
89
90
 
90
91
  def update_evaluation_plan(
91
92
  self,
@@ -140,8 +141,8 @@ class EvaluationPlanClient(EvaluationClient):
140
141
  endpoint=endpoint,
141
142
  data=data
142
143
  )
143
- result = json.loads(response.content)
144
- return result
144
+ validate_status_code(response)
145
+ return parse_json_response(response, "evaluation plan operation")
145
146
 
146
147
  def delete_evaluation_plan(self, evaluation_plan_id: str) -> dict:
147
148
  """
@@ -155,8 +156,8 @@ class EvaluationPlanClient(EvaluationClient):
155
156
  response = self.api_service.delete(
156
157
  endpoint=endpoint
157
158
  )
158
- result = json.loads(response.content)
159
- return result
159
+ validate_status_code(response)
160
+ return parse_json_response(response, "evaluation plan operation")
160
161
 
161
162
  def list_evaluation_plan_system_metrics(self, evaluation_plan_id: str) -> dict:
162
163
  """
@@ -170,8 +171,8 @@ class EvaluationPlanClient(EvaluationClient):
170
171
  response = self.api_service.get(
171
172
  endpoint=endpoint
172
173
  )
173
- result = json.loads(response.content)
174
- return result
174
+ validate_status_code(response)
175
+ return parse_json_response(response, "evaluation plan operation")
175
176
 
176
177
  def add_evaluation_plan_system_metric(
177
178
  self,
@@ -197,8 +198,8 @@ class EvaluationPlanClient(EvaluationClient):
197
198
  endpoint=endpoint,
198
199
  data=data
199
200
  )
200
- result = json.loads(response.content)
201
- return result
201
+ validate_status_code(response)
202
+ return parse_json_response(response, "evaluation plan operation")
202
203
 
203
204
  def get_evaluation_plan_system_metric(self, evaluation_plan_id: str, system_metric_id: str) -> dict:
204
205
  """
@@ -213,8 +214,8 @@ class EvaluationPlanClient(EvaluationClient):
213
214
  response = self.api_service.get(
214
215
  endpoint=endpoint
215
216
  )
216
- result = json.loads(response.content)
217
- return result
217
+ validate_status_code(response)
218
+ return parse_json_response(response, "evaluation plan operation")
218
219
 
219
220
  def update_evaluation_plan_system_metric(
220
221
  self,
@@ -239,8 +240,8 @@ class EvaluationPlanClient(EvaluationClient):
239
240
  endpoint=endpoint,
240
241
  data=data
241
242
  )
242
- result = json.loads(response.content)
243
- return result
243
+ validate_status_code(response)
244
+ return parse_json_response(response, "evaluation plan operation")
244
245
 
245
246
  def delete_evaluation_plan_system_metric(self, evaluation_plan_id: str, system_metric_id: str) -> dict:
246
247
  """
@@ -255,8 +256,8 @@ class EvaluationPlanClient(EvaluationClient):
255
256
  response = self.api_service.delete(
256
257
  endpoint=endpoint
257
258
  )
258
- result = json.loads(response.content)
259
- return result
259
+ validate_status_code(response)
260
+ return parse_json_response(response, "evaluation plan operation")
260
261
 
261
262
  def list_system_metrics(self) -> dict:
262
263
  """
@@ -267,8 +268,8 @@ class EvaluationPlanClient(EvaluationClient):
267
268
  response = self.api_service.get(
268
269
  endpoint=LIST_SYSTEM_METRICS
269
270
  )
270
- result = json.loads(response.content)
271
- return result
271
+ validate_status_code(response)
272
+ return parse_json_response(response, "evaluation plan operation")
272
273
 
273
274
  def get_system_metric(self, system_metric_id: str) -> dict:
274
275
  """
@@ -282,8 +283,8 @@ class EvaluationPlanClient(EvaluationClient):
282
283
  response = self.api_service.get(
283
284
  endpoint=endpoint
284
285
  )
285
- result = json.loads(response.content)
286
- return result
286
+ validate_status_code(response)
287
+ return parse_json_response(response, "evaluation plan operation")
287
288
 
288
289
  def execute_evaluation_plan(self, evaluation_plan_id: str) -> dict:
289
290
  """
@@ -297,5 +298,5 @@ class EvaluationPlanClient(EvaluationClient):
297
298
  response = self.api_service.post(
298
299
  endpoint=endpoint,
299
300
  )
300
- result = json.loads(response.content)
301
- return result
301
+ validate_status_code(response)
302
+ return parse_json_response(response, "evaluation plan operation")
@@ -3,9 +3,26 @@ import json
3
3
  from pygeai.evaluation.clients import EvaluationClient
4
4
  from pygeai.evaluation.result.endpoints import LIST_EVALUATION_RESULTS, GET_EVALUATION_RESULT
5
5
  from pygeai.core.utils.validators import validate_status_code
6
+ from pygeai.core.utils.parsers import parse_json_response
6
7
 
7
8
 
8
9
  class EvaluationResultClient(EvaluationClient):
10
+ """
11
+ Client for interacting with the Evaluation Result API.
12
+
13
+ This API is read-only and retrieves results from executed evaluation plans.
14
+
15
+ .. warning::
16
+ The API documentation at https://docs.globant.ai/en/wiki?856,Evaluation+Result+API
17
+ contains several typos in field names. The actual API responses use these typo'd names:
18
+
19
+ - evaluationResultAssitantRevision (missing 's' in Assistant)
20
+ - evaluationResultChunckCount (should be Chunk, not Chunck)
21
+ - evaluationResultChunckSize (should be Chunk, not Chunck)
22
+ - evaluationResultaMaxTokens (lowercase 'a' should be uppercase 'M', no 'a')
23
+
24
+ Our implementation returns these fields as-is from the API.
25
+ """
9
26
 
10
27
  def list_evaluation_results(self, evaluation_plan_id: str) -> dict:
11
28
  """
@@ -14,13 +31,20 @@ class EvaluationResultClient(EvaluationClient):
14
31
  :param evaluation_plan_id: str - The ID of the evaluation plan.
15
32
 
16
33
  :return: dict - API response containing a list of evaluation results.
34
+
35
+ .. note::
36
+ Response contains evaluation result objects with fields including:
37
+ dataSetId, evaluationPlanId, evaluationResultId, evaluationResultStatus,
38
+ evaluationResultCost, evaluationResultDuration, and others.
39
+
40
+ See class documentation for field name typos in the API.
17
41
  """
18
42
  endpoint = LIST_EVALUATION_RESULTS.format(evaluationPlanId=evaluation_plan_id)
19
43
  response = self.api_service.get(
20
44
  endpoint=endpoint
21
45
  )
22
- result = json.loads(response.content)
23
- return result
46
+ validate_status_code(response)
47
+ return parse_json_response(response, "evaluation plan operation")
24
48
 
25
49
  def get_evaluation_result(self, evaluation_result_id: str) -> dict:
26
50
  """
@@ -28,11 +52,19 @@ class EvaluationResultClient(EvaluationClient):
28
52
 
29
53
  :param evaluation_result_id: str - The ID of the evaluation result.
30
54
 
31
- :return: dict - The evaluation result metadata as a dictionary.
55
+ :return: dict - The evaluation result metadata as a dictionary, including row-level data.
56
+
57
+ .. note::
58
+ Response includes all fields from list_evaluation_results plus a 'rows' array
59
+ containing detailed row-level evaluation data with fields like:
60
+ dataSetRowId, evaluationResultRowStatus, evaluationResultRowOutput,
61
+ evaluationResultRowCost, etc.
62
+
63
+ See class documentation for field name typos in the API.
32
64
  """
33
65
  endpoint = GET_EVALUATION_RESULT.format(evaluationResultId=evaluation_result_id)
34
66
  response = self.api_service.get(
35
67
  endpoint=endpoint
36
68
  )
37
- result = json.loads(response.content)
38
- return result
69
+ validate_status_code(response)
70
+ return parse_json_response(response, "evaluation plan operation")
pygeai/gam/clients.py CHANGED
@@ -105,6 +105,7 @@ class GAMClient(BaseClient):
105
105
  headers=headers,
106
106
  form=True
107
107
  )
108
+ validate_status_code(response)
108
109
  return parse_json_response(response, "get access token")
109
110
 
110
111
  def get_user_info(
@@ -126,6 +127,7 @@ class GAMClient(BaseClient):
126
127
  endpoint=GET_USER_INFO_V2,
127
128
  headers=headers
128
129
  )
130
+ validate_status_code(response)
129
131
  return parse_json_response(response, "get user info")
130
132
 
131
133
  def refresh_access_token(
@@ -164,6 +166,7 @@ class GAMClient(BaseClient):
164
166
  headers=headers,
165
167
  form=True
166
168
  )
169
+ validate_status_code(response)
167
170
  return parse_json_response(response, "refresh access token")
168
171
 
169
172
  def get_authentication_types(self):
@@ -171,4 +174,5 @@ class GAMClient(BaseClient):
171
174
  endpoint=GET_ACCESS_TOKEN_V2,
172
175
  params={},
173
176
  )
177
+ validate_status_code(response)
174
178
  return parse_json_response(response, "get authentication types")
pygeai/health/clients.py CHANGED
@@ -20,4 +20,5 @@ class HealthClient(BaseClient):
20
20
  response = self.api_service.get(
21
21
  endpoint=endpoint
22
22
  )
23
+ validate_status_code(response)
23
24
  return parse_json_response(response, "check API status")
@@ -53,6 +53,7 @@ class AgentClient(AILabClient):
53
53
  "allowExternal": allow_external
54
54
  }
55
55
  )
56
+ validate_status_code(response)
56
57
  return parse_json_response(response, f"list agents for project {self.project_id}")
57
58
 
58
59
  def create_agent(
@@ -134,6 +135,7 @@ class AgentClient(AILabClient):
134
135
  data=data
135
136
  )
136
137
 
138
+ validate_status_code(response)
137
139
  return parse_json_response(response, f"create agent for project {self.project_id}")
138
140
 
139
141
 
@@ -175,6 +177,7 @@ class AgentClient(AILabClient):
175
177
  "allowDrafts": allow_drafts,
176
178
  }
177
179
  )
180
+ validate_status_code(response)
178
181
  return parse_json_response(response, f"retrieve agent {agent_id} for project {self.project_id}")
179
182
 
180
183
 
@@ -206,6 +209,7 @@ class AgentClient(AILabClient):
206
209
  headers=headers,
207
210
  params={}
208
211
  )
212
+ validate_status_code(response)
209
213
  return parse_json_response(response, f"create sharing link for agent {agent_id} in project {self.project_id}")
210
214
 
211
215
 
@@ -237,6 +241,7 @@ class AgentClient(AILabClient):
237
241
  "revision": revision,
238
242
  }
239
243
  )
244
+ validate_status_code(response)
240
245
  return parse_json_response(response, f"publish revision {revision} for agent {agent_id} in project {self.project_id}")
241
246
 
242
247
 
@@ -356,6 +361,7 @@ class AgentClient(AILabClient):
356
361
  data=data
357
362
  )
358
363
 
364
+ validate_status_code(response)
359
365
  return parse_json_response(response, f"update agent {agent_id} in project {self.project_id}")
360
366
 
361
367
 
@@ -386,9 +392,9 @@ class AgentClient(AILabClient):
386
392
  endpoint=endpoint,
387
393
  headers=headers,
388
394
  )
395
+ validate_status_code(response)
389
396
  return parse_json_response(response, f"export agent {agent_id} for project {self.project_id}")
390
397
 
391
-
392
398
  def import_agent(
393
399
  self,
394
400
  data: dict,
@@ -415,5 +421,6 @@ class AgentClient(AILabClient):
415
421
  headers=headers,
416
422
  data=data
417
423
  )
424
+ validate_status_code(response)
418
425
  return parse_json_response(response, f"import agent for project {self.project_id}")
419
426
 
pygeai/lab/models.py CHANGED
@@ -711,9 +711,9 @@ class Tool(CustomBaseModel):
711
711
  raise ValueError("name cannot be blank")
712
712
  if ":" in value or "/" in value:
713
713
  raise ValueError("name cannot contain ':' or '/'")
714
- if not re.match(r'^[A-Za-z0-9_-]{1,64}$', value):
715
- raise ValueError(
716
- "name must contain only letters, numbers, underscores, or hyphens, and be 1-64 characters long")
714
+ # if not re.match(r'^[A-Za-z0-9_-]{1,64}$', value):
715
+ # raise ValueError(
716
+ # "name must contain only letters, numbers, underscores, or hyphens, and be 1-64 characters long")
717
717
  return value
718
718
 
719
719
  @field_validator("public_name")