scope-client 1.4.911__py3-none-any.whl → 1.4.913__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.
- scope_client/api_bindings/__init__.py +19 -0
- scope_client/api_bindings/api/__init__.py +1 -0
- scope_client/api_bindings/api/tasks_v1_api.py +1757 -0
- scope_client/api_bindings/models/__init__.py +18 -0
- scope_client/api_bindings/models/config.py +185 -0
- scope_client/api_bindings/models/config1.py +185 -0
- scope_client/api_bindings/models/example_config.py +89 -0
- scope_client/api_bindings/models/examples_config.py +102 -0
- scope_client/api_bindings/models/keywords_config.py +87 -0
- scope_client/api_bindings/models/metrics_query_result.py +2 -2
- scope_client/api_bindings/models/new_rule_request.py +104 -0
- scope_client/api_bindings/models/patch_task_request.py +101 -0
- scope_client/api_bindings/models/permission_name.py +6 -0
- scope_client/api_bindings/models/pii_config.py +106 -0
- scope_client/api_bindings/models/post_task_request.py +105 -0
- scope_client/api_bindings/models/put_task_state_cache_request.py +91 -0
- scope_client/api_bindings/models/regex_config.py +87 -0
- scope_client/api_bindings/models/rule_response.py +121 -0
- scope_client/api_bindings/models/rule_scope.py +37 -0
- scope_client/api_bindings/models/rule_type.py +44 -0
- scope_client/api_bindings/models/task_mutation_response.py +87 -0
- scope_client/api_bindings/models/task_read_response.py +106 -0
- scope_client/api_bindings/models/task_response.py +103 -0
- scope_client/api_bindings/models/toxicity_config.py +100 -0
- {scope_client-1.4.911.dist-info → scope_client-1.4.913.dist-info}/METADATA +1 -1
- {scope_client-1.4.911.dist-info → scope_client-1.4.913.dist-info}/RECORD +28 -9
- {scope_client-1.4.911.dist-info → scope_client-1.4.913.dist-info}/WHEEL +0 -0
- {scope_client-1.4.911.dist-info → scope_client-1.4.913.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Arthur Scope
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class KeywordsConfig(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
KeywordsConfig
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
keywords: List[StrictStr] = Field(description="List of Keywords")
|
|
30
|
+
__properties: ClassVar[List[str]] = ["keywords"]
|
|
31
|
+
|
|
32
|
+
model_config = ConfigDict(
|
|
33
|
+
populate_by_name=True,
|
|
34
|
+
validate_assignment=True,
|
|
35
|
+
protected_namespaces=(),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def to_str(self) -> str:
|
|
40
|
+
"""Returns the string representation of the model using alias"""
|
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
46
|
+
return json.dumps(self.to_dict())
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
+
"""Create an instance of KeywordsConfig from a JSON string"""
|
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
|
52
|
+
|
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
|
55
|
+
|
|
56
|
+
This has the following differences from calling pydantic's
|
|
57
|
+
`self.model_dump(by_alias=True)`:
|
|
58
|
+
|
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
|
60
|
+
were set at model initialization. Other fields with value `None`
|
|
61
|
+
are ignored.
|
|
62
|
+
"""
|
|
63
|
+
excluded_fields: Set[str] = set([
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
return _dict
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of KeywordsConfig from a dict"""
|
|
76
|
+
if obj is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return cls.model_validate(obj)
|
|
81
|
+
|
|
82
|
+
_obj = cls.model_validate({
|
|
83
|
+
"keywords": obj.get("keywords")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|
|
@@ -18,7 +18,7 @@ import re # noqa: F401
|
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field
|
|
21
|
-
from typing import Any, ClassVar, Dict, List
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from typing import Optional, Set
|
|
23
23
|
from typing_extensions import Self
|
|
24
24
|
|
|
@@ -26,7 +26,7 @@ class MetricsQueryResult(BaseModel):
|
|
|
26
26
|
"""
|
|
27
27
|
MetricsQueryResult
|
|
28
28
|
""" # noqa: E501
|
|
29
|
-
results: List[Dict[str, Any]] = Field(description="Results of the metrics query.")
|
|
29
|
+
results: List[Optional[Dict[str, Any]]] = Field(description="Results of the metrics query.")
|
|
30
30
|
__properties: ClassVar[List[str]] = ["results"]
|
|
31
31
|
|
|
32
32
|
model_config = ConfigDict(
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Arthur Scope
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from scope_client.api_bindings.models.config import Config
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class NewRuleRequest(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
NewRuleRequest
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
name: StrictStr = Field(description="Name of the rule")
|
|
31
|
+
type: StrictStr = Field(description="Type of the rule. It can only be one of KeywordRule, RegexRule, ModelSensitiveDataRule, ModelHallucinationRule, ModelHallucinationRuleV2, PromptInjectionRule, PIIDataRule")
|
|
32
|
+
apply_to_prompt: StrictBool = Field(description="Boolean value to enable or disable the rule for llm prompt")
|
|
33
|
+
apply_to_response: StrictBool = Field(description="Boolean value to enable or disable the rule for llm response")
|
|
34
|
+
config: Optional[Config] = None
|
|
35
|
+
__properties: ClassVar[List[str]] = ["name", "type", "apply_to_prompt", "apply_to_response", "config"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
populate_by_name=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def to_str(self) -> str:
|
|
45
|
+
"""Returns the string representation of the model using alias"""
|
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
47
|
+
|
|
48
|
+
def to_json(self) -> str:
|
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
|
50
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
51
|
+
return json.dumps(self.to_dict())
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of NewRuleRequest from a JSON string"""
|
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
|
57
|
+
|
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
|
60
|
+
|
|
61
|
+
This has the following differences from calling pydantic's
|
|
62
|
+
`self.model_dump(by_alias=True)`:
|
|
63
|
+
|
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
|
65
|
+
were set at model initialization. Other fields with value `None`
|
|
66
|
+
are ignored.
|
|
67
|
+
"""
|
|
68
|
+
excluded_fields: Set[str] = set([
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
_dict = self.model_dump(
|
|
72
|
+
by_alias=True,
|
|
73
|
+
exclude=excluded_fields,
|
|
74
|
+
exclude_none=True,
|
|
75
|
+
)
|
|
76
|
+
# override the default output from pydantic by calling `to_dict()` of config
|
|
77
|
+
if self.config:
|
|
78
|
+
_dict['config'] = self.config.to_dict()
|
|
79
|
+
# set to None if config (nullable) is None
|
|
80
|
+
# and model_fields_set contains the field
|
|
81
|
+
if self.config is None and "config" in self.model_fields_set:
|
|
82
|
+
_dict['config'] = None
|
|
83
|
+
|
|
84
|
+
return _dict
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
88
|
+
"""Create an instance of NewRuleRequest from a dict"""
|
|
89
|
+
if obj is None:
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
if not isinstance(obj, dict):
|
|
93
|
+
return cls.model_validate(obj)
|
|
94
|
+
|
|
95
|
+
_obj = cls.model_validate({
|
|
96
|
+
"name": obj.get("name"),
|
|
97
|
+
"type": obj.get("type"),
|
|
98
|
+
"apply_to_prompt": obj.get("apply_to_prompt"),
|
|
99
|
+
"apply_to_response": obj.get("apply_to_response"),
|
|
100
|
+
"config": Config.from_dict(obj["config"]) if obj.get("config") is not None else None
|
|
101
|
+
})
|
|
102
|
+
return _obj
|
|
103
|
+
|
|
104
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Arthur Scope
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from scope_client.api_bindings.models.new_rule_request import NewRuleRequest
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class PatchTaskRequest(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
PatchTaskRequest
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
rules_to_enable: Optional[List[StrictStr]] = Field(default=None, description="List of rule IDs to enable on the task.")
|
|
31
|
+
rules_to_disable: Optional[List[StrictStr]] = Field(default=None, description="List of rule IDs to disable on the task.")
|
|
32
|
+
rules_to_archive: Optional[List[StrictStr]] = Field(default=None, description="List of rule IDs to archive on the task.")
|
|
33
|
+
rules_to_add: Optional[List[NewRuleRequest]] = Field(default=None, description="List of new rules to add to the task.")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["rules_to_enable", "rules_to_disable", "rules_to_archive", "rules_to_add"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of PatchTaskRequest from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in rules_to_add (list)
|
|
76
|
+
_items = []
|
|
77
|
+
if self.rules_to_add:
|
|
78
|
+
for _item_rules_to_add in self.rules_to_add:
|
|
79
|
+
if _item_rules_to_add:
|
|
80
|
+
_items.append(_item_rules_to_add.to_dict())
|
|
81
|
+
_dict['rules_to_add'] = _items
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of PatchTaskRequest from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"rules_to_enable": obj.get("rules_to_enable"),
|
|
95
|
+
"rules_to_disable": obj.get("rules_to_disable"),
|
|
96
|
+
"rules_to_archive": obj.get("rules_to_archive"),
|
|
97
|
+
"rules_to_add": [NewRuleRequest.from_dict(_item) for _item in obj["rules_to_add"]] if obj.get("rules_to_add") is not None else None
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
|
@@ -83,6 +83,7 @@ class PermissionName(str, Enum):
|
|
|
83
83
|
PROJECT_CREATE_ROLE_BINDING = 'project_create_role_binding'
|
|
84
84
|
PROJECT_LIST_ROLE_BINDINGS = 'project_list_role_bindings'
|
|
85
85
|
PROJECT_GENERATE_METRICS_SPEC = 'project_generate_metrics_spec'
|
|
86
|
+
PROJECT_CREATE_MODEL_TASK = 'project_create_model_task'
|
|
86
87
|
MODEL_READ = 'model_read'
|
|
87
88
|
MODEL_UPDATE = 'model_update'
|
|
88
89
|
MODEL_DELETE = 'model_delete'
|
|
@@ -97,6 +98,11 @@ class PermissionName(str, Enum):
|
|
|
97
98
|
MODEL_QUERY_METRICS = 'model_query_metrics'
|
|
98
99
|
MODEL_METRICS_SCHEDULE_UPDATE = 'model_metrics_schedule_update'
|
|
99
100
|
MODEL_METRICS_SCHEDULE_DELETE = 'model_metrics_schedule_delete'
|
|
101
|
+
MODEL_TASK_READ = 'model_task_read'
|
|
102
|
+
MODEL_TASK_UPDATE = 'model_task_update'
|
|
103
|
+
MODEL_TASK_DELETE = 'model_task_delete'
|
|
104
|
+
MODEL_TASK_SYNC = 'model_task_sync'
|
|
105
|
+
MODEL_TASK_PUT_STATE_CACHE = 'model_task_put_state_cache'
|
|
100
106
|
CONNECTOR_READ = 'connector_read'
|
|
101
107
|
CONNECTOR_UPDATE = 'connector_update'
|
|
102
108
|
CONNECTOR_DELETE = 'connector_delete'
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Arthur Scope
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class PIIConfig(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
PIIConfig
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
disabled_pii_entities: Optional[List[StrictStr]] = None
|
|
30
|
+
confidence_threshold: Optional[Union[StrictFloat, StrictInt]] = None
|
|
31
|
+
allow_list: Optional[List[StrictStr]] = None
|
|
32
|
+
__properties: ClassVar[List[str]] = ["disabled_pii_entities", "confidence_threshold", "allow_list"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of PIIConfig from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
# set to None if disabled_pii_entities (nullable) is None
|
|
74
|
+
# and model_fields_set contains the field
|
|
75
|
+
if self.disabled_pii_entities is None and "disabled_pii_entities" in self.model_fields_set:
|
|
76
|
+
_dict['disabled_pii_entities'] = None
|
|
77
|
+
|
|
78
|
+
# set to None if confidence_threshold (nullable) is None
|
|
79
|
+
# and model_fields_set contains the field
|
|
80
|
+
if self.confidence_threshold is None and "confidence_threshold" in self.model_fields_set:
|
|
81
|
+
_dict['confidence_threshold'] = None
|
|
82
|
+
|
|
83
|
+
# set to None if allow_list (nullable) is None
|
|
84
|
+
# and model_fields_set contains the field
|
|
85
|
+
if self.allow_list is None and "allow_list" in self.model_fields_set:
|
|
86
|
+
_dict['allow_list'] = None
|
|
87
|
+
|
|
88
|
+
return _dict
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
92
|
+
"""Create an instance of PIIConfig from a dict"""
|
|
93
|
+
if obj is None:
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
if not isinstance(obj, dict):
|
|
97
|
+
return cls.model_validate(obj)
|
|
98
|
+
|
|
99
|
+
_obj = cls.model_validate({
|
|
100
|
+
"disabled_pii_entities": obj.get("disabled_pii_entities"),
|
|
101
|
+
"confidence_threshold": obj.get("confidence_threshold"),
|
|
102
|
+
"allow_list": obj.get("allow_list")
|
|
103
|
+
})
|
|
104
|
+
return _obj
|
|
105
|
+
|
|
106
|
+
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Arthur Scope
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from scope_client.api_bindings.models.new_rule_request import NewRuleRequest
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class PostTaskRequest(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
PostTaskRequest
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The name of the task")
|
|
32
|
+
onboarding_identifier: Optional[StrictStr] = None
|
|
33
|
+
rules_to_add: Optional[List[NewRuleRequest]] = Field(default=None, description="List of rules to add to the task.")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["name", "onboarding_identifier", "rules_to_add"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of PostTaskRequest from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in rules_to_add (list)
|
|
76
|
+
_items = []
|
|
77
|
+
if self.rules_to_add:
|
|
78
|
+
for _item_rules_to_add in self.rules_to_add:
|
|
79
|
+
if _item_rules_to_add:
|
|
80
|
+
_items.append(_item_rules_to_add.to_dict())
|
|
81
|
+
_dict['rules_to_add'] = _items
|
|
82
|
+
# set to None if onboarding_identifier (nullable) is None
|
|
83
|
+
# and model_fields_set contains the field
|
|
84
|
+
if self.onboarding_identifier is None and "onboarding_identifier" in self.model_fields_set:
|
|
85
|
+
_dict['onboarding_identifier'] = None
|
|
86
|
+
|
|
87
|
+
return _dict
|
|
88
|
+
|
|
89
|
+
@classmethod
|
|
90
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
91
|
+
"""Create an instance of PostTaskRequest from a dict"""
|
|
92
|
+
if obj is None:
|
|
93
|
+
return None
|
|
94
|
+
|
|
95
|
+
if not isinstance(obj, dict):
|
|
96
|
+
return cls.model_validate(obj)
|
|
97
|
+
|
|
98
|
+
_obj = cls.model_validate({
|
|
99
|
+
"name": obj.get("name"),
|
|
100
|
+
"onboarding_identifier": obj.get("onboarding_identifier"),
|
|
101
|
+
"rules_to_add": [NewRuleRequest.from_dict(_item) for _item in obj["rules_to_add"]] if obj.get("rules_to_add") is not None else None
|
|
102
|
+
})
|
|
103
|
+
return _obj
|
|
104
|
+
|
|
105
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Arthur Scope
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from scope_client.api_bindings.models.task_response import TaskResponse
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class PutTaskStateCacheRequest(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
PutTaskStateCacheRequest
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
task: TaskResponse = Field(description="Copy of the task state to cache in the control plane.")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["task"]
|
|
32
|
+
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of PutTaskStateCacheRequest from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([
|
|
65
|
+
])
|
|
66
|
+
|
|
67
|
+
_dict = self.model_dump(
|
|
68
|
+
by_alias=True,
|
|
69
|
+
exclude=excluded_fields,
|
|
70
|
+
exclude_none=True,
|
|
71
|
+
)
|
|
72
|
+
# override the default output from pydantic by calling `to_dict()` of task
|
|
73
|
+
if self.task:
|
|
74
|
+
_dict['task'] = self.task.to_dict()
|
|
75
|
+
return _dict
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
79
|
+
"""Create an instance of PutTaskStateCacheRequest from a dict"""
|
|
80
|
+
if obj is None:
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
if not isinstance(obj, dict):
|
|
84
|
+
return cls.model_validate(obj)
|
|
85
|
+
|
|
86
|
+
_obj = cls.model_validate({
|
|
87
|
+
"task": TaskResponse.from_dict(obj["task"]) if obj.get("task") is not None else None
|
|
88
|
+
})
|
|
89
|
+
return _obj
|
|
90
|
+
|
|
91
|
+
|