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.
Files changed (117) hide show
  1. hackagent/__init__.py +23 -0
  2. hackagent/agent.py +193 -0
  3. hackagent/api/__init__.py +1 -0
  4. hackagent/api/agent/__init__.py +1 -0
  5. hackagent/api/agent/agent_create.py +340 -0
  6. hackagent/api/agent/agent_destroy.py +136 -0
  7. hackagent/api/agent/agent_list.py +234 -0
  8. hackagent/api/agent/agent_partial_update.py +354 -0
  9. hackagent/api/agent/agent_retrieve.py +227 -0
  10. hackagent/api/agent/agent_update.py +354 -0
  11. hackagent/api/attack/__init__.py +1 -0
  12. hackagent/api/attack/attack_create.py +264 -0
  13. hackagent/api/attack/attack_destroy.py +140 -0
  14. hackagent/api/attack/attack_list.py +242 -0
  15. hackagent/api/attack/attack_partial_update.py +278 -0
  16. hackagent/api/attack/attack_retrieve.py +235 -0
  17. hackagent/api/attack/attack_update.py +278 -0
  18. hackagent/api/key/__init__.py +1 -0
  19. hackagent/api/key/key_create.py +168 -0
  20. hackagent/api/key/key_destroy.py +97 -0
  21. hackagent/api/key/key_list.py +158 -0
  22. hackagent/api/key/key_retrieve.py +150 -0
  23. hackagent/api/prompt/__init__.py +1 -0
  24. hackagent/api/prompt/prompt_create.py +160 -0
  25. hackagent/api/prompt/prompt_destroy.py +98 -0
  26. hackagent/api/prompt/prompt_list.py +173 -0
  27. hackagent/api/prompt/prompt_partial_update.py +174 -0
  28. hackagent/api/prompt/prompt_retrieve.py +151 -0
  29. hackagent/api/prompt/prompt_update.py +174 -0
  30. hackagent/api/result/__init__.py +1 -0
  31. hackagent/api/result/result_create.py +160 -0
  32. hackagent/api/result/result_destroy.py +98 -0
  33. hackagent/api/result/result_list.py +233 -0
  34. hackagent/api/result/result_partial_update.py +178 -0
  35. hackagent/api/result/result_retrieve.py +151 -0
  36. hackagent/api/result/result_trace_create.py +178 -0
  37. hackagent/api/result/result_update.py +174 -0
  38. hackagent/api/run/__init__.py +1 -0
  39. hackagent/api/run/run_create.py +172 -0
  40. hackagent/api/run/run_destroy.py +104 -0
  41. hackagent/api/run/run_list.py +260 -0
  42. hackagent/api/run/run_partial_update.py +186 -0
  43. hackagent/api/run/run_result_create.py +178 -0
  44. hackagent/api/run/run_retrieve.py +163 -0
  45. hackagent/api/run/run_run_tests_create.py +172 -0
  46. hackagent/api/run/run_update.py +186 -0
  47. hackagent/attacks/AdvPrefix/README.md +7 -0
  48. hackagent/attacks/AdvPrefix/__init__.py +0 -0
  49. hackagent/attacks/AdvPrefix/completer.py +438 -0
  50. hackagent/attacks/AdvPrefix/config.py +59 -0
  51. hackagent/attacks/AdvPrefix/preprocessing.py +521 -0
  52. hackagent/attacks/AdvPrefix/scorer.py +259 -0
  53. hackagent/attacks/AdvPrefix/scorer_parser.py +498 -0
  54. hackagent/attacks/AdvPrefix/selector.py +246 -0
  55. hackagent/attacks/AdvPrefix/step1_generate.py +324 -0
  56. hackagent/attacks/AdvPrefix/step4_compute_ce.py +293 -0
  57. hackagent/attacks/AdvPrefix/step6_get_completions.py +387 -0
  58. hackagent/attacks/AdvPrefix/step7_evaluate_responses.py +289 -0
  59. hackagent/attacks/AdvPrefix/step8_aggregate_evaluations.py +177 -0
  60. hackagent/attacks/AdvPrefix/step9_select_prefixes.py +59 -0
  61. hackagent/attacks/AdvPrefix/utils.py +192 -0
  62. hackagent/attacks/__init__.py +6 -0
  63. hackagent/attacks/advprefix.py +1136 -0
  64. hackagent/attacks/base.py +50 -0
  65. hackagent/attacks/strategies.py +539 -0
  66. hackagent/branding.py +143 -0
  67. hackagent/client.py +328 -0
  68. hackagent/errors.py +31 -0
  69. hackagent/logger.py +67 -0
  70. hackagent/models/__init__.py +71 -0
  71. hackagent/models/agent.py +240 -0
  72. hackagent/models/agent_request.py +169 -0
  73. hackagent/models/agent_type_enum.py +12 -0
  74. hackagent/models/attack.py +154 -0
  75. hackagent/models/attack_request.py +82 -0
  76. hackagent/models/evaluation_status_enum.py +14 -0
  77. hackagent/models/organization_minimal.py +68 -0
  78. hackagent/models/paginated_agent_list.py +123 -0
  79. hackagent/models/paginated_attack_list.py +123 -0
  80. hackagent/models/paginated_prompt_list.py +123 -0
  81. hackagent/models/paginated_result_list.py +123 -0
  82. hackagent/models/paginated_run_list.py +123 -0
  83. hackagent/models/paginated_user_api_key_list.py +123 -0
  84. hackagent/models/patched_agent_request.py +176 -0
  85. hackagent/models/patched_attack_request.py +92 -0
  86. hackagent/models/patched_prompt_request.py +162 -0
  87. hackagent/models/patched_result_request.py +237 -0
  88. hackagent/models/patched_run_request.py +138 -0
  89. hackagent/models/prompt.py +226 -0
  90. hackagent/models/prompt_request.py +155 -0
  91. hackagent/models/result.py +294 -0
  92. hackagent/models/result_list_evaluation_status.py +14 -0
  93. hackagent/models/result_request.py +232 -0
  94. hackagent/models/run.py +233 -0
  95. hackagent/models/run_list_status.py +12 -0
  96. hackagent/models/run_request.py +133 -0
  97. hackagent/models/status_enum.py +12 -0
  98. hackagent/models/step_type_enum.py +14 -0
  99. hackagent/models/trace.py +121 -0
  100. hackagent/models/trace_request.py +94 -0
  101. hackagent/models/user_api_key.py +201 -0
  102. hackagent/models/user_api_key_request.py +73 -0
  103. hackagent/models/user_profile_minimal.py +76 -0
  104. hackagent/py.typed +1 -0
  105. hackagent/router/__init__.py +11 -0
  106. hackagent/router/adapters/__init__.py +5 -0
  107. hackagent/router/adapters/google_adk.py +658 -0
  108. hackagent/router/adapters/litellm_adapter.py +290 -0
  109. hackagent/router/base.py +48 -0
  110. hackagent/router/router.py +753 -0
  111. hackagent/types.py +46 -0
  112. hackagent/utils.py +61 -0
  113. hackagent/vulnerabilities/__init__.py +0 -0
  114. hackagent-0.1.0.dist-info/LICENSE +202 -0
  115. hackagent-0.1.0.dist-info/METADATA +173 -0
  116. hackagent-0.1.0.dist-info/RECORD +117 -0
  117. hackagent-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,151 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.result import Result
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ id: UUID,
15
+ ) -> dict[str, Any]:
16
+ _kwargs: dict[str, Any] = {
17
+ "method": "get",
18
+ "url": f"/api/result/{id}",
19
+ }
20
+
21
+ return _kwargs
22
+
23
+
24
+ def _parse_response(
25
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
26
+ ) -> Optional[Result]:
27
+ if response.status_code == 200:
28
+ response_200 = Result.from_dict(response.json())
29
+
30
+ return response_200
31
+ if client.raise_on_unexpected_status:
32
+ raise errors.UnexpectedStatus(response.status_code, response.content)
33
+ else:
34
+ return None
35
+
36
+
37
+ def _build_response(
38
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
39
+ ) -> Response[Result]:
40
+ return Response(
41
+ status_code=HTTPStatus(response.status_code),
42
+ content=response.content,
43
+ headers=response.headers,
44
+ parsed=_parse_response(client=client, response=response),
45
+ )
46
+
47
+
48
+ def sync_detailed(
49
+ id: UUID,
50
+ *,
51
+ client: AuthenticatedClient,
52
+ ) -> Response[Result]:
53
+ """ViewSet for managing Result instances. Allows creation of Traces via an action.
54
+
55
+ Args:
56
+ id (UUID):
57
+
58
+ Raises:
59
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
60
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
61
+
62
+ Returns:
63
+ Response[Result]
64
+ """
65
+
66
+ kwargs = _get_kwargs(
67
+ id=id,
68
+ )
69
+
70
+ response = client.get_httpx_client().request(
71
+ **kwargs,
72
+ )
73
+
74
+ return _build_response(client=client, response=response)
75
+
76
+
77
+ def sync(
78
+ id: UUID,
79
+ *,
80
+ client: AuthenticatedClient,
81
+ ) -> Optional[Result]:
82
+ """ViewSet for managing Result instances. Allows creation of Traces via an action.
83
+
84
+ Args:
85
+ id (UUID):
86
+
87
+ Raises:
88
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
89
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
90
+
91
+ Returns:
92
+ Result
93
+ """
94
+
95
+ return sync_detailed(
96
+ id=id,
97
+ client=client,
98
+ ).parsed
99
+
100
+
101
+ async def asyncio_detailed(
102
+ id: UUID,
103
+ *,
104
+ client: AuthenticatedClient,
105
+ ) -> Response[Result]:
106
+ """ViewSet for managing Result instances. Allows creation of Traces via an action.
107
+
108
+ Args:
109
+ id (UUID):
110
+
111
+ Raises:
112
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
113
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
114
+
115
+ Returns:
116
+ Response[Result]
117
+ """
118
+
119
+ kwargs = _get_kwargs(
120
+ id=id,
121
+ )
122
+
123
+ response = await client.get_async_httpx_client().request(**kwargs)
124
+
125
+ return _build_response(client=client, response=response)
126
+
127
+
128
+ async def asyncio(
129
+ id: UUID,
130
+ *,
131
+ client: AuthenticatedClient,
132
+ ) -> Optional[Result]:
133
+ """ViewSet for managing Result instances. Allows creation of Traces via an action.
134
+
135
+ Args:
136
+ id (UUID):
137
+
138
+ Raises:
139
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
140
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
141
+
142
+ Returns:
143
+ Result
144
+ """
145
+
146
+ return (
147
+ await asyncio_detailed(
148
+ id=id,
149
+ client=client,
150
+ )
151
+ ).parsed
@@ -0,0 +1,178 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.trace import Trace
10
+ from ...models.trace_request import TraceRequest
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ id: UUID,
16
+ *,
17
+ body: TraceRequest,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "post",
23
+ "url": f"/api/result/{id}/trace",
24
+ }
25
+
26
+ _body = body.to_dict()
27
+
28
+ _kwargs["json"] = _body
29
+ headers["Content-Type"] = "application/json"
30
+
31
+ _kwargs["headers"] = headers
32
+ return _kwargs
33
+
34
+
35
+ def _parse_response(
36
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
37
+ ) -> Optional[Trace]:
38
+ if response.status_code == 200:
39
+ response_200 = Trace.from_dict(response.json())
40
+
41
+ return response_200
42
+ if client.raise_on_unexpected_status:
43
+ raise errors.UnexpectedStatus(response.status_code, response.content)
44
+ else:
45
+ return None
46
+
47
+
48
+ def _build_response(
49
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
50
+ ) -> Response[Trace]:
51
+ return Response(
52
+ status_code=HTTPStatus(response.status_code),
53
+ content=response.content,
54
+ headers=response.headers,
55
+ parsed=_parse_response(client=client, response=response),
56
+ )
57
+
58
+
59
+ def sync_detailed(
60
+ id: UUID,
61
+ *,
62
+ client: AuthenticatedClient,
63
+ body: TraceRequest,
64
+ ) -> Response[Trace]:
65
+ """Creates a new Trace associated with this Result.
66
+ The result instance is fetched using the 'pk' from the URL.
67
+
68
+ Args:
69
+ id (UUID):
70
+ body (TraceRequest): Serializer for the Trace model.
71
+
72
+ Raises:
73
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
74
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
75
+
76
+ Returns:
77
+ Response[Trace]
78
+ """
79
+
80
+ kwargs = _get_kwargs(
81
+ id=id,
82
+ body=body,
83
+ )
84
+
85
+ response = client.get_httpx_client().request(
86
+ **kwargs,
87
+ )
88
+
89
+ return _build_response(client=client, response=response)
90
+
91
+
92
+ def sync(
93
+ id: UUID,
94
+ *,
95
+ client: AuthenticatedClient,
96
+ body: TraceRequest,
97
+ ) -> Optional[Trace]:
98
+ """Creates a new Trace associated with this Result.
99
+ The result instance is fetched using the 'pk' from the URL.
100
+
101
+ Args:
102
+ id (UUID):
103
+ body (TraceRequest): Serializer for the Trace model.
104
+
105
+ Raises:
106
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
107
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
108
+
109
+ Returns:
110
+ Trace
111
+ """
112
+
113
+ return sync_detailed(
114
+ id=id,
115
+ client=client,
116
+ body=body,
117
+ ).parsed
118
+
119
+
120
+ async def asyncio_detailed(
121
+ id: UUID,
122
+ *,
123
+ client: AuthenticatedClient,
124
+ body: TraceRequest,
125
+ ) -> Response[Trace]:
126
+ """Creates a new Trace associated with this Result.
127
+ The result instance is fetched using the 'pk' from the URL.
128
+
129
+ Args:
130
+ id (UUID):
131
+ body (TraceRequest): Serializer for the Trace model.
132
+
133
+ Raises:
134
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
135
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
136
+
137
+ Returns:
138
+ Response[Trace]
139
+ """
140
+
141
+ kwargs = _get_kwargs(
142
+ id=id,
143
+ body=body,
144
+ )
145
+
146
+ response = await client.get_async_httpx_client().request(**kwargs)
147
+
148
+ return _build_response(client=client, response=response)
149
+
150
+
151
+ async def asyncio(
152
+ id: UUID,
153
+ *,
154
+ client: AuthenticatedClient,
155
+ body: TraceRequest,
156
+ ) -> Optional[Trace]:
157
+ """Creates a new Trace associated with this Result.
158
+ The result instance is fetched using the 'pk' from the URL.
159
+
160
+ Args:
161
+ id (UUID):
162
+ body (TraceRequest): Serializer for the Trace model.
163
+
164
+ Raises:
165
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
166
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
167
+
168
+ Returns:
169
+ Trace
170
+ """
171
+
172
+ return (
173
+ await asyncio_detailed(
174
+ id=id,
175
+ client=client,
176
+ body=body,
177
+ )
178
+ ).parsed
@@ -0,0 +1,174 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.result import Result
10
+ from ...models.result_request import ResultRequest
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ id: UUID,
16
+ *,
17
+ body: ResultRequest,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "put",
23
+ "url": f"/api/result/{id}",
24
+ }
25
+
26
+ _body = body.to_dict()
27
+
28
+ _kwargs["json"] = _body
29
+ headers["Content-Type"] = "application/json"
30
+
31
+ _kwargs["headers"] = headers
32
+ return _kwargs
33
+
34
+
35
+ def _parse_response(
36
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
37
+ ) -> Optional[Result]:
38
+ if response.status_code == 200:
39
+ response_200 = Result.from_dict(response.json())
40
+
41
+ return response_200
42
+ if client.raise_on_unexpected_status:
43
+ raise errors.UnexpectedStatus(response.status_code, response.content)
44
+ else:
45
+ return None
46
+
47
+
48
+ def _build_response(
49
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
50
+ ) -> Response[Result]:
51
+ return Response(
52
+ status_code=HTTPStatus(response.status_code),
53
+ content=response.content,
54
+ headers=response.headers,
55
+ parsed=_parse_response(client=client, response=response),
56
+ )
57
+
58
+
59
+ def sync_detailed(
60
+ id: UUID,
61
+ *,
62
+ client: AuthenticatedClient,
63
+ body: ResultRequest,
64
+ ) -> Response[Result]:
65
+ """ViewSet for managing Result instances. Allows creation of Traces via an action.
66
+
67
+ Args:
68
+ id (UUID):
69
+ body (ResultRequest): Serializer for the Result model, often nested in RunSerializer.
70
+
71
+ Raises:
72
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
73
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
74
+
75
+ Returns:
76
+ Response[Result]
77
+ """
78
+
79
+ kwargs = _get_kwargs(
80
+ id=id,
81
+ body=body,
82
+ )
83
+
84
+ response = client.get_httpx_client().request(
85
+ **kwargs,
86
+ )
87
+
88
+ return _build_response(client=client, response=response)
89
+
90
+
91
+ def sync(
92
+ id: UUID,
93
+ *,
94
+ client: AuthenticatedClient,
95
+ body: ResultRequest,
96
+ ) -> Optional[Result]:
97
+ """ViewSet for managing Result instances. Allows creation of Traces via an action.
98
+
99
+ Args:
100
+ id (UUID):
101
+ body (ResultRequest): Serializer for the Result model, often nested in RunSerializer.
102
+
103
+ Raises:
104
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
105
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
106
+
107
+ Returns:
108
+ Result
109
+ """
110
+
111
+ return sync_detailed(
112
+ id=id,
113
+ client=client,
114
+ body=body,
115
+ ).parsed
116
+
117
+
118
+ async def asyncio_detailed(
119
+ id: UUID,
120
+ *,
121
+ client: AuthenticatedClient,
122
+ body: ResultRequest,
123
+ ) -> Response[Result]:
124
+ """ViewSet for managing Result instances. Allows creation of Traces via an action.
125
+
126
+ Args:
127
+ id (UUID):
128
+ body (ResultRequest): Serializer for the Result model, often nested in RunSerializer.
129
+
130
+ Raises:
131
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
132
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
133
+
134
+ Returns:
135
+ Response[Result]
136
+ """
137
+
138
+ kwargs = _get_kwargs(
139
+ id=id,
140
+ body=body,
141
+ )
142
+
143
+ response = await client.get_async_httpx_client().request(**kwargs)
144
+
145
+ return _build_response(client=client, response=response)
146
+
147
+
148
+ async def asyncio(
149
+ id: UUID,
150
+ *,
151
+ client: AuthenticatedClient,
152
+ body: ResultRequest,
153
+ ) -> Optional[Result]:
154
+ """ViewSet for managing Result instances. Allows creation of Traces via an action.
155
+
156
+ Args:
157
+ id (UUID):
158
+ body (ResultRequest): Serializer for the Result model, often nested in RunSerializer.
159
+
160
+ Raises:
161
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
162
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
163
+
164
+ Returns:
165
+ Result
166
+ """
167
+
168
+ return (
169
+ await asyncio_detailed(
170
+ id=id,
171
+ client=client,
172
+ body=body,
173
+ )
174
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,172 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.run import Run
9
+ from ...models.run_request import RunRequest
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ body: RunRequest,
16
+ ) -> dict[str, Any]:
17
+ headers: dict[str, Any] = {}
18
+
19
+ _kwargs: dict[str, Any] = {
20
+ "method": "post",
21
+ "url": "/api/run",
22
+ }
23
+
24
+ _body = body.to_dict()
25
+
26
+ _kwargs["json"] = _body
27
+ headers["Content-Type"] = "application/json"
28
+
29
+ _kwargs["headers"] = headers
30
+ return _kwargs
31
+
32
+
33
+ def _parse_response(
34
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
35
+ ) -> Optional[Run]:
36
+ if response.status_code == 201:
37
+ response_201 = Run.from_dict(response.json())
38
+
39
+ return response_201
40
+ if client.raise_on_unexpected_status:
41
+ raise errors.UnexpectedStatus(response.status_code, response.content)
42
+ else:
43
+ return None
44
+
45
+
46
+ def _build_response(
47
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
48
+ ) -> Response[Run]:
49
+ return Response(
50
+ status_code=HTTPStatus(response.status_code),
51
+ content=response.content,
52
+ headers=response.headers,
53
+ parsed=_parse_response(client=client, response=response),
54
+ )
55
+
56
+
57
+ def sync_detailed(
58
+ *,
59
+ client: AuthenticatedClient,
60
+ body: RunRequest,
61
+ ) -> Response[Run]:
62
+ """ViewSet for managing Run instances.
63
+ Primarily for listing/retrieving runs.
64
+ Creation of server-side runs is handled by custom actions.
65
+ Runs initiated from Attack definitions are created via AttackViewSet.
66
+
67
+ Args:
68
+ body (RunRequest): Serializer for the Run model, used for both input and output.
69
+
70
+ Raises:
71
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
72
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
73
+
74
+ Returns:
75
+ Response[Run]
76
+ """
77
+
78
+ kwargs = _get_kwargs(
79
+ body=body,
80
+ )
81
+
82
+ response = client.get_httpx_client().request(
83
+ **kwargs,
84
+ )
85
+
86
+ return _build_response(client=client, response=response)
87
+
88
+
89
+ def sync(
90
+ *,
91
+ client: AuthenticatedClient,
92
+ body: RunRequest,
93
+ ) -> Optional[Run]:
94
+ """ViewSet for managing Run instances.
95
+ Primarily for listing/retrieving runs.
96
+ Creation of server-side runs is handled by custom actions.
97
+ Runs initiated from Attack definitions are created via AttackViewSet.
98
+
99
+ Args:
100
+ body (RunRequest): Serializer for the Run model, used for both input and output.
101
+
102
+ Raises:
103
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
104
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
105
+
106
+ Returns:
107
+ Run
108
+ """
109
+
110
+ return sync_detailed(
111
+ client=client,
112
+ body=body,
113
+ ).parsed
114
+
115
+
116
+ async def asyncio_detailed(
117
+ *,
118
+ client: AuthenticatedClient,
119
+ body: RunRequest,
120
+ ) -> Response[Run]:
121
+ """ViewSet for managing Run instances.
122
+ Primarily for listing/retrieving runs.
123
+ Creation of server-side runs is handled by custom actions.
124
+ Runs initiated from Attack definitions are created via AttackViewSet.
125
+
126
+ Args:
127
+ body (RunRequest): Serializer for the Run model, used for both input and output.
128
+
129
+ Raises:
130
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
131
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
132
+
133
+ Returns:
134
+ Response[Run]
135
+ """
136
+
137
+ kwargs = _get_kwargs(
138
+ body=body,
139
+ )
140
+
141
+ response = await client.get_async_httpx_client().request(**kwargs)
142
+
143
+ return _build_response(client=client, response=response)
144
+
145
+
146
+ async def asyncio(
147
+ *,
148
+ client: AuthenticatedClient,
149
+ body: RunRequest,
150
+ ) -> Optional[Run]:
151
+ """ViewSet for managing Run instances.
152
+ Primarily for listing/retrieving runs.
153
+ Creation of server-side runs is handled by custom actions.
154
+ Runs initiated from Attack definitions are created via AttackViewSet.
155
+
156
+ Args:
157
+ body (RunRequest): Serializer for the Run model, used for both input and output.
158
+
159
+ Raises:
160
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
161
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
162
+
163
+ Returns:
164
+ Run
165
+ """
166
+
167
+ return (
168
+ await asyncio_detailed(
169
+ client=client,
170
+ body=body,
171
+ )
172
+ ).parsed