h2ogpte 1.6.38rc3__py3-none-any.whl → 1.6.40__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.
- h2ogpte/__init__.py +1 -1
- h2ogpte/errors.py +0 -4
- h2ogpte/h2ogpte.py +71 -369
- h2ogpte/h2ogpte_async.py +75 -374
- h2ogpte/h2ogpte_sync_base.py +0 -5
- h2ogpte/rest_async/__init__.py +3 -8
- h2ogpte/rest_async/api/__init__.py +0 -1
- h2ogpte/rest_async/api/configurations_api.py +137 -1006
- h2ogpte/rest_async/api/permissions_api.py +429 -177
- h2ogpte/rest_async/api/prompt_templates_api.py +303 -1240
- h2ogpte/rest_async/api_client.py +1 -1
- h2ogpte/rest_async/configuration.py +1 -1
- h2ogpte/rest_async/models/__init__.py +2 -6
- h2ogpte/rest_async/models/{create_secret201_response.py → confirm_user_deletion_request.py} +8 -8
- h2ogpte/rest_async/models/prompt_template.py +2 -8
- h2ogpte/rest_async/models/role_info.py +3 -5
- h2ogpte/rest_async/models/{update_secret_request.py → user_deletion_request.py} +8 -8
- h2ogpte/rest_sync/__init__.py +3 -8
- h2ogpte/rest_sync/api/__init__.py +0 -1
- h2ogpte/rest_sync/api/configurations_api.py +137 -1006
- h2ogpte/rest_sync/api/permissions_api.py +429 -177
- h2ogpte/rest_sync/api/prompt_templates_api.py +303 -1240
- h2ogpte/rest_sync/api_client.py +1 -1
- h2ogpte/rest_sync/configuration.py +1 -1
- h2ogpte/rest_sync/models/__init__.py +2 -6
- h2ogpte/rest_sync/models/{create_secret201_response.py → confirm_user_deletion_request.py} +8 -8
- h2ogpte/rest_sync/models/prompt_template.py +2 -8
- h2ogpte/rest_sync/models/role_info.py +3 -5
- h2ogpte/rest_sync/models/{update_secret_request.py → user_deletion_request.py} +8 -8
- h2ogpte/types.py +4 -10
- {h2ogpte-1.6.38rc3.dist-info → h2ogpte-1.6.40.dist-info}/METADATA +1 -1
- {h2ogpte-1.6.38rc3.dist-info → h2ogpte-1.6.40.dist-info}/RECORD +34 -44
- h2ogpte/rest_async/api/secrets_api.py +0 -1698
- h2ogpte/rest_async/models/create_secret_request.py +0 -101
- h2ogpte/rest_async/models/set_role_priority_request.py +0 -87
- h2ogpte/rest_async/models/update_default_prompt_template_visibility_request.py +0 -87
- h2ogpte/rest_async/models/update_prompt_template_privacy_request.py +0 -87
- h2ogpte/rest_sync/api/secrets_api.py +0 -1698
- h2ogpte/rest_sync/models/create_secret_request.py +0 -101
- h2ogpte/rest_sync/models/set_role_priority_request.py +0 -87
- h2ogpte/rest_sync/models/update_default_prompt_template_visibility_request.py +0 -87
- h2ogpte/rest_sync/models/update_prompt_template_privacy_request.py +0 -87
- {h2ogpte-1.6.38rc3.dist-info → h2ogpte-1.6.40.dist-info}/WHEEL +0 -0
- {h2ogpte-1.6.38rc3.dist-info → h2ogpte-1.6.40.dist-info}/top_level.txt +0 -0
h2ogpte/__init__.py
CHANGED
h2ogpte/errors.py
CHANGED
h2ogpte/h2ogpte.py
CHANGED
|
@@ -2286,111 +2286,6 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
2286
2286
|
)
|
|
2287
2287
|
return self._wait_for_completion(response.id, timeout=timeout)
|
|
2288
2288
|
|
|
2289
|
-
def list_secret_ids(self, connector_type: Optional[str] = None) -> List[str]:
|
|
2290
|
-
"""
|
|
2291
|
-
List available secret IDs from the SecureStore for cloud storage connectors.
|
|
2292
|
-
|
|
2293
|
-
Args:
|
|
2294
|
-
connector_type: Type of connector ('s3', 'gcs', 'azure_key', 'azure_sas')
|
|
2295
|
-
If None, returns secrets for all connector types.
|
|
2296
|
-
|
|
2297
|
-
Returns:
|
|
2298
|
-
List of secret IDs available for the specified connector type
|
|
2299
|
-
"""
|
|
2300
|
-
self._init_rest()
|
|
2301
|
-
header = self._get_auth_header()
|
|
2302
|
-
response = _rest_to_client_exceptions(
|
|
2303
|
-
lambda: self._secrets_api.list_secret_ids(
|
|
2304
|
-
connector_type=connector_type, _headers=header
|
|
2305
|
-
)
|
|
2306
|
-
)
|
|
2307
|
-
return response.ids
|
|
2308
|
-
|
|
2309
|
-
def get_secret(self, secret_id: str) -> Union[Dict[str, Any], None]:
|
|
2310
|
-
"""Get a secret from the SecureStore by its ID.
|
|
2311
|
-
|
|
2312
|
-
Args:
|
|
2313
|
-
secret_id: The ID of the secret to retrieve.
|
|
2314
|
-
|
|
2315
|
-
Returns:
|
|
2316
|
-
The secret object corresponding to the provided ID.
|
|
2317
|
-
"""
|
|
2318
|
-
self._init_rest()
|
|
2319
|
-
header = self._get_auth_header()
|
|
2320
|
-
response = _rest_to_client_exceptions(
|
|
2321
|
-
lambda: self._secrets_api.get_secret(secret_id=secret_id, _headers=header)
|
|
2322
|
-
)
|
|
2323
|
-
return response.to_dict()
|
|
2324
|
-
|
|
2325
|
-
def get_secret_value(self, secret_id: str) -> Union[str, None]:
|
|
2326
|
-
"""Get the value of a secret from the SecureStore by its ID.
|
|
2327
|
-
|
|
2328
|
-
Args:
|
|
2329
|
-
secret_id: The ID of the secret to retrieve.
|
|
2330
|
-
|
|
2331
|
-
Returns:
|
|
2332
|
-
The value of the secret corresponding to the provided ID.
|
|
2333
|
-
"""
|
|
2334
|
-
self._init_rest()
|
|
2335
|
-
header = self._get_auth_header()
|
|
2336
|
-
response = _rest_to_client_exceptions(
|
|
2337
|
-
lambda: self._secrets_api.get_secret_value(
|
|
2338
|
-
secret_id=secret_id, _headers=header
|
|
2339
|
-
)
|
|
2340
|
-
)
|
|
2341
|
-
return response.value if response else None
|
|
2342
|
-
|
|
2343
|
-
def create_secret(self, secret: Dict[str, Any]) -> None:
|
|
2344
|
-
"""Create a new secret in the SecureStore.
|
|
2345
|
-
|
|
2346
|
-
Args:
|
|
2347
|
-
secret: A dictionary containing the secret data to be stored.
|
|
2348
|
-
|
|
2349
|
-
Returns:
|
|
2350
|
-
The ID of the newly created secret.
|
|
2351
|
-
"""
|
|
2352
|
-
self._init_rest()
|
|
2353
|
-
header = self._get_auth_header()
|
|
2354
|
-
response = _rest_to_client_exceptions(
|
|
2355
|
-
lambda: self._secrets_api.create_secret(secret=secret, _headers=header)
|
|
2356
|
-
)
|
|
2357
|
-
return response.id
|
|
2358
|
-
|
|
2359
|
-
def update_secret(self, secret_id: str, secret: Dict[str, Any]) -> None:
|
|
2360
|
-
"""Update an existing secret in the SecureStore.
|
|
2361
|
-
|
|
2362
|
-
Args:
|
|
2363
|
-
secret_id: The ID of the secret to update.
|
|
2364
|
-
secret: A dictionary containing the updated secret data.
|
|
2365
|
-
|
|
2366
|
-
Returns:
|
|
2367
|
-
None
|
|
2368
|
-
"""
|
|
2369
|
-
self._init_rest()
|
|
2370
|
-
header = self._get_auth_header()
|
|
2371
|
-
_rest_to_client_exceptions(
|
|
2372
|
-
lambda: self._secrets_api.update_secret(
|
|
2373
|
-
secret_id=secret_id, secret=secret, _headers=header
|
|
2374
|
-
)
|
|
2375
|
-
)
|
|
2376
|
-
|
|
2377
|
-
def delete_secret(self, secret_id: str) -> None:
|
|
2378
|
-
"""Delete a secret from the SecureStore by its ID.
|
|
2379
|
-
|
|
2380
|
-
Args:
|
|
2381
|
-
secret_id: The ID of the secret to delete.
|
|
2382
|
-
|
|
2383
|
-
Returns:
|
|
2384
|
-
None
|
|
2385
|
-
"""
|
|
2386
|
-
self._init_rest()
|
|
2387
|
-
header = self._get_auth_header()
|
|
2388
|
-
_rest_to_client_exceptions(
|
|
2389
|
-
lambda: self._secrets_api.delete_secret(
|
|
2390
|
-
secret_id=secret_id, _headers=header
|
|
2391
|
-
)
|
|
2392
|
-
)
|
|
2393
|
-
|
|
2394
2289
|
def ingest_uploads(
|
|
2395
2290
|
self,
|
|
2396
2291
|
collection_id: str,
|
|
@@ -3335,6 +3230,54 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
3335
3230
|
)
|
|
3336
3231
|
return [User(**d.to_dict()) for d in response]
|
|
3337
3232
|
|
|
3233
|
+
def request_current_user_deletion(
|
|
3234
|
+
self,
|
|
3235
|
+
) -> str:
|
|
3236
|
+
"""Request deletion of the current user account.
|
|
3237
|
+
|
|
3238
|
+
This creates a deletion request and returns a delete ID that must be used
|
|
3239
|
+
to confirm the deletion within 5 minutes.
|
|
3240
|
+
|
|
3241
|
+
Returns:
|
|
3242
|
+
str: Delete ID that must be used to confirm deletion.
|
|
3243
|
+
"""
|
|
3244
|
+
header = self._get_auth_header()
|
|
3245
|
+
with self._RESTClient(self) as rest_client:
|
|
3246
|
+
response = _rest_to_client_exceptions(
|
|
3247
|
+
lambda: rest_client.permission_api.request_current_user_deletion(
|
|
3248
|
+
_headers=header,
|
|
3249
|
+
)
|
|
3250
|
+
)
|
|
3251
|
+
return response.delete_id
|
|
3252
|
+
|
|
3253
|
+
def confirm_current_user_deletion(
|
|
3254
|
+
self,
|
|
3255
|
+
delete_id: str,
|
|
3256
|
+
timeout: Union[float, None] = None,
|
|
3257
|
+
) -> None:
|
|
3258
|
+
"""Confirm deletion of the current user data.
|
|
3259
|
+
|
|
3260
|
+
Args:
|
|
3261
|
+
delete_id:
|
|
3262
|
+
The delete ID returned from request_current_user_deletion().
|
|
3263
|
+
timeout:
|
|
3264
|
+
Timeout in seconds. Default is 300 seconds.
|
|
3265
|
+
"""
|
|
3266
|
+
header = self._get_auth_header()
|
|
3267
|
+
if timeout is None:
|
|
3268
|
+
timeout = 300.0
|
|
3269
|
+
|
|
3270
|
+
with self._RESTClient(self) as rest_client:
|
|
3271
|
+
_rest_to_client_exceptions(
|
|
3272
|
+
lambda: rest_client.permission_api.confirm_current_user_deletion(
|
|
3273
|
+
confirm_user_deletion_request=rest.ConfirmUserDeletionRequest(
|
|
3274
|
+
delete_id=delete_id,
|
|
3275
|
+
),
|
|
3276
|
+
timeout=timeout,
|
|
3277
|
+
_headers=header,
|
|
3278
|
+
)
|
|
3279
|
+
)
|
|
3280
|
+
|
|
3338
3281
|
def share_collection(
|
|
3339
3282
|
self, collection_id: str, permission: SharePermission
|
|
3340
3283
|
) -> ShareResponseStatus:
|
|
@@ -4335,78 +4278,6 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
4335
4278
|
)
|
|
4336
4279
|
return [PromptTemplate(**d.to_dict()) for d in response]
|
|
4337
4280
|
|
|
4338
|
-
def list_all_recent_prompt_templates(
|
|
4339
|
-
self, offset: int, limit: int
|
|
4340
|
-
) -> List[PromptTemplate]:
|
|
4341
|
-
"""Fetch user's prompt templates sorted by last update time.
|
|
4342
|
-
|
|
4343
|
-
Note: Users with permission to manage prompt templates can use this to list hidden default prompt templates.
|
|
4344
|
-
|
|
4345
|
-
Args:
|
|
4346
|
-
offset:
|
|
4347
|
-
How many prompt templates to skip before returning.
|
|
4348
|
-
limit:
|
|
4349
|
-
How many prompt templates to return.
|
|
4350
|
-
|
|
4351
|
-
Returns:
|
|
4352
|
-
list of PromptTemplate: set of prompts
|
|
4353
|
-
"""
|
|
4354
|
-
header = self._get_auth_header()
|
|
4355
|
-
with self._RESTClient(self) as rest_client:
|
|
4356
|
-
response = _rest_to_client_exceptions(
|
|
4357
|
-
lambda: rest_client.prompt_template_api.list_all_prompt_templates(
|
|
4358
|
-
offset=offset,
|
|
4359
|
-
limit=limit,
|
|
4360
|
-
_headers=header,
|
|
4361
|
-
)
|
|
4362
|
-
)
|
|
4363
|
-
return [PromptTemplate(**d.to_dict()) for d in response]
|
|
4364
|
-
|
|
4365
|
-
def list_all_recent_prompt_templates_sort(
|
|
4366
|
-
self,
|
|
4367
|
-
offset: int,
|
|
4368
|
-
limit: int,
|
|
4369
|
-
sort_column: str,
|
|
4370
|
-
ascending: bool,
|
|
4371
|
-
template_type: str = "all",
|
|
4372
|
-
filter: str = "",
|
|
4373
|
-
) -> List[PromptTemplate]:
|
|
4374
|
-
"""Fetch user's prompt templates sorted by last update time.
|
|
4375
|
-
|
|
4376
|
-
Note: Users with permission to manage prompt templates can use this to list hidden default prompt templates.
|
|
4377
|
-
|
|
4378
|
-
Args:
|
|
4379
|
-
offset:
|
|
4380
|
-
How many prompt templates to skip before returning.
|
|
4381
|
-
limit:
|
|
4382
|
-
How many prompt templates to return.
|
|
4383
|
-
sort_column:
|
|
4384
|
-
Sort column.
|
|
4385
|
-
ascending:
|
|
4386
|
-
When True, return sorted by sort_column in ascending order.
|
|
4387
|
-
template_type:
|
|
4388
|
-
When set, will be used as a type filter, possible values are: all, user, system.
|
|
4389
|
-
filter:
|
|
4390
|
-
When set, will be used as a filter on some prompt template columns.
|
|
4391
|
-
|
|
4392
|
-
Returns:
|
|
4393
|
-
list of PromptTemplate: set of prompts
|
|
4394
|
-
"""
|
|
4395
|
-
header = self._get_auth_header()
|
|
4396
|
-
with self._RESTClient(self) as rest_client:
|
|
4397
|
-
response = _rest_to_client_exceptions(
|
|
4398
|
-
lambda: rest_client.prompt_template_api.list_all_prompt_templates(
|
|
4399
|
-
offset=offset,
|
|
4400
|
-
limit=limit,
|
|
4401
|
-
sort_column=sort_column,
|
|
4402
|
-
ascending=ascending,
|
|
4403
|
-
template_type=template_type,
|
|
4404
|
-
filter=filter,
|
|
4405
|
-
_headers=header,
|
|
4406
|
-
)
|
|
4407
|
-
)
|
|
4408
|
-
return [PromptTemplate(**d.to_dict()) for d in response]
|
|
4409
|
-
|
|
4410
4281
|
def get_prompt_template(self, id: Optional[str] = None) -> PromptTemplate:
|
|
4411
4282
|
"""Get a prompt template
|
|
4412
4283
|
|
|
@@ -4874,49 +4745,6 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
4874
4745
|
)
|
|
4875
4746
|
return result
|
|
4876
4747
|
|
|
4877
|
-
def make_prompt_template_public(self, prompt_template_id: str):
|
|
4878
|
-
"""Make a prompt template public
|
|
4879
|
-
|
|
4880
|
-
Once a prompt template is public, it can be seen and used by all users.
|
|
4881
|
-
|
|
4882
|
-
Args:
|
|
4883
|
-
prompt_template_id:
|
|
4884
|
-
ID of the prompt template to make public.
|
|
4885
|
-
"""
|
|
4886
|
-
header = self._get_auth_header()
|
|
4887
|
-
with self._RESTClient(self) as rest_client:
|
|
4888
|
-
_rest_to_client_exceptions(
|
|
4889
|
-
lambda: rest_client.prompt_template_api.update_prompt_template_privacy(
|
|
4890
|
-
prompt_template_id=prompt_template_id,
|
|
4891
|
-
update_prompt_template_privacy_request=rest.UpdatePromptTemplatePrivacyRequest(
|
|
4892
|
-
is_public=True
|
|
4893
|
-
),
|
|
4894
|
-
_headers=header,
|
|
4895
|
-
)
|
|
4896
|
-
)
|
|
4897
|
-
|
|
4898
|
-
def make_prompt_template_private(self, prompt_template_id: str):
|
|
4899
|
-
"""Make a prompt template private
|
|
4900
|
-
|
|
4901
|
-
Once a prompt template is private, other users will no longer
|
|
4902
|
-
be able to see or use it unless it has been shared individually or by group.
|
|
4903
|
-
|
|
4904
|
-
Args:
|
|
4905
|
-
prompt_template_id:
|
|
4906
|
-
ID of the prompt template to make private.
|
|
4907
|
-
"""
|
|
4908
|
-
header = self._get_auth_header()
|
|
4909
|
-
with self._RESTClient(self) as rest_client:
|
|
4910
|
-
_rest_to_client_exceptions(
|
|
4911
|
-
lambda: rest_client.prompt_template_api.update_prompt_template_privacy(
|
|
4912
|
-
prompt_template_id=prompt_template_id,
|
|
4913
|
-
update_prompt_template_privacy_request=rest.UpdatePromptTemplatePrivacyRequest(
|
|
4914
|
-
is_public=False
|
|
4915
|
-
),
|
|
4916
|
-
_headers=header,
|
|
4917
|
-
)
|
|
4918
|
-
)
|
|
4919
|
-
|
|
4920
4748
|
def list_prompt_permissions(self, prompt_id: str) -> List[SharePermission]:
|
|
4921
4749
|
"""Returns a list of access permissions for a given prompt template.
|
|
4922
4750
|
|
|
@@ -4963,32 +4791,6 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
4963
4791
|
)
|
|
4964
4792
|
return [GroupSharePermission(**d.to_dict()) for d in response]
|
|
4965
4793
|
|
|
4966
|
-
def set_default_prompt_template_visibility(self, prompt_id: str, is_visible: bool):
|
|
4967
|
-
"""
|
|
4968
|
-
Updates a flag specifying whether a default prompt template is visible or hidden to users.
|
|
4969
|
-
|
|
4970
|
-
Once you hide a default prompt template, users will no longer be able to use this prompt template.
|
|
4971
|
-
This will also affect collections and chats that have this as a default prompt template.
|
|
4972
|
-
Once you show a default prompt template, all users will be able to see and use this prompt template.
|
|
4973
|
-
|
|
4974
|
-
Args:
|
|
4975
|
-
prompt_id:
|
|
4976
|
-
ID of the default prompt template you would like to change the visibility of.
|
|
4977
|
-
is_visible:
|
|
4978
|
-
Whether the default prompt template should be visible.
|
|
4979
|
-
"""
|
|
4980
|
-
header = self._get_auth_header()
|
|
4981
|
-
with self._RESTClient(self) as rest_client:
|
|
4982
|
-
_rest_to_client_exceptions(
|
|
4983
|
-
lambda: rest_client.prompt_template_api.update_default_prompt_template_visibility(
|
|
4984
|
-
prompt_template_id=prompt_id,
|
|
4985
|
-
update_default_prompt_template_visibility_request=rest.UpdateDefaultPromptTemplateVisibilityRequest(
|
|
4986
|
-
is_visible=is_visible
|
|
4987
|
-
),
|
|
4988
|
-
_headers=header,
|
|
4989
|
-
)
|
|
4990
|
-
)
|
|
4991
|
-
|
|
4992
4794
|
def set_collection_prompt_template(
|
|
4993
4795
|
self,
|
|
4994
4796
|
collection_id: str,
|
|
@@ -5709,7 +5511,7 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5709
5511
|
can_overwrite: bool,
|
|
5710
5512
|
is_public: bool,
|
|
5711
5513
|
value_type: str = None,
|
|
5712
|
-
) -> List[
|
|
5514
|
+
) -> List[ConfigItem]:
|
|
5713
5515
|
"""Set a global configuration.
|
|
5714
5516
|
|
|
5715
5517
|
Note: Both default collection size limit and inactivity interval can be disabled. To do so, pass '-1' as the string_value.
|
|
@@ -5727,7 +5529,7 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5727
5529
|
The type of the value to be set for the global config.
|
|
5728
5530
|
|
|
5729
5531
|
Returns:
|
|
5730
|
-
List[
|
|
5532
|
+
List[ConfigItem]: List of global configurations.
|
|
5731
5533
|
"""
|
|
5732
5534
|
header = self._get_auth_header()
|
|
5733
5535
|
with self._RESTClient(self) as rest_client:
|
|
@@ -5743,9 +5545,9 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5743
5545
|
_headers=header,
|
|
5744
5546
|
)
|
|
5745
5547
|
)
|
|
5746
|
-
return [
|
|
5548
|
+
return [ConfigItem(**c.to_dict()) for c in response]
|
|
5747
5549
|
|
|
5748
|
-
def get_global_configurations_by_admin(self) -> List[
|
|
5550
|
+
def get_global_configurations_by_admin(self) -> List[ConfigItem]:
|
|
5749
5551
|
header = self._get_auth_header()
|
|
5750
5552
|
with self._RESTClient(self) as rest_client:
|
|
5751
5553
|
response = _rest_to_client_exceptions(
|
|
@@ -5754,9 +5556,9 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5754
5556
|
_headers=header,
|
|
5755
5557
|
)
|
|
5756
5558
|
)
|
|
5757
|
-
return [
|
|
5559
|
+
return [ConfigItem(**c.to_dict()) for c in response]
|
|
5758
5560
|
|
|
5759
|
-
def get_global_configurations(self) -> List[
|
|
5561
|
+
def get_global_configurations(self) -> List[ConfigItem]:
|
|
5760
5562
|
header = self._get_auth_header()
|
|
5761
5563
|
with self._RESTClient(self) as rest_client:
|
|
5762
5564
|
response = _rest_to_client_exceptions(
|
|
@@ -5765,11 +5567,11 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5765
5567
|
_headers=header,
|
|
5766
5568
|
)
|
|
5767
5569
|
)
|
|
5768
|
-
return [
|
|
5570
|
+
return [ConfigItem(**c.to_dict()) for c in response]
|
|
5769
5571
|
|
|
5770
5572
|
def bulk_delete_global_configurations(
|
|
5771
5573
|
self, key_names: List[str]
|
|
5772
|
-
) -> List[
|
|
5574
|
+
) -> List[ConfigItem]:
|
|
5773
5575
|
header = self._get_auth_header()
|
|
5774
5576
|
with self._RESTClient(self) as rest_client:
|
|
5775
5577
|
response = _rest_to_client_exceptions(
|
|
@@ -5778,11 +5580,11 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5778
5580
|
_headers=header,
|
|
5779
5581
|
)
|
|
5780
5582
|
)
|
|
5781
|
-
return [
|
|
5583
|
+
return [ConfigItem(**c.to_dict()) for c in response]
|
|
5782
5584
|
|
|
5783
5585
|
def set_user_configuration_for_user(
|
|
5784
5586
|
self, key_name: str, string_value: str, user_id: str, value_type: str = None
|
|
5785
|
-
) -> List[
|
|
5587
|
+
) -> List[UserConfigItem]:
|
|
5786
5588
|
"""Set a user configuration for a specific user (overrides the global configuration and to be used by admins only).
|
|
5787
5589
|
|
|
5788
5590
|
Note: Both default collection size limit and inactivity interval can be disabled. To do so, pass '-1' as the string_value.
|
|
@@ -5798,7 +5600,7 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5798
5600
|
The type of the value to be set for the config.
|
|
5799
5601
|
|
|
5800
5602
|
Returns:
|
|
5801
|
-
List[
|
|
5603
|
+
List[UserConfigItem]: List of user configurations.
|
|
5802
5604
|
"""
|
|
5803
5605
|
header = self._get_auth_header()
|
|
5804
5606
|
with self._RESTClient(self) as rest_client:
|
|
@@ -5813,9 +5615,9 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5813
5615
|
_headers=header,
|
|
5814
5616
|
)
|
|
5815
5617
|
)
|
|
5816
|
-
return [
|
|
5618
|
+
return [UserConfigItem(**c.to_dict()) for c in response]
|
|
5817
5619
|
|
|
5818
|
-
def get_user_configurations_for_user(self, user_id: str) -> List[
|
|
5620
|
+
def get_user_configurations_for_user(self, user_id: str) -> List[UserConfigItem]:
|
|
5819
5621
|
"""Gets the user configurations for a specific user (to be used by admins only).
|
|
5820
5622
|
|
|
5821
5623
|
Args:
|
|
@@ -5823,7 +5625,7 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5823
5625
|
The unique identifier of the user.
|
|
5824
5626
|
|
|
5825
5627
|
Returns:
|
|
5826
|
-
List[
|
|
5628
|
+
List[UserConfigItem]: List of user configurations.
|
|
5827
5629
|
"""
|
|
5828
5630
|
header = self._get_auth_header()
|
|
5829
5631
|
with self._RESTClient(self) as rest_client:
|
|
@@ -5833,13 +5635,13 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5833
5635
|
_headers=header,
|
|
5834
5636
|
)
|
|
5835
5637
|
)
|
|
5836
|
-
return [
|
|
5638
|
+
return [UserConfigItem(**c.to_dict()) for c in response]
|
|
5837
5639
|
|
|
5838
|
-
def get_user_configurations(self) -> List[
|
|
5640
|
+
def get_user_configurations(self) -> List[UserConfigItem]:
|
|
5839
5641
|
"""Gets the user configurations for the current user.
|
|
5840
5642
|
|
|
5841
5643
|
Returns:
|
|
5842
|
-
List[
|
|
5644
|
+
List[UserConfigItem]: List of user configurations.
|
|
5843
5645
|
"""
|
|
5844
5646
|
header = self._get_auth_header()
|
|
5845
5647
|
with self._RESTClient(self) as rest_client:
|
|
@@ -5848,11 +5650,11 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5848
5650
|
_headers=header
|
|
5849
5651
|
)
|
|
5850
5652
|
)
|
|
5851
|
-
return [
|
|
5653
|
+
return [UserConfigItem(**c.to_dict()) for c in response]
|
|
5852
5654
|
|
|
5853
5655
|
def bulk_delete_user_configurations_for_user(
|
|
5854
5656
|
self, user_id: str, key_names: List[str]
|
|
5855
|
-
) -> List[
|
|
5657
|
+
) -> List[UserConfigItem]:
|
|
5856
5658
|
header = self._get_auth_header()
|
|
5857
5659
|
with self._RESTClient(self) as rest_client:
|
|
5858
5660
|
response = _rest_to_client_exceptions(
|
|
@@ -5862,15 +5664,15 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5862
5664
|
_headers=header,
|
|
5863
5665
|
)
|
|
5864
5666
|
)
|
|
5865
|
-
return [
|
|
5667
|
+
return [UserConfigItem(**c.to_dict()) for c in response]
|
|
5866
5668
|
|
|
5867
5669
|
def reset_user_configurations_for_user(
|
|
5868
5670
|
self, key_name: str, user_id: str
|
|
5869
|
-
) -> List[
|
|
5671
|
+
) -> List[UserConfigItem]:
|
|
5870
5672
|
"""Reset a user configuration for a specific user (to be used by admins only).
|
|
5871
5673
|
|
|
5872
5674
|
Returns:
|
|
5873
|
-
List[
|
|
5675
|
+
List[UserConfigItem]: List of user configurations.
|
|
5874
5676
|
"""
|
|
5875
5677
|
header = self._get_auth_header()
|
|
5876
5678
|
with self._RESTClient(self) as rest_client:
|
|
@@ -5881,7 +5683,7 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5881
5683
|
_headers=header,
|
|
5882
5684
|
)
|
|
5883
5685
|
)
|
|
5884
|
-
return [
|
|
5686
|
+
return [UserConfigItem(**c.to_dict()) for c in response]
|
|
5885
5687
|
|
|
5886
5688
|
def delete_agent_directories(self, chat_session_id: str) -> bool:
|
|
5887
5689
|
header = self._get_auth_header()
|
|
@@ -5896,82 +5698,6 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5896
5698
|
)
|
|
5897
5699
|
return result.status == "completed"
|
|
5898
5700
|
|
|
5899
|
-
def set_role_configuration(
|
|
5900
|
-
self, key_name: str, role_id: str, string_value: str, value_type: str = None
|
|
5901
|
-
) -> List[ConfigItem]:
|
|
5902
|
-
"""Set a role configuration, overrides the global configuration.
|
|
5903
|
-
Args:
|
|
5904
|
-
role_id:
|
|
5905
|
-
The role id you want to apply the config for.
|
|
5906
|
-
key_name:
|
|
5907
|
-
The name of the global config key.
|
|
5908
|
-
string_value:
|
|
5909
|
-
The value to be set for the config.
|
|
5910
|
-
value_type:
|
|
5911
|
-
The type of the value to be set for the config.
|
|
5912
|
-
|
|
5913
|
-
Returns:
|
|
5914
|
-
List[ConfigItem]: List of role configurations.
|
|
5915
|
-
"""
|
|
5916
|
-
header = self._get_auth_header()
|
|
5917
|
-
with self._RESTClient(self) as rest_client:
|
|
5918
|
-
response = _rest_to_client_exceptions(
|
|
5919
|
-
lambda: rest_client.configuration_api.set_role_configuration(
|
|
5920
|
-
key_name=key_name,
|
|
5921
|
-
role_id=role_id,
|
|
5922
|
-
user_configuration_item=rest.UserConfigurationItem(
|
|
5923
|
-
key_name=key_name,
|
|
5924
|
-
string_value=string_value,
|
|
5925
|
-
value_type=value_type,
|
|
5926
|
-
),
|
|
5927
|
-
_headers=header,
|
|
5928
|
-
)
|
|
5929
|
-
)
|
|
5930
|
-
return [ConfigItem(**c.to_dict()) for c in response]
|
|
5931
|
-
|
|
5932
|
-
def list_role_configurations(self, role_id: str) -> List[ConfigItem]:
|
|
5933
|
-
"""Lists role configurations for a given role.
|
|
5934
|
-
Args:
|
|
5935
|
-
role_id:
|
|
5936
|
-
The role id to get configurations for.
|
|
5937
|
-
|
|
5938
|
-
Returns:
|
|
5939
|
-
List[ConfigItem]: List of role configurations.
|
|
5940
|
-
"""
|
|
5941
|
-
header = self._get_auth_header()
|
|
5942
|
-
with self._RESTClient(self) as rest_client:
|
|
5943
|
-
response = _rest_to_client_exceptions(
|
|
5944
|
-
lambda: rest_client.configuration_api.list_role_configurations(
|
|
5945
|
-
role_id=role_id,
|
|
5946
|
-
_headers=header,
|
|
5947
|
-
)
|
|
5948
|
-
)
|
|
5949
|
-
return [ConfigItem(**c.to_dict()) for c in response]
|
|
5950
|
-
|
|
5951
|
-
def bulk_delete_role_configurations(
|
|
5952
|
-
self, role_id: str, keys: List[str]
|
|
5953
|
-
) -> List[ConfigItem]:
|
|
5954
|
-
"""Delete role configuration items for a given role.
|
|
5955
|
-
Args:
|
|
5956
|
-
role_id:
|
|
5957
|
-
The role id to delete configurations for.
|
|
5958
|
-
keys:
|
|
5959
|
-
List of configuration keys to delete.
|
|
5960
|
-
|
|
5961
|
-
Returns:
|
|
5962
|
-
List[ConfigItem]: List of remaining role configurations.
|
|
5963
|
-
"""
|
|
5964
|
-
header = self._get_auth_header()
|
|
5965
|
-
with self._RESTClient(self) as rest_client:
|
|
5966
|
-
response = _rest_to_client_exceptions(
|
|
5967
|
-
lambda: rest_client.configuration_api.delete_role_configurations(
|
|
5968
|
-
key_names=keys,
|
|
5969
|
-
role_id=role_id,
|
|
5970
|
-
_headers=header,
|
|
5971
|
-
)
|
|
5972
|
-
)
|
|
5973
|
-
return [ConfigItem(**c.to_dict()) for c in response]
|
|
5974
|
-
|
|
5975
5701
|
def delete_multiple_agent_directories(
|
|
5976
5702
|
self, chat_session_ids: List[str], dir_types: List[str]
|
|
5977
5703
|
) -> bool:
|
|
@@ -6351,27 +6077,3 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
6351
6077
|
)
|
|
6352
6078
|
)
|
|
6353
6079
|
return response.count
|
|
6354
|
-
|
|
6355
|
-
def set_role_priority(self, role_id: str, priority: int) -> UserRole:
|
|
6356
|
-
"""Sets the priority for a role.
|
|
6357
|
-
Args:
|
|
6358
|
-
role_id:
|
|
6359
|
-
String: The id of the role to set the priority for.
|
|
6360
|
-
priority:
|
|
6361
|
-
Int: The priority value to set for the role. ex: 100, 200, 300...etc.
|
|
6362
|
-
The lower the number, the higher the priority.
|
|
6363
|
-
Returns:
|
|
6364
|
-
UserRole: The updated user role with the new priority.
|
|
6365
|
-
"""
|
|
6366
|
-
header = self._get_auth_header()
|
|
6367
|
-
with self._RESTClient(self) as rest_client:
|
|
6368
|
-
response = _rest_to_client_exceptions(
|
|
6369
|
-
lambda: rest_client.permission_api.set_role_priority(
|
|
6370
|
-
role_id=role_id,
|
|
6371
|
-
set_role_priority_request=rest.SetRolePriorityRequest(
|
|
6372
|
-
priority=priority
|
|
6373
|
-
),
|
|
6374
|
-
_headers=header,
|
|
6375
|
-
)
|
|
6376
|
-
)
|
|
6377
|
-
return UserRole(**response.to_dict())
|