pygeai 0.4.0b7__py3-none-any.whl → 0.4.0b9__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.
@@ -0,0 +1,8 @@
1
+ from pygeai.cli.commands import Option
2
+
3
+ PROJECT_ID_OPTION = Option(
4
+ "project_id",
5
+ ["--project-id", "--pid"],
6
+ "GUID of the project (optional)",
7
+ True
8
+ )
@@ -55,5 +55,6 @@ class InvalidAgentException(GEAIException):
55
55
  pass
56
56
 
57
57
 
58
-
58
+ class APIResponseError(GEAIException):
59
+ pass
59
60
 
pygeai/lab/clients.py CHANGED
@@ -6,9 +6,9 @@ from pygeai.core.common.exceptions import APIError
6
6
 
7
7
  class AILabClient(BaseClient):
8
8
 
9
- def __init__(self, api_key: str = None, base_url: str = None, alias: str = None):
9
+ def __init__(self, api_key: str = None, base_url: str = None, alias: str = None, project_id: str = None):
10
10
  super().__init__(api_key, base_url, alias)
11
- self.project_id = self.__get_project_id()
11
+ self.project_id = project_id if project_id else self.__get_project_id()
12
12
 
13
13
  def __get_project_id(self):
14
14
  response = None
pygeai/lab/managers.py CHANGED
@@ -22,11 +22,11 @@ from pygeai.lab.tools.mappers import ToolMapper
22
22
 
23
23
  class AILabManager:
24
24
 
25
- def __init__(self, api_key: str = None, base_url: str = None, alias: str = "default"):
26
- self.__agent_client = AgentClient(api_key=api_key, base_url=base_url, alias=alias)
27
- self.__tool_client = ToolClient(api_key=api_key, base_url=base_url, alias=alias)
28
- self.__reasoning_strategy_client = ReasoningStrategyClient(api_key=api_key, base_url=base_url, alias=alias)
29
- self.__process_client = AgenticProcessClient(api_key=api_key, base_url=base_url, alias=alias)
25
+ def __init__(self, api_key: str = None, base_url: str = None, alias: str = "default", project_id: str = None):
26
+ self.__agent_client = AgentClient(api_key=api_key, base_url=base_url, alias=alias, project_id=project_id)
27
+ self.__tool_client = ToolClient(api_key=api_key, base_url=base_url, alias=alias, project_id=project_id)
28
+ self.__reasoning_strategy_client = ReasoningStrategyClient(api_key=api_key, base_url=base_url, alias=alias, project_id=project_id)
29
+ self.__process_client = AgenticProcessClient(api_key=api_key, base_url=base_url, alias=alias, project_id=project_id)
30
30
 
31
31
  def get_agent_list(
32
32
  self,
@@ -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
- response.raise_for_status()
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,7 +168,9 @@ class ToolClient(AILabClient):
166
168
  "allowExternal": allow_external
167
169
  }
168
170
  )
169
- response.raise_for_status()
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}")
170
174
  try:
171
175
  result = response.json()
172
176
  except JSONDecodeError as e:
@@ -208,7 +212,9 @@ class ToolClient(AILabClient):
208
212
  "allowDrafts": allow_drafts,
209
213
  }
210
214
  )
211
- response.raise_for_status()
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}")
212
218
  try:
213
219
  result = response.json()
214
220
  except JSONDecodeError as e:
@@ -249,7 +255,9 @@ class ToolClient(AILabClient):
249
255
  endpoint=endpoint,
250
256
  headers=headers
251
257
  )
252
- response.raise_for_status()
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}")
253
261
 
254
262
  if response.status_code != 204:
255
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}")
@@ -259,7 +267,7 @@ class ToolClient(AILabClient):
259
267
 
260
268
  def update_tool(
261
269
  self,
262
- tool_id: str,
270
+ tool_id: str = None,
263
271
  name: str = None,
264
272
  description: str = None,
265
273
  scope: str = None,
@@ -316,6 +324,8 @@ class ToolClient(AILabClient):
316
324
  :raises JSONDecodeError: Caught internally if the response cannot be parsed as JSON; returns raw response text.
317
325
  :raises Exception: May be raised by `api_service.put` for network issues, authentication errors, or server-side problems (not caught here).
318
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.")
319
329
  if scope and scope not in VALID_SCOPES:
320
330
  raise ValueError(f"Scope must be one of {', '.join(VALID_SCOPES)}.")
321
331
  if access_scope and access_scope not in VALID_ACCESS_SCOPES:
@@ -365,7 +375,9 @@ class ToolClient(AILabClient):
365
375
  headers=headers,
366
376
  data=data
367
377
  )
368
- response.raise_for_status()
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}")
369
381
  try:
370
382
  result = response.json()
371
383
  except JSONDecodeError as e:
@@ -451,7 +463,9 @@ class ToolClient(AILabClient):
451
463
  "allowDrafts": allow_drafts,
452
464
  }
453
465
  )
454
- response.raise_for_status()
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}")
455
469
  try:
456
470
  result = response.json()
457
471
  except JSONDecodeError as e:
@@ -506,7 +520,9 @@ class ToolClient(AILabClient):
506
520
  headers=headers,
507
521
  data=data
508
522
  )
509
- response.raise_for_status()
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}")
510
526
  try:
511
527
  result = response.json()
512
528
  except JSONDecodeError as e:
@@ -543,7 +559,9 @@ class ToolClient(AILabClient):
543
559
  endpoint=endpoint,
544
560
  headers=headers,
545
561
  )
546
- response.raise_for_status()
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}")
547
565
  try:
548
566
  result = response.json()
549
567
  except JSONDecodeError as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygeai
3
- Version: 0.4.0b7
3
+ Version: 0.4.0b9
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
@@ -57,8 +57,9 @@ pygeai/cli/commands/validators.py,sha256=lNtYSJvKFrEeg_h0oYURMuoQbNG5r6QdjzDL-aT
57
57
  pygeai/cli/commands/version.py,sha256=vyJcnxwL_TfpOQI0yE2a1ZyA3VRAE7ssh9APNBXpmqk,1701
58
58
  pygeai/cli/commands/flows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  pygeai/cli/commands/lab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
- pygeai/cli/commands/lab/ai_lab.py,sha256=mS6QtRuCjQvA71CTD657tUYYvtw_mtDWLsGvzARSi2U,122999
60
+ pygeai/cli/commands/lab/ai_lab.py,sha256=Ecvp8E6tlEh56sPsmcAwYF0CjNn3zdJwggs-BmtdKqU,129292
61
61
  pygeai/cli/commands/lab/common.py,sha256=YBenPCVgK01Xaxgj1429bp_Ri1SN4beBxZk3dCLp7X0,6590
62
+ pygeai/cli/commands/lab/options.py,sha256=T13Vi97zochr0cU4yjyvvwWRPENILFDYpvqpU4uEBis,165
62
63
  pygeai/cli/commands/lab/spec.py,sha256=EjNdEnljKpYPQyT4d4ViAPrM1g7oIitv6ddnWVkWXPk,8301
63
64
  pygeai/cli/commands/lab/utils.py,sha256=uxhgHvCRrV6WYRxR2qd3nED_hhXcxJ1tAU8MlzoshEg,456
64
65
  pygeai/cli/texts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -77,7 +78,7 @@ pygeai/core/base/session.py,sha256=WVb4MmptwdgK7paHOSvfEle_HPXRRXO8CHgi0qbgtOg,2
77
78
  pygeai/core/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
79
  pygeai/core/common/config.py,sha256=zrlNF-0AE54qZ-XpR0RgYzM_7v8LtS0jUpM7UXrbSqQ,4475
79
80
  pygeai/core/common/decorators.py,sha256=X7Tv5XBmsuS7oZHSmI95eX8UkuukKoiOiNRl5w9lgR4,1227
80
- pygeai/core/common/exceptions.py,sha256=hfyCj5iLuWJzg93rGrR9wpVESGnq6Dq0HJQBuuitNo0,1204
81
+ pygeai/core/common/exceptions.py,sha256=-eF4V0B-27zfp0aHMlZWqWRIty6P7TCOrzMRW87ZnlE,1251
81
82
  pygeai/core/embeddings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
83
  pygeai/core/embeddings/clients.py,sha256=0r-BX4ptivIBNrsOAMgw0q5nNLrIU7UxJ3SD6MkfXX4,3543
83
84
  pygeai/core/embeddings/endpoints.py,sha256=b__cuKQjribog9PSUeDzwrQ0vBO4WyYahLhLjDiUpL0,98
@@ -143,9 +144,9 @@ pygeai/health/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
143
144
  pygeai/health/clients.py,sha256=U2eb1tkXt1Rf_KdV0ZFQS2k4wGnJTXHHd9-Er0eWQuw,1011
144
145
  pygeai/health/endpoints.py,sha256=UAzMcqSXZtMj4r8M8B7a_a5LT6X_jMFNsCTvcsjNTYA,71
145
146
  pygeai/lab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
146
- pygeai/lab/clients.py,sha256=mhtJw_cEFC1Cd6KIrcX6KxcRseKN3N_GtjlyUlLaah4,762
147
+ pygeai/lab/clients.py,sha256=5JebyNpKCVwAQpeOAkJPIHRf_6hoKA3uUm9xewm01UQ,816
147
148
  pygeai/lab/constants.py,sha256=ddgDnXP4GD0woi-FUJaJXzaWS3H6zmDN0B-v8utM95Q,170
148
- pygeai/lab/managers.py,sha256=eDnT31n-xPUcK_Hjfe9FXjz6dAwAqmrbaYZ6XEHonQE,70554
149
+ pygeai/lab/managers.py,sha256=_i9tQACTGblKkw05WMu5RLpCYlyL2PtLvNI42F11u8Y,70670
149
150
  pygeai/lab/models.py,sha256=1m41gSqpXZVO9AcPVxzlsC-TgxZcCsgGUbpN5zoDMjU,71451
150
151
  pygeai/lab/runners.py,sha256=-uaCPHpFyiKtVOxlEjPjAc9h-onSdGAcYJ5IAZPqlb0,4147
151
152
  pygeai/lab/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -164,7 +165,7 @@ pygeai/lab/strategies/clients.py,sha256=_a1yc8kwd50Yv4g1jqfa0gRnMiROR7Dn0gx3xqFU
164
165
  pygeai/lab/strategies/endpoints.py,sha256=LgEvUgeeN-X6VMl-tpl9_N12GRppLPScQmiMRk7Ri28,541
165
166
  pygeai/lab/strategies/mappers.py,sha256=6C_jubAVXMKLGQy5NUD0OX7SlrU2mLe2QsgzeJ1-WKw,2437
166
167
  pygeai/lab/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
167
- pygeai/lab/tools/clients.py,sha256=KkXLvZ8PRUZHP4X-YrvezdC2B2lf4MZYzRhdOmEbGWw,26801
168
+ pygeai/lab/tools/clients.py,sha256=Jnc4AU_1fnEqhHOsey3AoKpNl1Pfw01qq_hDOmmDvE8,28394
168
169
  pygeai/lab/tools/endpoints.py,sha256=HiGoMs4OVeCgH7EAERTtifFPl53NryA1Awh7D6AO8bA,699
169
170
  pygeai/lab/tools/mappers.py,sha256=bYi5k36h0k4mCvOnV-r8YOHKz0U9P0mH21GNs20w2eM,4998
170
171
  pygeai/man/__init__.py,sha256=gqGI92vUPt6RPweoWX3mTUYPWNDlm6aGUjQOnYXqthk,53
@@ -495,9 +496,9 @@ pygeai/vendor/a2a/utils/helpers.py,sha256=6Tbd8SVfXvdNEk6WYmLOjrAxkzFf1aIg8dkFfB
495
496
  pygeai/vendor/a2a/utils/message.py,sha256=gc_EKO69CJ4HkR76IFgsy-kENJz1dn7CfSgWJWvt-gs,2197
496
497
  pygeai/vendor/a2a/utils/task.py,sha256=BYRA_L1HpoUGJAVlyHML0lCM9Awhf2Ovjj7oPFXKbh0,1647
497
498
  pygeai/vendor/a2a/utils/telemetry.py,sha256=VvSp1Ztqaobkmq9-3sNhhPEilJS32-JTSfKzegkj6FU,10861
498
- pygeai-0.4.0b7.dist-info/licenses/LICENSE,sha256=eHfqo7-AWS8cMq0cg03lq7owsLeCmZA-xS5L0kuHnl8,1474
499
- pygeai-0.4.0b7.dist-info/METADATA,sha256=M_uGUknAyMR5q6rhNQZDL43yZWMqhQup34VJVMmhzgU,6940
500
- pygeai-0.4.0b7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
501
- pygeai-0.4.0b7.dist-info/entry_points.txt,sha256=OAmwuXVCQBTCE3HeVegVd37hbhCcp9TPahvdrCuMYWw,178
502
- pygeai-0.4.0b7.dist-info/top_level.txt,sha256=bJFwp2tURmCfB94yXDF7ylvdSJXFDDJsyUOb-7PJgwc,7
503
- pygeai-0.4.0b7.dist-info/RECORD,,
499
+ pygeai-0.4.0b9.dist-info/licenses/LICENSE,sha256=eHfqo7-AWS8cMq0cg03lq7owsLeCmZA-xS5L0kuHnl8,1474
500
+ pygeai-0.4.0b9.dist-info/METADATA,sha256=vYLI-sOMXnaeMkEDUFZlbXyx4cgYVgPFJNqsqHuVT90,6940
501
+ pygeai-0.4.0b9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
502
+ pygeai-0.4.0b9.dist-info/entry_points.txt,sha256=OAmwuXVCQBTCE3HeVegVd37hbhCcp9TPahvdrCuMYWw,178
503
+ pygeai-0.4.0b9.dist-info/top_level.txt,sha256=bJFwp2tURmCfB94yXDF7ylvdSJXFDDJsyUOb-7PJgwc,7
504
+ pygeai-0.4.0b9.dist-info/RECORD,,