pygeai 0.4.0b6__py3-none-any.whl → 0.4.0b8__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.

Potentially problematic release.


This version of pygeai might be problematic. Click here for more details.

@@ -55,5 +55,6 @@ class InvalidAgentException(GEAIException):
55
55
  pass
56
56
 
57
57
 
58
-
58
+ class APIResponseError(GEAIException):
59
+ pass
59
60
 
@@ -2,7 +2,7 @@ import json
2
2
  from json import JSONDecodeError
3
3
 
4
4
  from pygeai import logger
5
- from pygeai.core.common.exceptions import InvalidAPIResponseException, MissingRequirementException
5
+ from pygeai.core.common.exceptions import InvalidAPIResponseException, MissingRequirementException, APIResponseError
6
6
  from pygeai.lab.constants import VALID_SCOPES, VALID_ACCESS_SCOPES, VALID_REPORT_EVENTS
7
7
  from pygeai.lab.tools.endpoints import CREATE_TOOL_V2, LIST_TOOLS_V2, GET_TOOL_V2, UPDATE_TOOL_V2, UPSERT_TOOL_V2, \
8
8
  PUBLISH_TOOL_REVISION_V2, GET_PARAMETER_V2, SET_PARAMETER_V2, DELETE_TOOL_V2, EXPORT_TOOL_V2
@@ -114,7 +114,9 @@ class ToolClient(AILabClient):
114
114
  headers=headers,
115
115
  data=data
116
116
  )
117
-
117
+ if response.status_code != 200:
118
+ logger.error(f"Invalid status code returned from the API endpoint: {response.text}")
119
+ raise APIResponseError(f"API returned an error: {response.text}")
118
120
  try:
119
121
  result = response.json()
120
122
  except JSONDecodeError as e:
@@ -166,6 +168,9 @@ class ToolClient(AILabClient):
166
168
  "allowExternal": allow_external
167
169
  }
168
170
  )
171
+ if response.status_code != 200:
172
+ logger.error(f"Invalid status code returned from the API endpoint: {response.text}")
173
+ raise APIResponseError(f"API returned an error: {response.text}")
169
174
  try:
170
175
  result = response.json()
171
176
  except JSONDecodeError as e:
@@ -207,6 +212,9 @@ class ToolClient(AILabClient):
207
212
  "allowDrafts": allow_drafts,
208
213
  }
209
214
  )
215
+ if response.status_code != 200:
216
+ logger.error(f"Invalid status code returned from the API endpoint: {response.text}")
217
+ raise APIResponseError(f"API returned an error: {response.text}")
210
218
  try:
211
219
  result = response.json()
212
220
  except JSONDecodeError as e:
@@ -247,6 +255,9 @@ class ToolClient(AILabClient):
247
255
  endpoint=endpoint,
248
256
  headers=headers
249
257
  )
258
+ if response.status_code != 200:
259
+ logger.error(f"Invalid status code returned from the API endpoint: {response.text}")
260
+ raise APIResponseError(f"API returned an error: {response.text}")
250
261
 
251
262
  if response.status_code != 204:
252
263
  logger.error(f"Unable to delete tool {tool_id or tool_name} from project {self.project_id}: JSON parsing error (status {response.status_code}). Response: {response.text}")
@@ -256,7 +267,7 @@ class ToolClient(AILabClient):
256
267
 
257
268
  def update_tool(
258
269
  self,
259
- tool_id: str,
270
+ tool_id: str = None,
260
271
  name: str = None,
261
272
  description: str = None,
262
273
  scope: str = None,
@@ -313,6 +324,8 @@ class ToolClient(AILabClient):
313
324
  :raises JSONDecodeError: Caught internally if the response cannot be parsed as JSON; returns raw response text.
314
325
  :raises Exception: May be raised by `api_service.put` for network issues, authentication errors, or server-side problems (not caught here).
315
326
  """
327
+ if not (tool_id or name):
328
+ raise ValueError(f"Either tool ID or tool Name must be defined in order to update tool.")
316
329
  if scope and scope not in VALID_SCOPES:
317
330
  raise ValueError(f"Scope must be one of {', '.join(VALID_SCOPES)}.")
318
331
  if access_scope and access_scope not in VALID_ACCESS_SCOPES:
@@ -362,7 +375,9 @@ class ToolClient(AILabClient):
362
375
  headers=headers,
363
376
  data=data
364
377
  )
365
-
378
+ if response.status_code != 200:
379
+ logger.error(f"Invalid status code returned from the API endpoint: {response.text}")
380
+ raise APIResponseError(f"API returned an error: {response.text}")
366
381
  try:
367
382
  result = response.json()
368
383
  except JSONDecodeError as e:
@@ -448,6 +463,9 @@ class ToolClient(AILabClient):
448
463
  "allowDrafts": allow_drafts,
449
464
  }
450
465
  )
466
+ if response.status_code != 200:
467
+ logger.error(f"Invalid status code returned from the API endpoint: {response.text}")
468
+ raise APIResponseError(f"API returned an error: {response.text}")
451
469
  try:
452
470
  result = response.json()
453
471
  except JSONDecodeError as e:
@@ -502,6 +520,9 @@ class ToolClient(AILabClient):
502
520
  headers=headers,
503
521
  data=data
504
522
  )
523
+ if response.status_code != 200:
524
+ logger.error(f"Invalid status code returned from the API endpoint: {response.text}")
525
+ raise APIResponseError(f"API returned an error: {response.text}")
505
526
  try:
506
527
  result = response.json()
507
528
  except JSONDecodeError as e:
@@ -538,6 +559,9 @@ class ToolClient(AILabClient):
538
559
  endpoint=endpoint,
539
560
  headers=headers,
540
561
  )
562
+ if response.status_code != 200:
563
+ logger.error(f"Invalid status code returned from the API endpoint: {response.text}")
564
+ raise APIResponseError(f"API returned an error: {response.text}")
541
565
  try:
542
566
  result = response.json()
543
567
  except JSONDecodeError as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygeai
3
- Version: 0.4.0b6
3
+ Version: 0.4.0b8
4
4
  Summary: Software Development Kit to interact with Globant Enterprise AI.
5
5
  Author-email: Globant <geai-sdk@globant.com>
6
6
  License-Expression: MIT
@@ -77,7 +77,7 @@ pygeai/core/base/session.py,sha256=WVb4MmptwdgK7paHOSvfEle_HPXRRXO8CHgi0qbgtOg,2
77
77
  pygeai/core/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
78
  pygeai/core/common/config.py,sha256=zrlNF-0AE54qZ-XpR0RgYzM_7v8LtS0jUpM7UXrbSqQ,4475
79
79
  pygeai/core/common/decorators.py,sha256=X7Tv5XBmsuS7oZHSmI95eX8UkuukKoiOiNRl5w9lgR4,1227
80
- pygeai/core/common/exceptions.py,sha256=hfyCj5iLuWJzg93rGrR9wpVESGnq6Dq0HJQBuuitNo0,1204
80
+ pygeai/core/common/exceptions.py,sha256=-eF4V0B-27zfp0aHMlZWqWRIty6P7TCOrzMRW87ZnlE,1251
81
81
  pygeai/core/embeddings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
82
  pygeai/core/embeddings/clients.py,sha256=0r-BX4ptivIBNrsOAMgw0q5nNLrIU7UxJ3SD6MkfXX4,3543
83
83
  pygeai/core/embeddings/endpoints.py,sha256=b__cuKQjribog9PSUeDzwrQ0vBO4WyYahLhLjDiUpL0,98
@@ -164,7 +164,7 @@ pygeai/lab/strategies/clients.py,sha256=_a1yc8kwd50Yv4g1jqfa0gRnMiROR7Dn0gx3xqFU
164
164
  pygeai/lab/strategies/endpoints.py,sha256=LgEvUgeeN-X6VMl-tpl9_N12GRppLPScQmiMRk7Ri28,541
165
165
  pygeai/lab/strategies/mappers.py,sha256=6C_jubAVXMKLGQy5NUD0OX7SlrU2mLe2QsgzeJ1-WKw,2437
166
166
  pygeai/lab/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
167
- pygeai/lab/tools/clients.py,sha256=cjoNIdCTYqVIw4MpEnwtFt4HSGl1snYFSEEOo_jZWUs,26515
167
+ pygeai/lab/tools/clients.py,sha256=Jnc4AU_1fnEqhHOsey3AoKpNl1Pfw01qq_hDOmmDvE8,28394
168
168
  pygeai/lab/tools/endpoints.py,sha256=HiGoMs4OVeCgH7EAERTtifFPl53NryA1Awh7D6AO8bA,699
169
169
  pygeai/lab/tools/mappers.py,sha256=bYi5k36h0k4mCvOnV-r8YOHKz0U9P0mH21GNs20w2eM,4998
170
170
  pygeai/man/__init__.py,sha256=gqGI92vUPt6RPweoWX3mTUYPWNDlm6aGUjQOnYXqthk,53
@@ -495,9 +495,9 @@ pygeai/vendor/a2a/utils/helpers.py,sha256=6Tbd8SVfXvdNEk6WYmLOjrAxkzFf1aIg8dkFfB
495
495
  pygeai/vendor/a2a/utils/message.py,sha256=gc_EKO69CJ4HkR76IFgsy-kENJz1dn7CfSgWJWvt-gs,2197
496
496
  pygeai/vendor/a2a/utils/task.py,sha256=BYRA_L1HpoUGJAVlyHML0lCM9Awhf2Ovjj7oPFXKbh0,1647
497
497
  pygeai/vendor/a2a/utils/telemetry.py,sha256=VvSp1Ztqaobkmq9-3sNhhPEilJS32-JTSfKzegkj6FU,10861
498
- pygeai-0.4.0b6.dist-info/licenses/LICENSE,sha256=eHfqo7-AWS8cMq0cg03lq7owsLeCmZA-xS5L0kuHnl8,1474
499
- pygeai-0.4.0b6.dist-info/METADATA,sha256=Vw_S0OHG34fpDSiQqF_VexSPvyelYRGqn-Pf5og7Ack,6940
500
- pygeai-0.4.0b6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
501
- pygeai-0.4.0b6.dist-info/entry_points.txt,sha256=OAmwuXVCQBTCE3HeVegVd37hbhCcp9TPahvdrCuMYWw,178
502
- pygeai-0.4.0b6.dist-info/top_level.txt,sha256=bJFwp2tURmCfB94yXDF7ylvdSJXFDDJsyUOb-7PJgwc,7
503
- pygeai-0.4.0b6.dist-info/RECORD,,
498
+ pygeai-0.4.0b8.dist-info/licenses/LICENSE,sha256=eHfqo7-AWS8cMq0cg03lq7owsLeCmZA-xS5L0kuHnl8,1474
499
+ pygeai-0.4.0b8.dist-info/METADATA,sha256=L9KOzdMh6Dkg_M1dcgADWiJUDlF9VGV21f_4iUwvx6U,6940
500
+ pygeai-0.4.0b8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
501
+ pygeai-0.4.0b8.dist-info/entry_points.txt,sha256=OAmwuXVCQBTCE3HeVegVd37hbhCcp9TPahvdrCuMYWw,178
502
+ pygeai-0.4.0b8.dist-info/top_level.txt,sha256=bJFwp2tURmCfB94yXDF7ylvdSJXFDDJsyUOb-7PJgwc,7
503
+ pygeai-0.4.0b8.dist-info/RECORD,,