hackagent 0.1.0__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.
- hackagent/__init__.py +23 -0
- hackagent/agent.py +193 -0
- hackagent/api/__init__.py +1 -0
- hackagent/api/agent/__init__.py +1 -0
- hackagent/api/agent/agent_create.py +340 -0
- hackagent/api/agent/agent_destroy.py +136 -0
- hackagent/api/agent/agent_list.py +234 -0
- hackagent/api/agent/agent_partial_update.py +354 -0
- hackagent/api/agent/agent_retrieve.py +227 -0
- hackagent/api/agent/agent_update.py +354 -0
- hackagent/api/attack/__init__.py +1 -0
- hackagent/api/attack/attack_create.py +264 -0
- hackagent/api/attack/attack_destroy.py +140 -0
- hackagent/api/attack/attack_list.py +242 -0
- hackagent/api/attack/attack_partial_update.py +278 -0
- hackagent/api/attack/attack_retrieve.py +235 -0
- hackagent/api/attack/attack_update.py +278 -0
- hackagent/api/key/__init__.py +1 -0
- hackagent/api/key/key_create.py +168 -0
- hackagent/api/key/key_destroy.py +97 -0
- hackagent/api/key/key_list.py +158 -0
- hackagent/api/key/key_retrieve.py +150 -0
- hackagent/api/prompt/__init__.py +1 -0
- hackagent/api/prompt/prompt_create.py +160 -0
- hackagent/api/prompt/prompt_destroy.py +98 -0
- hackagent/api/prompt/prompt_list.py +173 -0
- hackagent/api/prompt/prompt_partial_update.py +174 -0
- hackagent/api/prompt/prompt_retrieve.py +151 -0
- hackagent/api/prompt/prompt_update.py +174 -0
- hackagent/api/result/__init__.py +1 -0
- hackagent/api/result/result_create.py +160 -0
- hackagent/api/result/result_destroy.py +98 -0
- hackagent/api/result/result_list.py +233 -0
- hackagent/api/result/result_partial_update.py +178 -0
- hackagent/api/result/result_retrieve.py +151 -0
- hackagent/api/result/result_trace_create.py +178 -0
- hackagent/api/result/result_update.py +174 -0
- hackagent/api/run/__init__.py +1 -0
- hackagent/api/run/run_create.py +172 -0
- hackagent/api/run/run_destroy.py +104 -0
- hackagent/api/run/run_list.py +260 -0
- hackagent/api/run/run_partial_update.py +186 -0
- hackagent/api/run/run_result_create.py +178 -0
- hackagent/api/run/run_retrieve.py +163 -0
- hackagent/api/run/run_run_tests_create.py +172 -0
- hackagent/api/run/run_update.py +186 -0
- hackagent/attacks/AdvPrefix/README.md +7 -0
- hackagent/attacks/AdvPrefix/__init__.py +0 -0
- hackagent/attacks/AdvPrefix/completer.py +438 -0
- hackagent/attacks/AdvPrefix/config.py +59 -0
- hackagent/attacks/AdvPrefix/preprocessing.py +521 -0
- hackagent/attacks/AdvPrefix/scorer.py +259 -0
- hackagent/attacks/AdvPrefix/scorer_parser.py +498 -0
- hackagent/attacks/AdvPrefix/selector.py +246 -0
- hackagent/attacks/AdvPrefix/step1_generate.py +324 -0
- hackagent/attacks/AdvPrefix/step4_compute_ce.py +293 -0
- hackagent/attacks/AdvPrefix/step6_get_completions.py +387 -0
- hackagent/attacks/AdvPrefix/step7_evaluate_responses.py +289 -0
- hackagent/attacks/AdvPrefix/step8_aggregate_evaluations.py +177 -0
- hackagent/attacks/AdvPrefix/step9_select_prefixes.py +59 -0
- hackagent/attacks/AdvPrefix/utils.py +192 -0
- hackagent/attacks/__init__.py +6 -0
- hackagent/attacks/advprefix.py +1136 -0
- hackagent/attacks/base.py +50 -0
- hackagent/attacks/strategies.py +539 -0
- hackagent/branding.py +143 -0
- hackagent/client.py +328 -0
- hackagent/errors.py +31 -0
- hackagent/logger.py +67 -0
- hackagent/models/__init__.py +71 -0
- hackagent/models/agent.py +240 -0
- hackagent/models/agent_request.py +169 -0
- hackagent/models/agent_type_enum.py +12 -0
- hackagent/models/attack.py +154 -0
- hackagent/models/attack_request.py +82 -0
- hackagent/models/evaluation_status_enum.py +14 -0
- hackagent/models/organization_minimal.py +68 -0
- hackagent/models/paginated_agent_list.py +123 -0
- hackagent/models/paginated_attack_list.py +123 -0
- hackagent/models/paginated_prompt_list.py +123 -0
- hackagent/models/paginated_result_list.py +123 -0
- hackagent/models/paginated_run_list.py +123 -0
- hackagent/models/paginated_user_api_key_list.py +123 -0
- hackagent/models/patched_agent_request.py +176 -0
- hackagent/models/patched_attack_request.py +92 -0
- hackagent/models/patched_prompt_request.py +162 -0
- hackagent/models/patched_result_request.py +237 -0
- hackagent/models/patched_run_request.py +138 -0
- hackagent/models/prompt.py +226 -0
- hackagent/models/prompt_request.py +155 -0
- hackagent/models/result.py +294 -0
- hackagent/models/result_list_evaluation_status.py +14 -0
- hackagent/models/result_request.py +232 -0
- hackagent/models/run.py +233 -0
- hackagent/models/run_list_status.py +12 -0
- hackagent/models/run_request.py +133 -0
- hackagent/models/status_enum.py +12 -0
- hackagent/models/step_type_enum.py +14 -0
- hackagent/models/trace.py +121 -0
- hackagent/models/trace_request.py +94 -0
- hackagent/models/user_api_key.py +201 -0
- hackagent/models/user_api_key_request.py +73 -0
- hackagent/models/user_profile_minimal.py +76 -0
- hackagent/py.typed +1 -0
- hackagent/router/__init__.py +11 -0
- hackagent/router/adapters/__init__.py +5 -0
- hackagent/router/adapters/google_adk.py +658 -0
- hackagent/router/adapters/litellm_adapter.py +290 -0
- hackagent/router/base.py +48 -0
- hackagent/router/router.py +753 -0
- hackagent/types.py +46 -0
- hackagent/utils.py +61 -0
- hackagent/vulnerabilities/__init__.py +0 -0
- hackagent-0.1.0.dist-info/LICENSE +202 -0
- hackagent-0.1.0.dist-info/METADATA +173 -0
- hackagent-0.1.0.dist-info/RECORD +117 -0
- hackagent-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, TypeVar
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
|
|
5
|
+
from attrs import define as _attrs_define
|
|
6
|
+
from attrs import field as _attrs_field
|
|
7
|
+
|
|
8
|
+
T = TypeVar("T", bound="OrganizationMinimal")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@_attrs_define
|
|
12
|
+
class OrganizationMinimal:
|
|
13
|
+
"""
|
|
14
|
+
Attributes:
|
|
15
|
+
id (UUID):
|
|
16
|
+
name (str):
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
id: UUID
|
|
20
|
+
name: str
|
|
21
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
22
|
+
|
|
23
|
+
def to_dict(self) -> dict[str, Any]:
|
|
24
|
+
id = str(self.id)
|
|
25
|
+
|
|
26
|
+
name = self.name
|
|
27
|
+
|
|
28
|
+
field_dict: dict[str, Any] = {}
|
|
29
|
+
field_dict.update(self.additional_properties)
|
|
30
|
+
field_dict.update(
|
|
31
|
+
{
|
|
32
|
+
"id": id,
|
|
33
|
+
"name": name,
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
return field_dict
|
|
38
|
+
|
|
39
|
+
@classmethod
|
|
40
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
41
|
+
d = dict(src_dict)
|
|
42
|
+
id = UUID(d.pop("id"))
|
|
43
|
+
|
|
44
|
+
name = d.pop("name")
|
|
45
|
+
|
|
46
|
+
organization_minimal = cls(
|
|
47
|
+
id=id,
|
|
48
|
+
name=name,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
organization_minimal.additional_properties = d
|
|
52
|
+
return organization_minimal
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def additional_keys(self) -> list[str]:
|
|
56
|
+
return list(self.additional_properties.keys())
|
|
57
|
+
|
|
58
|
+
def __getitem__(self, key: str) -> Any:
|
|
59
|
+
return self.additional_properties[key]
|
|
60
|
+
|
|
61
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
62
|
+
self.additional_properties[key] = value
|
|
63
|
+
|
|
64
|
+
def __delitem__(self, key: str) -> None:
|
|
65
|
+
del self.additional_properties[key]
|
|
66
|
+
|
|
67
|
+
def __contains__(self, key: str) -> bool:
|
|
68
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from ..types import UNSET, Unset
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.agent import Agent
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="PaginatedAgentList")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class PaginatedAgentList:
|
|
18
|
+
"""
|
|
19
|
+
Attributes:
|
|
20
|
+
count (int): Example: 123.
|
|
21
|
+
results (list['Agent']):
|
|
22
|
+
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=4.
|
|
23
|
+
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=2.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
count: int
|
|
27
|
+
results: list["Agent"]
|
|
28
|
+
next_: Union[None, Unset, str] = UNSET
|
|
29
|
+
previous: Union[None, Unset, str] = UNSET
|
|
30
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
31
|
+
|
|
32
|
+
def to_dict(self) -> dict[str, Any]:
|
|
33
|
+
count = self.count
|
|
34
|
+
|
|
35
|
+
results = []
|
|
36
|
+
for results_item_data in self.results:
|
|
37
|
+
results_item = results_item_data.to_dict()
|
|
38
|
+
results.append(results_item)
|
|
39
|
+
|
|
40
|
+
next_: Union[None, Unset, str]
|
|
41
|
+
if isinstance(self.next_, Unset):
|
|
42
|
+
next_ = UNSET
|
|
43
|
+
else:
|
|
44
|
+
next_ = self.next_
|
|
45
|
+
|
|
46
|
+
previous: Union[None, Unset, str]
|
|
47
|
+
if isinstance(self.previous, Unset):
|
|
48
|
+
previous = UNSET
|
|
49
|
+
else:
|
|
50
|
+
previous = self.previous
|
|
51
|
+
|
|
52
|
+
field_dict: dict[str, Any] = {}
|
|
53
|
+
field_dict.update(self.additional_properties)
|
|
54
|
+
field_dict.update(
|
|
55
|
+
{
|
|
56
|
+
"count": count,
|
|
57
|
+
"results": results,
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
if next_ is not UNSET:
|
|
61
|
+
field_dict["next"] = next_
|
|
62
|
+
if previous is not UNSET:
|
|
63
|
+
field_dict["previous"] = previous
|
|
64
|
+
|
|
65
|
+
return field_dict
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
69
|
+
from ..models.agent import Agent
|
|
70
|
+
|
|
71
|
+
d = dict(src_dict)
|
|
72
|
+
count = d.pop("count")
|
|
73
|
+
|
|
74
|
+
results = []
|
|
75
|
+
_results = d.pop("results")
|
|
76
|
+
for results_item_data in _results:
|
|
77
|
+
results_item = Agent.from_dict(results_item_data)
|
|
78
|
+
|
|
79
|
+
results.append(results_item)
|
|
80
|
+
|
|
81
|
+
def _parse_next_(data: object) -> Union[None, Unset, str]:
|
|
82
|
+
if data is None:
|
|
83
|
+
return data
|
|
84
|
+
if isinstance(data, Unset):
|
|
85
|
+
return data
|
|
86
|
+
return cast(Union[None, Unset, str], data)
|
|
87
|
+
|
|
88
|
+
next_ = _parse_next_(d.pop("next", UNSET))
|
|
89
|
+
|
|
90
|
+
def _parse_previous(data: object) -> Union[None, Unset, str]:
|
|
91
|
+
if data is None:
|
|
92
|
+
return data
|
|
93
|
+
if isinstance(data, Unset):
|
|
94
|
+
return data
|
|
95
|
+
return cast(Union[None, Unset, str], data)
|
|
96
|
+
|
|
97
|
+
previous = _parse_previous(d.pop("previous", UNSET))
|
|
98
|
+
|
|
99
|
+
paginated_agent_list = cls(
|
|
100
|
+
count=count,
|
|
101
|
+
results=results,
|
|
102
|
+
next_=next_,
|
|
103
|
+
previous=previous,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
paginated_agent_list.additional_properties = d
|
|
107
|
+
return paginated_agent_list
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def additional_keys(self) -> list[str]:
|
|
111
|
+
return list(self.additional_properties.keys())
|
|
112
|
+
|
|
113
|
+
def __getitem__(self, key: str) -> Any:
|
|
114
|
+
return self.additional_properties[key]
|
|
115
|
+
|
|
116
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
117
|
+
self.additional_properties[key] = value
|
|
118
|
+
|
|
119
|
+
def __delitem__(self, key: str) -> None:
|
|
120
|
+
del self.additional_properties[key]
|
|
121
|
+
|
|
122
|
+
def __contains__(self, key: str) -> bool:
|
|
123
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from ..types import UNSET, Unset
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.attack import Attack
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="PaginatedAttackList")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class PaginatedAttackList:
|
|
18
|
+
"""
|
|
19
|
+
Attributes:
|
|
20
|
+
count (int): Example: 123.
|
|
21
|
+
results (list['Attack']):
|
|
22
|
+
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=4.
|
|
23
|
+
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=2.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
count: int
|
|
27
|
+
results: list["Attack"]
|
|
28
|
+
next_: Union[None, Unset, str] = UNSET
|
|
29
|
+
previous: Union[None, Unset, str] = UNSET
|
|
30
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
31
|
+
|
|
32
|
+
def to_dict(self) -> dict[str, Any]:
|
|
33
|
+
count = self.count
|
|
34
|
+
|
|
35
|
+
results = []
|
|
36
|
+
for results_item_data in self.results:
|
|
37
|
+
results_item = results_item_data.to_dict()
|
|
38
|
+
results.append(results_item)
|
|
39
|
+
|
|
40
|
+
next_: Union[None, Unset, str]
|
|
41
|
+
if isinstance(self.next_, Unset):
|
|
42
|
+
next_ = UNSET
|
|
43
|
+
else:
|
|
44
|
+
next_ = self.next_
|
|
45
|
+
|
|
46
|
+
previous: Union[None, Unset, str]
|
|
47
|
+
if isinstance(self.previous, Unset):
|
|
48
|
+
previous = UNSET
|
|
49
|
+
else:
|
|
50
|
+
previous = self.previous
|
|
51
|
+
|
|
52
|
+
field_dict: dict[str, Any] = {}
|
|
53
|
+
field_dict.update(self.additional_properties)
|
|
54
|
+
field_dict.update(
|
|
55
|
+
{
|
|
56
|
+
"count": count,
|
|
57
|
+
"results": results,
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
if next_ is not UNSET:
|
|
61
|
+
field_dict["next"] = next_
|
|
62
|
+
if previous is not UNSET:
|
|
63
|
+
field_dict["previous"] = previous
|
|
64
|
+
|
|
65
|
+
return field_dict
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
69
|
+
from ..models.attack import Attack
|
|
70
|
+
|
|
71
|
+
d = dict(src_dict)
|
|
72
|
+
count = d.pop("count")
|
|
73
|
+
|
|
74
|
+
results = []
|
|
75
|
+
_results = d.pop("results")
|
|
76
|
+
for results_item_data in _results:
|
|
77
|
+
results_item = Attack.from_dict(results_item_data)
|
|
78
|
+
|
|
79
|
+
results.append(results_item)
|
|
80
|
+
|
|
81
|
+
def _parse_next_(data: object) -> Union[None, Unset, str]:
|
|
82
|
+
if data is None:
|
|
83
|
+
return data
|
|
84
|
+
if isinstance(data, Unset):
|
|
85
|
+
return data
|
|
86
|
+
return cast(Union[None, Unset, str], data)
|
|
87
|
+
|
|
88
|
+
next_ = _parse_next_(d.pop("next", UNSET))
|
|
89
|
+
|
|
90
|
+
def _parse_previous(data: object) -> Union[None, Unset, str]:
|
|
91
|
+
if data is None:
|
|
92
|
+
return data
|
|
93
|
+
if isinstance(data, Unset):
|
|
94
|
+
return data
|
|
95
|
+
return cast(Union[None, Unset, str], data)
|
|
96
|
+
|
|
97
|
+
previous = _parse_previous(d.pop("previous", UNSET))
|
|
98
|
+
|
|
99
|
+
paginated_attack_list = cls(
|
|
100
|
+
count=count,
|
|
101
|
+
results=results,
|
|
102
|
+
next_=next_,
|
|
103
|
+
previous=previous,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
paginated_attack_list.additional_properties = d
|
|
107
|
+
return paginated_attack_list
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def additional_keys(self) -> list[str]:
|
|
111
|
+
return list(self.additional_properties.keys())
|
|
112
|
+
|
|
113
|
+
def __getitem__(self, key: str) -> Any:
|
|
114
|
+
return self.additional_properties[key]
|
|
115
|
+
|
|
116
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
117
|
+
self.additional_properties[key] = value
|
|
118
|
+
|
|
119
|
+
def __delitem__(self, key: str) -> None:
|
|
120
|
+
del self.additional_properties[key]
|
|
121
|
+
|
|
122
|
+
def __contains__(self, key: str) -> bool:
|
|
123
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from ..types import UNSET, Unset
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.prompt import Prompt
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="PaginatedPromptList")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class PaginatedPromptList:
|
|
18
|
+
"""
|
|
19
|
+
Attributes:
|
|
20
|
+
count (int): Example: 123.
|
|
21
|
+
results (list['Prompt']):
|
|
22
|
+
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=4.
|
|
23
|
+
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=2.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
count: int
|
|
27
|
+
results: list["Prompt"]
|
|
28
|
+
next_: Union[None, Unset, str] = UNSET
|
|
29
|
+
previous: Union[None, Unset, str] = UNSET
|
|
30
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
31
|
+
|
|
32
|
+
def to_dict(self) -> dict[str, Any]:
|
|
33
|
+
count = self.count
|
|
34
|
+
|
|
35
|
+
results = []
|
|
36
|
+
for results_item_data in self.results:
|
|
37
|
+
results_item = results_item_data.to_dict()
|
|
38
|
+
results.append(results_item)
|
|
39
|
+
|
|
40
|
+
next_: Union[None, Unset, str]
|
|
41
|
+
if isinstance(self.next_, Unset):
|
|
42
|
+
next_ = UNSET
|
|
43
|
+
else:
|
|
44
|
+
next_ = self.next_
|
|
45
|
+
|
|
46
|
+
previous: Union[None, Unset, str]
|
|
47
|
+
if isinstance(self.previous, Unset):
|
|
48
|
+
previous = UNSET
|
|
49
|
+
else:
|
|
50
|
+
previous = self.previous
|
|
51
|
+
|
|
52
|
+
field_dict: dict[str, Any] = {}
|
|
53
|
+
field_dict.update(self.additional_properties)
|
|
54
|
+
field_dict.update(
|
|
55
|
+
{
|
|
56
|
+
"count": count,
|
|
57
|
+
"results": results,
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
if next_ is not UNSET:
|
|
61
|
+
field_dict["next"] = next_
|
|
62
|
+
if previous is not UNSET:
|
|
63
|
+
field_dict["previous"] = previous
|
|
64
|
+
|
|
65
|
+
return field_dict
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
69
|
+
from ..models.prompt import Prompt
|
|
70
|
+
|
|
71
|
+
d = dict(src_dict)
|
|
72
|
+
count = d.pop("count")
|
|
73
|
+
|
|
74
|
+
results = []
|
|
75
|
+
_results = d.pop("results")
|
|
76
|
+
for results_item_data in _results:
|
|
77
|
+
results_item = Prompt.from_dict(results_item_data)
|
|
78
|
+
|
|
79
|
+
results.append(results_item)
|
|
80
|
+
|
|
81
|
+
def _parse_next_(data: object) -> Union[None, Unset, str]:
|
|
82
|
+
if data is None:
|
|
83
|
+
return data
|
|
84
|
+
if isinstance(data, Unset):
|
|
85
|
+
return data
|
|
86
|
+
return cast(Union[None, Unset, str], data)
|
|
87
|
+
|
|
88
|
+
next_ = _parse_next_(d.pop("next", UNSET))
|
|
89
|
+
|
|
90
|
+
def _parse_previous(data: object) -> Union[None, Unset, str]:
|
|
91
|
+
if data is None:
|
|
92
|
+
return data
|
|
93
|
+
if isinstance(data, Unset):
|
|
94
|
+
return data
|
|
95
|
+
return cast(Union[None, Unset, str], data)
|
|
96
|
+
|
|
97
|
+
previous = _parse_previous(d.pop("previous", UNSET))
|
|
98
|
+
|
|
99
|
+
paginated_prompt_list = cls(
|
|
100
|
+
count=count,
|
|
101
|
+
results=results,
|
|
102
|
+
next_=next_,
|
|
103
|
+
previous=previous,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
paginated_prompt_list.additional_properties = d
|
|
107
|
+
return paginated_prompt_list
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def additional_keys(self) -> list[str]:
|
|
111
|
+
return list(self.additional_properties.keys())
|
|
112
|
+
|
|
113
|
+
def __getitem__(self, key: str) -> Any:
|
|
114
|
+
return self.additional_properties[key]
|
|
115
|
+
|
|
116
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
117
|
+
self.additional_properties[key] = value
|
|
118
|
+
|
|
119
|
+
def __delitem__(self, key: str) -> None:
|
|
120
|
+
del self.additional_properties[key]
|
|
121
|
+
|
|
122
|
+
def __contains__(self, key: str) -> bool:
|
|
123
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from ..types import UNSET, Unset
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.result import Result
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="PaginatedResultList")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class PaginatedResultList:
|
|
18
|
+
"""
|
|
19
|
+
Attributes:
|
|
20
|
+
count (int): Example: 123.
|
|
21
|
+
results (list['Result']):
|
|
22
|
+
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=4.
|
|
23
|
+
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=2.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
count: int
|
|
27
|
+
results: list["Result"]
|
|
28
|
+
next_: Union[None, Unset, str] = UNSET
|
|
29
|
+
previous: Union[None, Unset, str] = UNSET
|
|
30
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
31
|
+
|
|
32
|
+
def to_dict(self) -> dict[str, Any]:
|
|
33
|
+
count = self.count
|
|
34
|
+
|
|
35
|
+
results = []
|
|
36
|
+
for results_item_data in self.results:
|
|
37
|
+
results_item = results_item_data.to_dict()
|
|
38
|
+
results.append(results_item)
|
|
39
|
+
|
|
40
|
+
next_: Union[None, Unset, str]
|
|
41
|
+
if isinstance(self.next_, Unset):
|
|
42
|
+
next_ = UNSET
|
|
43
|
+
else:
|
|
44
|
+
next_ = self.next_
|
|
45
|
+
|
|
46
|
+
previous: Union[None, Unset, str]
|
|
47
|
+
if isinstance(self.previous, Unset):
|
|
48
|
+
previous = UNSET
|
|
49
|
+
else:
|
|
50
|
+
previous = self.previous
|
|
51
|
+
|
|
52
|
+
field_dict: dict[str, Any] = {}
|
|
53
|
+
field_dict.update(self.additional_properties)
|
|
54
|
+
field_dict.update(
|
|
55
|
+
{
|
|
56
|
+
"count": count,
|
|
57
|
+
"results": results,
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
if next_ is not UNSET:
|
|
61
|
+
field_dict["next"] = next_
|
|
62
|
+
if previous is not UNSET:
|
|
63
|
+
field_dict["previous"] = previous
|
|
64
|
+
|
|
65
|
+
return field_dict
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
69
|
+
from ..models.result import Result
|
|
70
|
+
|
|
71
|
+
d = dict(src_dict)
|
|
72
|
+
count = d.pop("count")
|
|
73
|
+
|
|
74
|
+
results = []
|
|
75
|
+
_results = d.pop("results")
|
|
76
|
+
for results_item_data in _results:
|
|
77
|
+
results_item = Result.from_dict(results_item_data)
|
|
78
|
+
|
|
79
|
+
results.append(results_item)
|
|
80
|
+
|
|
81
|
+
def _parse_next_(data: object) -> Union[None, Unset, str]:
|
|
82
|
+
if data is None:
|
|
83
|
+
return data
|
|
84
|
+
if isinstance(data, Unset):
|
|
85
|
+
return data
|
|
86
|
+
return cast(Union[None, Unset, str], data)
|
|
87
|
+
|
|
88
|
+
next_ = _parse_next_(d.pop("next", UNSET))
|
|
89
|
+
|
|
90
|
+
def _parse_previous(data: object) -> Union[None, Unset, str]:
|
|
91
|
+
if data is None:
|
|
92
|
+
return data
|
|
93
|
+
if isinstance(data, Unset):
|
|
94
|
+
return data
|
|
95
|
+
return cast(Union[None, Unset, str], data)
|
|
96
|
+
|
|
97
|
+
previous = _parse_previous(d.pop("previous", UNSET))
|
|
98
|
+
|
|
99
|
+
paginated_result_list = cls(
|
|
100
|
+
count=count,
|
|
101
|
+
results=results,
|
|
102
|
+
next_=next_,
|
|
103
|
+
previous=previous,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
paginated_result_list.additional_properties = d
|
|
107
|
+
return paginated_result_list
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def additional_keys(self) -> list[str]:
|
|
111
|
+
return list(self.additional_properties.keys())
|
|
112
|
+
|
|
113
|
+
def __getitem__(self, key: str) -> Any:
|
|
114
|
+
return self.additional_properties[key]
|
|
115
|
+
|
|
116
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
117
|
+
self.additional_properties[key] = value
|
|
118
|
+
|
|
119
|
+
def __delitem__(self, key: str) -> None:
|
|
120
|
+
del self.additional_properties[key]
|
|
121
|
+
|
|
122
|
+
def __contains__(self, key: str) -> bool:
|
|
123
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from ..types import UNSET, Unset
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.run import Run
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="PaginatedRunList")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class PaginatedRunList:
|
|
18
|
+
"""
|
|
19
|
+
Attributes:
|
|
20
|
+
count (int): Example: 123.
|
|
21
|
+
results (list['Run']):
|
|
22
|
+
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=4.
|
|
23
|
+
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=2.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
count: int
|
|
27
|
+
results: list["Run"]
|
|
28
|
+
next_: Union[None, Unset, str] = UNSET
|
|
29
|
+
previous: Union[None, Unset, str] = UNSET
|
|
30
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
31
|
+
|
|
32
|
+
def to_dict(self) -> dict[str, Any]:
|
|
33
|
+
count = self.count
|
|
34
|
+
|
|
35
|
+
results = []
|
|
36
|
+
for results_item_data in self.results:
|
|
37
|
+
results_item = results_item_data.to_dict()
|
|
38
|
+
results.append(results_item)
|
|
39
|
+
|
|
40
|
+
next_: Union[None, Unset, str]
|
|
41
|
+
if isinstance(self.next_, Unset):
|
|
42
|
+
next_ = UNSET
|
|
43
|
+
else:
|
|
44
|
+
next_ = self.next_
|
|
45
|
+
|
|
46
|
+
previous: Union[None, Unset, str]
|
|
47
|
+
if isinstance(self.previous, Unset):
|
|
48
|
+
previous = UNSET
|
|
49
|
+
else:
|
|
50
|
+
previous = self.previous
|
|
51
|
+
|
|
52
|
+
field_dict: dict[str, Any] = {}
|
|
53
|
+
field_dict.update(self.additional_properties)
|
|
54
|
+
field_dict.update(
|
|
55
|
+
{
|
|
56
|
+
"count": count,
|
|
57
|
+
"results": results,
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
if next_ is not UNSET:
|
|
61
|
+
field_dict["next"] = next_
|
|
62
|
+
if previous is not UNSET:
|
|
63
|
+
field_dict["previous"] = previous
|
|
64
|
+
|
|
65
|
+
return field_dict
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
69
|
+
from ..models.run import Run
|
|
70
|
+
|
|
71
|
+
d = dict(src_dict)
|
|
72
|
+
count = d.pop("count")
|
|
73
|
+
|
|
74
|
+
results = []
|
|
75
|
+
_results = d.pop("results")
|
|
76
|
+
for results_item_data in _results:
|
|
77
|
+
results_item = Run.from_dict(results_item_data)
|
|
78
|
+
|
|
79
|
+
results.append(results_item)
|
|
80
|
+
|
|
81
|
+
def _parse_next_(data: object) -> Union[None, Unset, str]:
|
|
82
|
+
if data is None:
|
|
83
|
+
return data
|
|
84
|
+
if isinstance(data, Unset):
|
|
85
|
+
return data
|
|
86
|
+
return cast(Union[None, Unset, str], data)
|
|
87
|
+
|
|
88
|
+
next_ = _parse_next_(d.pop("next", UNSET))
|
|
89
|
+
|
|
90
|
+
def _parse_previous(data: object) -> Union[None, Unset, str]:
|
|
91
|
+
if data is None:
|
|
92
|
+
return data
|
|
93
|
+
if isinstance(data, Unset):
|
|
94
|
+
return data
|
|
95
|
+
return cast(Union[None, Unset, str], data)
|
|
96
|
+
|
|
97
|
+
previous = _parse_previous(d.pop("previous", UNSET))
|
|
98
|
+
|
|
99
|
+
paginated_run_list = cls(
|
|
100
|
+
count=count,
|
|
101
|
+
results=results,
|
|
102
|
+
next_=next_,
|
|
103
|
+
previous=previous,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
paginated_run_list.additional_properties = d
|
|
107
|
+
return paginated_run_list
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def additional_keys(self) -> list[str]:
|
|
111
|
+
return list(self.additional_properties.keys())
|
|
112
|
+
|
|
113
|
+
def __getitem__(self, key: str) -> Any:
|
|
114
|
+
return self.additional_properties[key]
|
|
115
|
+
|
|
116
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
117
|
+
self.additional_properties[key] = value
|
|
118
|
+
|
|
119
|
+
def __delitem__(self, key: str) -> None:
|
|
120
|
+
del self.additional_properties[key]
|
|
121
|
+
|
|
122
|
+
def __contains__(self, key: str) -> bool:
|
|
123
|
+
return key in self.additional_properties
|