h2ogpte 1.6.38rc3__py3-none-any.whl → 1.6.40rc1__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 (35) hide show
  1. h2ogpte/__init__.py +1 -1
  2. h2ogpte/h2ogpte.py +122 -0
  3. h2ogpte/h2ogpte_async.py +123 -0
  4. h2ogpte/rest_async/__init__.py +8 -1
  5. h2ogpte/rest_async/api/agents_api.py +1181 -22
  6. h2ogpte/rest_async/api/permissions_api.py +550 -2
  7. h2ogpte/rest_async/api_client.py +1 -1
  8. h2ogpte/rest_async/configuration.py +1 -1
  9. h2ogpte/rest_async/models/__init__.py +7 -0
  10. h2ogpte/rest_async/models/add_custom_agent_tool201_response_inner.py +87 -0
  11. h2ogpte/rest_async/models/confirm_user_deletion_request.py +87 -0
  12. h2ogpte/rest_async/models/create_agent_tool_request.py +103 -0
  13. h2ogpte/rest_async/models/list_custom_agent_tools200_response_inner.py +95 -0
  14. h2ogpte/rest_async/models/prompt_template.py +3 -1
  15. h2ogpte/rest_async/models/update_custom_agent_tool200_response.py +87 -0
  16. h2ogpte/rest_async/models/update_custom_agent_tool_request.py +87 -0
  17. h2ogpte/rest_async/models/user_deletion_request.py +87 -0
  18. h2ogpte/rest_sync/__init__.py +8 -1
  19. h2ogpte/rest_sync/api/agents_api.py +1181 -22
  20. h2ogpte/rest_sync/api/permissions_api.py +550 -2
  21. h2ogpte/rest_sync/api_client.py +1 -1
  22. h2ogpte/rest_sync/configuration.py +1 -1
  23. h2ogpte/rest_sync/models/__init__.py +7 -0
  24. h2ogpte/rest_sync/models/add_custom_agent_tool201_response_inner.py +87 -0
  25. h2ogpte/rest_sync/models/confirm_user_deletion_request.py +87 -0
  26. h2ogpte/rest_sync/models/create_agent_tool_request.py +103 -0
  27. h2ogpte/rest_sync/models/list_custom_agent_tools200_response_inner.py +95 -0
  28. h2ogpte/rest_sync/models/prompt_template.py +3 -1
  29. h2ogpte/rest_sync/models/update_custom_agent_tool200_response.py +87 -0
  30. h2ogpte/rest_sync/models/update_custom_agent_tool_request.py +87 -0
  31. h2ogpte/rest_sync/models/user_deletion_request.py +87 -0
  32. {h2ogpte-1.6.38rc3.dist-info → h2ogpte-1.6.40rc1.dist-info}/METADATA +1 -1
  33. {h2ogpte-1.6.38rc3.dist-info → h2ogpte-1.6.40rc1.dist-info}/RECORD +35 -21
  34. {h2ogpte-1.6.38rc3.dist-info → h2ogpte-1.6.40rc1.dist-info}/WHEEL +0 -0
  35. {h2ogpte-1.6.38rc3.dist-info → h2ogpte-1.6.40rc1.dist-info}/top_level.txt +0 -0
h2ogpte/__init__.py CHANGED
@@ -3,7 +3,7 @@ from h2ogpte.h2ogpte import H2OGPTE
3
3
  from h2ogpte.h2ogpte_async import H2OGPTEAsync
4
4
  from h2ogpte.session_async import SessionAsync
5
5
 
6
- __version__ = "1.6.38rc3"
6
+ __version__ = "1.6.40rc1"
7
7
 
8
8
  __all__ = [
9
9
  "H2OGPTE",
h2ogpte/h2ogpte.py CHANGED
@@ -3335,6 +3335,54 @@ class H2OGPTE(H2OGPTESyncBase):
3335
3335
  )
3336
3336
  return [User(**d.to_dict()) for d in response]
3337
3337
 
3338
+ def request_current_user_deletion(
3339
+ self,
3340
+ ) -> str:
3341
+ """Request deletion of the current user account.
3342
+
3343
+ This creates a deletion request and returns a delete ID that must be used
3344
+ to confirm the deletion within 5 minutes.
3345
+
3346
+ Returns:
3347
+ str: Delete ID that must be used to confirm deletion.
3348
+ """
3349
+ header = self._get_auth_header()
3350
+ with self._RESTClient(self) as rest_client:
3351
+ response = _rest_to_client_exceptions(
3352
+ lambda: rest_client.permission_api.request_current_user_deletion(
3353
+ _headers=header,
3354
+ )
3355
+ )
3356
+ return response.delete_id
3357
+
3358
+ def confirm_current_user_deletion(
3359
+ self,
3360
+ delete_id: str,
3361
+ timeout: Union[float, None] = None,
3362
+ ) -> None:
3363
+ """Confirm deletion of the current user data.
3364
+
3365
+ Args:
3366
+ delete_id:
3367
+ The delete ID returned from request_current_user_deletion().
3368
+ timeout:
3369
+ Timeout in seconds. Default is 300 seconds.
3370
+ """
3371
+ header = self._get_auth_header()
3372
+ if timeout is None:
3373
+ timeout = 300.0
3374
+
3375
+ with self._RESTClient(self) as rest_client:
3376
+ _rest_to_client_exceptions(
3377
+ lambda: rest_client.permission_api.confirm_current_user_deletion(
3378
+ confirm_user_deletion_request=rest.ConfirmUserDeletionRequest(
3379
+ delete_id=delete_id,
3380
+ ),
3381
+ timeout=timeout,
3382
+ _headers=header,
3383
+ )
3384
+ )
3385
+
3338
3386
  def share_collection(
3339
3387
  self, collection_id: str, permission: SharePermission
3340
3388
  ) -> ShareResponseStatus:
@@ -6352,6 +6400,80 @@ class H2OGPTE(H2OGPTESyncBase):
6352
6400
  )
6353
6401
  return response.count
6354
6402
 
6403
+ def add_custom_agent_tool(
6404
+ self, tool_type: str, tool_args: dict, custom_tool_path: Optional[str] = None
6405
+ ) -> list:
6406
+ header = self._get_auth_header()
6407
+ custom_tool_path = str(custom_tool_path) if custom_tool_path else None
6408
+ with self._RESTClient(self) as rest_client:
6409
+ response = _rest_to_client_exceptions(
6410
+ lambda: rest_client.agent_api.add_custom_agent_tool(
6411
+ file=custom_tool_path,
6412
+ tool_type=tool_type,
6413
+ tool_args=json.dumps(tool_args),
6414
+ custom_tool_path=custom_tool_path,
6415
+ filename=os.path.basename(custom_tool_path)
6416
+ if custom_tool_path
6417
+ else None,
6418
+ _headers=header,
6419
+ )
6420
+ )
6421
+ return [obj.agent_custom_tool_id for obj in response]
6422
+
6423
+ def delete_custom_agent_tool(self, tool_ids: List[str]) -> int:
6424
+ header = self._get_auth_header()
6425
+ with self._RESTClient(self) as rest_client:
6426
+ response = _rest_to_client_exceptions(
6427
+ lambda: rest_client.agent_api.delete_custom_agent_tool(
6428
+ tool_ids=tool_ids,
6429
+ _headers=header,
6430
+ )
6431
+ )
6432
+ return response.count
6433
+
6434
+ def update_custom_agent_tool(
6435
+ self,
6436
+ tool_id: str,
6437
+ tool_args: dict,
6438
+ ) -> str:
6439
+ """Updates a custom agent tool's arguments.
6440
+
6441
+ Args:
6442
+ tool_id: The ID of the tool to update
6443
+ tool_args: New tool arguments
6444
+
6445
+ Returns:
6446
+ The updated tool ID
6447
+ """
6448
+ header = self._get_auth_header()
6449
+
6450
+ # Build request body with only tool_args
6451
+ request_obj = rest.UpdateCustomAgentToolRequest(tool_args=tool_args)
6452
+
6453
+ with self._RESTClient(self) as rest_client:
6454
+ response = _rest_to_client_exceptions(
6455
+ lambda: rest_client.agent_api.update_custom_agent_tool(
6456
+ tool_id=tool_id,
6457
+ update_custom_agent_tool_request=request_obj,
6458
+ _headers=header,
6459
+ )
6460
+ )
6461
+ return response.agent_custom_tool_id
6462
+
6463
+ def get_custom_agent_tools(self) -> List[dict]:
6464
+ """Gets all custom agent tools for the current user.
6465
+
6466
+ Returns:
6467
+ List[dict]: A list of custom agent tools with their details.
6468
+ Each tool contains: id, tool_name, tool_type, tool_args, owner_email
6469
+ """
6470
+ header = self._get_auth_header()
6471
+ with self._RESTClient(self) as rest_client:
6472
+ response = _rest_to_client_exceptions(
6473
+ lambda: rest_client.agent_api.list_custom_agent_tools(_headers=header)
6474
+ )
6475
+ return response
6476
+
6355
6477
  def set_role_priority(self, role_id: str, priority: int) -> UserRole:
6356
6478
  """Sets the priority for a role.
6357
6479
  Args:
h2ogpte/h2ogpte_async.py CHANGED
@@ -14,6 +14,7 @@ from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
14
14
  from collections import defaultdict
15
15
  from h2o_authn import AsyncTokenProvider
16
16
  from urllib.parse import quote
17
+ import os
17
18
 
18
19
  from h2ogpte import rest_async as rest
19
20
  from h2ogpte.errors import (
@@ -3530,6 +3531,54 @@ class H2OGPTEAsync:
3530
3531
  )
3531
3532
  return [User(**d.to_dict()) for d in response]
3532
3533
 
3534
+ async def request_current_user_deletion(
3535
+ self,
3536
+ ) -> str:
3537
+ """Request deletion of the current user account.
3538
+
3539
+ This creates a deletion request and returns a delete ID that must be used
3540
+ to confirm the deletion within 5 minutes.
3541
+
3542
+ Returns:
3543
+ str: Delete ID that must be used to confirm deletion.
3544
+ """
3545
+ header = await self._get_auth_header()
3546
+ async with self._RESTClient(self) as rest_client:
3547
+ response = await _rest_to_client_exceptions(
3548
+ rest_client.permission_api.request_current_user_deletion(
3549
+ _headers=header,
3550
+ )
3551
+ )
3552
+ return response.delete_id
3553
+
3554
+ async def confirm_current_user_deletion(
3555
+ self,
3556
+ delete_id: str,
3557
+ timeout: Union[float, None] = None,
3558
+ ) -> None:
3559
+ """Confirm deletion of the current user data.
3560
+
3561
+ Args:
3562
+ delete_id:
3563
+ The delete ID returned from request_current_user_deletion().
3564
+ timeout:
3565
+ Timeout in seconds. Default is 300 seconds.
3566
+ """
3567
+ header = await self._get_auth_header()
3568
+ if timeout is None:
3569
+ timeout = 300.0
3570
+
3571
+ async with self._RESTClient(self) as rest_client:
3572
+ await _rest_to_client_exceptions(
3573
+ rest_client.permission_api.confirm_current_user_deletion(
3574
+ confirm_user_deletion_request=rest.ConfirmUserDeletionRequest(
3575
+ delete_id=delete_id,
3576
+ ),
3577
+ timeout=timeout,
3578
+ _headers=header,
3579
+ )
3580
+ )
3581
+
3533
3582
  async def share_collection(
3534
3583
  self, collection_id: str, permission: SharePermission
3535
3584
  ) -> ShareResponseStatus:
@@ -6596,6 +6645,80 @@ class H2OGPTEAsync:
6596
6645
  )
6597
6646
  return response.count
6598
6647
 
6648
+ async def add_custom_agent_tool(
6649
+ self, tool_type: str, tool_args: dict, custom_tool_path: Optional[str] = None
6650
+ ) -> list:
6651
+ header = await self._get_auth_header()
6652
+ custom_tool_path = str(custom_tool_path) if custom_tool_path else None
6653
+ async with self._RESTClient(self) as rest_client:
6654
+ response = await _rest_to_client_exceptions(
6655
+ rest_client.agent_api.add_custom_agent_tool(
6656
+ file=custom_tool_path,
6657
+ tool_type=tool_type,
6658
+ tool_args=json.dumps(tool_args),
6659
+ custom_tool_path=custom_tool_path,
6660
+ filename=os.path.basename(custom_tool_path)
6661
+ if custom_tool_path
6662
+ else None,
6663
+ _headers=header,
6664
+ )
6665
+ )
6666
+ return [obj.agent_custom_tool_id for obj in response]
6667
+
6668
+ async def delete_custom_agent_tool(self, tool_ids: List[str]) -> int:
6669
+ header = await self._get_auth_header()
6670
+ async with self._RESTClient(self) as rest_client:
6671
+ response = await _rest_to_client_exceptions(
6672
+ rest_client.agent_api.delete_custom_agent_tool(
6673
+ tool_ids=tool_ids,
6674
+ _headers=header,
6675
+ )
6676
+ )
6677
+ return response.count
6678
+
6679
+ async def update_custom_agent_tool(
6680
+ self,
6681
+ tool_id: str,
6682
+ tool_args: dict,
6683
+ ) -> str:
6684
+ """Updates a custom agent tool's arguments.
6685
+
6686
+ Args:
6687
+ tool_id: The ID of the tool to update
6688
+ tool_args: New tool arguments
6689
+
6690
+ Returns:
6691
+ The updated tool ID
6692
+ """
6693
+ header = await self._get_auth_header()
6694
+
6695
+ # Build request body with only tool_args
6696
+ request_obj = rest.UpdateCustomAgentToolRequest(tool_args=tool_args)
6697
+
6698
+ async with self._RESTClient(self) as rest_client:
6699
+ response = await _rest_to_client_exceptions(
6700
+ rest_client.agent_api.update_custom_agent_tool(
6701
+ tool_id=tool_id,
6702
+ update_custom_agent_tool_request=request_obj,
6703
+ _headers=header,
6704
+ )
6705
+ )
6706
+ return response.agent_custom_tool_id
6707
+
6708
+ async def get_custom_agent_tools(self) -> List[dict]:
6709
+ """Gets all custom agent tools for the current user.
6710
+
6711
+ Returns:
6712
+ List[dict]: A list of custom agent tools with their details.
6713
+ Each tool contains: id, tool_name, tool_type, tool_args, owner_email
6714
+ """
6715
+ header = await self._get_auth_header()
6716
+ async with self._RESTClient(self) as rest_client:
6717
+ response = await _rest_to_client_exceptions(
6718
+ rest_client.agent_api.list_custom_agent_tools(_headers=header)
6719
+ )
6720
+ return response
6721
+
6599
6722
  async def set_role_priority(self, role_id: str, priority: int) -> UserRole:
6600
6723
  """Sets the priority for a role.
6601
6724
  Args:
@@ -14,7 +14,7 @@
14
14
  """ # noqa: E501
15
15
 
16
16
 
17
- __version__ = "1.6.38-dev3"
17
+ __version__ = "1.6.40-dev1"
18
18
 
19
19
  # import apis into sdk package
20
20
  from h2ogpte.rest_async.api.api_keys_api import APIKeysApi
@@ -48,6 +48,7 @@ from h2ogpte.rest_async.models.api_key_create_request import APIKeyCreateRequest
48
48
  from h2ogpte.rest_async.models.api_key_info import APIKeyInfo
49
49
  from h2ogpte.rest_async.models.api_key_result import APIKeyResult
50
50
  from h2ogpte.rest_async.models.api_key_update_expiry_request import APIKeyUpdateExpiryRequest
51
+ from h2ogpte.rest_async.models.add_custom_agent_tool201_response_inner import AddCustomAgentTool201ResponseInner
51
52
  from h2ogpte.rest_async.models.agent_key import AgentKey
52
53
  from h2ogpte.rest_async.models.agent_server_directory_file_stats import AgentServerDirectoryFileStats
53
54
  from h2ogpte.rest_async.models.agent_server_directory_stats import AgentServerDirectoryStats
@@ -74,10 +75,12 @@ from h2ogpte.rest_async.models.collection_change_request import CollectionChange
74
75
  from h2ogpte.rest_async.models.collection_create_request import CollectionCreateRequest
75
76
  from h2ogpte.rest_async.models.collection_settings import CollectionSettings
76
77
  from h2ogpte.rest_async.models.collection_update_request import CollectionUpdateRequest
78
+ from h2ogpte.rest_async.models.confirm_user_deletion_request import ConfirmUserDeletionRequest
77
79
  from h2ogpte.rest_async.models.count import Count
78
80
  from h2ogpte.rest_async.models.count_with_queue_details import CountWithQueueDetails
79
81
  from h2ogpte.rest_async.models.create_agent_key_request import CreateAgentKeyRequest
80
82
  from h2ogpte.rest_async.models.create_agent_tool_key_associations_request import CreateAgentToolKeyAssociationsRequest
83
+ from h2ogpte.rest_async.models.create_agent_tool_request import CreateAgentToolRequest
81
84
  from h2ogpte.rest_async.models.create_import_collection_to_collection_job_request import CreateImportCollectionToCollectionJobRequest
82
85
  from h2ogpte.rest_async.models.create_insert_document_to_collection_job_request import CreateInsertDocumentToCollectionJobRequest
83
86
  from h2ogpte.rest_async.models.create_secret201_response import CreateSecret201Response
@@ -112,6 +115,7 @@ from h2ogpte.rest_async.models.ingest_upload_body import IngestUploadBody
112
115
  from h2ogpte.rest_async.models.job_details import JobDetails
113
116
  from h2ogpte.rest_async.models.job_details_status import JobDetailsStatus
114
117
  from h2ogpte.rest_async.models.key_association import KeyAssociation
118
+ from h2ogpte.rest_async.models.list_custom_agent_tools200_response_inner import ListCustomAgentTools200ResponseInner
115
119
  from h2ogpte.rest_async.models.match_collection_chunks_request import MatchCollectionChunksRequest
116
120
  from h2ogpte.rest_async.models.message_vote_update_request import MessageVoteUpdateRequest
117
121
  from h2ogpte.rest_async.models.model import Model
@@ -154,6 +158,8 @@ from h2ogpte.rest_async.models.update_agent_tool_preference_request import Updat
154
158
  from h2ogpte.rest_async.models.update_collection_expiry_date_request import UpdateCollectionExpiryDateRequest
155
159
  from h2ogpte.rest_async.models.update_collection_inactivity_interval_request import UpdateCollectionInactivityIntervalRequest
156
160
  from h2ogpte.rest_async.models.update_collection_privacy_request import UpdateCollectionPrivacyRequest
161
+ from h2ogpte.rest_async.models.update_custom_agent_tool200_response import UpdateCustomAgentTool200Response
162
+ from h2ogpte.rest_async.models.update_custom_agent_tool_request import UpdateCustomAgentToolRequest
157
163
  from h2ogpte.rest_async.models.update_default_prompt_template_visibility_request import UpdateDefaultPromptTemplateVisibilityRequest
158
164
  from h2ogpte.rest_async.models.update_prompt_template_privacy_request import UpdatePromptTemplatePrivacyRequest
159
165
  from h2ogpte.rest_async.models.update_qa_feedback_request import UpdateQAFeedbackRequest
@@ -164,6 +170,7 @@ from h2ogpte.rest_async.models.usage_stats_per_model import UsageStatsPerModel
164
170
  from h2ogpte.rest_async.models.usage_stats_per_model_and_user import UsageStatsPerModelAndUser
165
171
  from h2ogpte.rest_async.models.usage_stats_per_user import UsageStatsPerUser
166
172
  from h2ogpte.rest_async.models.user_configuration_item import UserConfigurationItem
173
+ from h2ogpte.rest_async.models.user_deletion_request import UserDeletionRequest
167
174
  from h2ogpte.rest_async.models.user_info import UserInfo
168
175
  from h2ogpte.rest_async.models.user_job_details import UserJobDetails
169
176
  from h2ogpte.rest_async.models.user_permission import UserPermission