hackagent 0.3.1__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 (183) hide show
  1. hackagent/__init__.py +12 -0
  2. hackagent/agent.py +214 -0
  3. hackagent/api/__init__.py +1 -0
  4. hackagent/api/agent/__init__.py +1 -0
  5. hackagent/api/agent/agent_create.py +347 -0
  6. hackagent/api/agent/agent_destroy.py +140 -0
  7. hackagent/api/agent/agent_list.py +242 -0
  8. hackagent/api/agent/agent_partial_update.py +361 -0
  9. hackagent/api/agent/agent_retrieve.py +235 -0
  10. hackagent/api/agent/agent_update.py +361 -0
  11. hackagent/api/apilogs/__init__.py +1 -0
  12. hackagent/api/apilogs/apilogs_list.py +170 -0
  13. hackagent/api/apilogs/apilogs_retrieve.py +162 -0
  14. hackagent/api/attack/__init__.py +1 -0
  15. hackagent/api/attack/attack_create.py +275 -0
  16. hackagent/api/attack/attack_destroy.py +146 -0
  17. hackagent/api/attack/attack_list.py +254 -0
  18. hackagent/api/attack/attack_partial_update.py +289 -0
  19. hackagent/api/attack/attack_retrieve.py +247 -0
  20. hackagent/api/attack/attack_update.py +289 -0
  21. hackagent/api/checkout/__init__.py +1 -0
  22. hackagent/api/checkout/checkout_create.py +225 -0
  23. hackagent/api/generate/__init__.py +1 -0
  24. hackagent/api/generate/generate_create.py +253 -0
  25. hackagent/api/judge/__init__.py +1 -0
  26. hackagent/api/judge/judge_create.py +253 -0
  27. hackagent/api/key/__init__.py +1 -0
  28. hackagent/api/key/key_create.py +179 -0
  29. hackagent/api/key/key_destroy.py +103 -0
  30. hackagent/api/key/key_list.py +170 -0
  31. hackagent/api/key/key_retrieve.py +162 -0
  32. hackagent/api/organization/__init__.py +1 -0
  33. hackagent/api/organization/organization_create.py +208 -0
  34. hackagent/api/organization/organization_destroy.py +104 -0
  35. hackagent/api/organization/organization_list.py +170 -0
  36. hackagent/api/organization/organization_me_retrieve.py +126 -0
  37. hackagent/api/organization/organization_partial_update.py +222 -0
  38. hackagent/api/organization/organization_retrieve.py +163 -0
  39. hackagent/api/organization/organization_update.py +222 -0
  40. hackagent/api/prompt/__init__.py +1 -0
  41. hackagent/api/prompt/prompt_create.py +171 -0
  42. hackagent/api/prompt/prompt_destroy.py +104 -0
  43. hackagent/api/prompt/prompt_list.py +185 -0
  44. hackagent/api/prompt/prompt_partial_update.py +185 -0
  45. hackagent/api/prompt/prompt_retrieve.py +163 -0
  46. hackagent/api/prompt/prompt_update.py +185 -0
  47. hackagent/api/result/__init__.py +1 -0
  48. hackagent/api/result/result_create.py +175 -0
  49. hackagent/api/result/result_destroy.py +106 -0
  50. hackagent/api/result/result_list.py +249 -0
  51. hackagent/api/result/result_partial_update.py +193 -0
  52. hackagent/api/result/result_retrieve.py +167 -0
  53. hackagent/api/result/result_trace_create.py +177 -0
  54. hackagent/api/result/result_update.py +189 -0
  55. hackagent/api/run/__init__.py +1 -0
  56. hackagent/api/run/run_create.py +187 -0
  57. hackagent/api/run/run_destroy.py +112 -0
  58. hackagent/api/run/run_list.py +291 -0
  59. hackagent/api/run/run_partial_update.py +201 -0
  60. hackagent/api/run/run_result_create.py +177 -0
  61. hackagent/api/run/run_retrieve.py +179 -0
  62. hackagent/api/run/run_run_tests_create.py +187 -0
  63. hackagent/api/run/run_update.py +201 -0
  64. hackagent/api/user/__init__.py +1 -0
  65. hackagent/api/user/user_create.py +212 -0
  66. hackagent/api/user/user_destroy.py +106 -0
  67. hackagent/api/user/user_list.py +174 -0
  68. hackagent/api/user/user_me_retrieve.py +126 -0
  69. hackagent/api/user/user_me_update.py +196 -0
  70. hackagent/api/user/user_partial_update.py +226 -0
  71. hackagent/api/user/user_retrieve.py +167 -0
  72. hackagent/api/user/user_update.py +226 -0
  73. hackagent/attacks/AdvPrefix/__init__.py +41 -0
  74. hackagent/attacks/AdvPrefix/completions.py +416 -0
  75. hackagent/attacks/AdvPrefix/config.py +259 -0
  76. hackagent/attacks/AdvPrefix/evaluation.py +745 -0
  77. hackagent/attacks/AdvPrefix/evaluators.py +564 -0
  78. hackagent/attacks/AdvPrefix/generate.py +711 -0
  79. hackagent/attacks/AdvPrefix/utils.py +307 -0
  80. hackagent/attacks/__init__.py +35 -0
  81. hackagent/attacks/advprefix.py +507 -0
  82. hackagent/attacks/base.py +106 -0
  83. hackagent/attacks/strategies.py +906 -0
  84. hackagent/cli/__init__.py +19 -0
  85. hackagent/cli/commands/__init__.py +20 -0
  86. hackagent/cli/commands/agent.py +100 -0
  87. hackagent/cli/commands/attack.py +417 -0
  88. hackagent/cli/commands/config.py +301 -0
  89. hackagent/cli/commands/results.py +327 -0
  90. hackagent/cli/config.py +249 -0
  91. hackagent/cli/main.py +515 -0
  92. hackagent/cli/tui/__init__.py +31 -0
  93. hackagent/cli/tui/actions_logger.py +200 -0
  94. hackagent/cli/tui/app.py +288 -0
  95. hackagent/cli/tui/base.py +137 -0
  96. hackagent/cli/tui/logger.py +318 -0
  97. hackagent/cli/tui/views/__init__.py +33 -0
  98. hackagent/cli/tui/views/agents.py +488 -0
  99. hackagent/cli/tui/views/attacks.py +624 -0
  100. hackagent/cli/tui/views/config.py +244 -0
  101. hackagent/cli/tui/views/dashboard.py +307 -0
  102. hackagent/cli/tui/views/results.py +1210 -0
  103. hackagent/cli/tui/widgets/__init__.py +24 -0
  104. hackagent/cli/tui/widgets/actions.py +346 -0
  105. hackagent/cli/tui/widgets/logs.py +435 -0
  106. hackagent/cli/utils.py +276 -0
  107. hackagent/client.py +286 -0
  108. hackagent/errors.py +37 -0
  109. hackagent/logger.py +83 -0
  110. hackagent/models/__init__.py +109 -0
  111. hackagent/models/agent.py +223 -0
  112. hackagent/models/agent_request.py +129 -0
  113. hackagent/models/api_token_log.py +184 -0
  114. hackagent/models/attack.py +154 -0
  115. hackagent/models/attack_request.py +82 -0
  116. hackagent/models/checkout_session_request_request.py +76 -0
  117. hackagent/models/checkout_session_response.py +59 -0
  118. hackagent/models/choice.py +81 -0
  119. hackagent/models/choice_message.py +67 -0
  120. hackagent/models/evaluation_status_enum.py +14 -0
  121. hackagent/models/generate_error_response.py +59 -0
  122. hackagent/models/generate_request_request.py +212 -0
  123. hackagent/models/generate_success_response.py +115 -0
  124. hackagent/models/generic_error_response.py +70 -0
  125. hackagent/models/message_request.py +67 -0
  126. hackagent/models/organization.py +102 -0
  127. hackagent/models/organization_minimal.py +68 -0
  128. hackagent/models/organization_request.py +71 -0
  129. hackagent/models/paginated_agent_list.py +123 -0
  130. hackagent/models/paginated_api_token_log_list.py +123 -0
  131. hackagent/models/paginated_attack_list.py +123 -0
  132. hackagent/models/paginated_organization_list.py +123 -0
  133. hackagent/models/paginated_prompt_list.py +123 -0
  134. hackagent/models/paginated_result_list.py +123 -0
  135. hackagent/models/paginated_run_list.py +123 -0
  136. hackagent/models/paginated_user_api_key_list.py +123 -0
  137. hackagent/models/paginated_user_profile_list.py +123 -0
  138. hackagent/models/patched_agent_request.py +128 -0
  139. hackagent/models/patched_attack_request.py +92 -0
  140. hackagent/models/patched_organization_request.py +71 -0
  141. hackagent/models/patched_prompt_request.py +125 -0
  142. hackagent/models/patched_result_request.py +237 -0
  143. hackagent/models/patched_run_request.py +138 -0
  144. hackagent/models/patched_user_profile_request.py +99 -0
  145. hackagent/models/prompt.py +220 -0
  146. hackagent/models/prompt_request.py +126 -0
  147. hackagent/models/result.py +294 -0
  148. hackagent/models/result_list_evaluation_status.py +14 -0
  149. hackagent/models/result_request.py +232 -0
  150. hackagent/models/run.py +233 -0
  151. hackagent/models/run_list_status.py +12 -0
  152. hackagent/models/run_request.py +133 -0
  153. hackagent/models/status_enum.py +12 -0
  154. hackagent/models/step_type_enum.py +14 -0
  155. hackagent/models/trace.py +121 -0
  156. hackagent/models/trace_request.py +94 -0
  157. hackagent/models/usage.py +75 -0
  158. hackagent/models/user_api_key.py +201 -0
  159. hackagent/models/user_api_key_request.py +73 -0
  160. hackagent/models/user_profile.py +135 -0
  161. hackagent/models/user_profile_minimal.py +76 -0
  162. hackagent/models/user_profile_request.py +99 -0
  163. hackagent/router/__init__.py +25 -0
  164. hackagent/router/adapters/__init__.py +20 -0
  165. hackagent/router/adapters/base.py +63 -0
  166. hackagent/router/adapters/google_adk.py +671 -0
  167. hackagent/router/adapters/litellm_adapter.py +524 -0
  168. hackagent/router/adapters/openai_adapter.py +426 -0
  169. hackagent/router/router.py +969 -0
  170. hackagent/router/types.py +54 -0
  171. hackagent/tracking/__init__.py +42 -0
  172. hackagent/tracking/context.py +163 -0
  173. hackagent/tracking/decorators.py +299 -0
  174. hackagent/tracking/tracker.py +441 -0
  175. hackagent/types.py +54 -0
  176. hackagent/utils.py +194 -0
  177. hackagent/vulnerabilities/__init__.py +13 -0
  178. hackagent/vulnerabilities/prompts.py +81 -0
  179. hackagent-0.3.1.dist-info/METADATA +122 -0
  180. hackagent-0.3.1.dist-info/RECORD +183 -0
  181. hackagent-0.3.1.dist-info/WHEEL +4 -0
  182. hackagent-0.3.1.dist-info/entry_points.txt +2 -0
  183. hackagent-0.3.1.dist-info/licenses/LICENSE +202 -0
@@ -0,0 +1,163 @@
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.organization import Organization
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"/organization/{id}",
19
+ }
20
+
21
+ return _kwargs
22
+
23
+
24
+ def _parse_response(
25
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
26
+ ) -> Optional[Organization]:
27
+ if response.status_code == 200:
28
+ response_200 = Organization.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[Organization]:
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[Organization]:
53
+ """Provides access to Organization details for the authenticated user.
54
+
55
+ Web-only endpoint - requires Auth0 authentication.
56
+ Organization management and billing operations require browser context.
57
+
58
+ Args:
59
+ id (UUID):
60
+
61
+ Raises:
62
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
63
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
64
+
65
+ Returns:
66
+ Response[Organization]
67
+ """
68
+
69
+ kwargs = _get_kwargs(
70
+ id=id,
71
+ )
72
+
73
+ response = client.get_httpx_client().request(
74
+ **kwargs,
75
+ )
76
+
77
+ return _build_response(client=client, response=response)
78
+
79
+
80
+ def sync(
81
+ id: UUID,
82
+ *,
83
+ client: AuthenticatedClient,
84
+ ) -> Optional[Organization]:
85
+ """Provides access to Organization details for the authenticated user.
86
+
87
+ Web-only endpoint - requires Auth0 authentication.
88
+ Organization management and billing operations require browser context.
89
+
90
+ Args:
91
+ id (UUID):
92
+
93
+ Raises:
94
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
95
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
96
+
97
+ Returns:
98
+ Organization
99
+ """
100
+
101
+ return sync_detailed(
102
+ id=id,
103
+ client=client,
104
+ ).parsed
105
+
106
+
107
+ async def asyncio_detailed(
108
+ id: UUID,
109
+ *,
110
+ client: AuthenticatedClient,
111
+ ) -> Response[Organization]:
112
+ """Provides access to Organization details for the authenticated user.
113
+
114
+ Web-only endpoint - requires Auth0 authentication.
115
+ Organization management and billing operations require browser context.
116
+
117
+ Args:
118
+ id (UUID):
119
+
120
+ Raises:
121
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
122
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
123
+
124
+ Returns:
125
+ Response[Organization]
126
+ """
127
+
128
+ kwargs = _get_kwargs(
129
+ id=id,
130
+ )
131
+
132
+ response = await client.get_async_httpx_client().request(**kwargs)
133
+
134
+ return _build_response(client=client, response=response)
135
+
136
+
137
+ async def asyncio(
138
+ id: UUID,
139
+ *,
140
+ client: AuthenticatedClient,
141
+ ) -> Optional[Organization]:
142
+ """Provides access to Organization details for the authenticated user.
143
+
144
+ Web-only endpoint - requires Auth0 authentication.
145
+ Organization management and billing operations require browser context.
146
+
147
+ Args:
148
+ id (UUID):
149
+
150
+ Raises:
151
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
152
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
153
+
154
+ Returns:
155
+ Organization
156
+ """
157
+
158
+ return (
159
+ await asyncio_detailed(
160
+ id=id,
161
+ client=client,
162
+ )
163
+ ).parsed
@@ -0,0 +1,222 @@
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.organization import Organization
10
+ from ...models.organization_request import OrganizationRequest
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ id: UUID,
16
+ *,
17
+ body: Union[
18
+ OrganizationRequest,
19
+ OrganizationRequest,
20
+ OrganizationRequest,
21
+ ],
22
+ ) -> dict[str, Any]:
23
+ headers: dict[str, Any] = {}
24
+
25
+ _kwargs: dict[str, Any] = {
26
+ "method": "put",
27
+ "url": f"/organization/{id}",
28
+ }
29
+
30
+ if isinstance(body, OrganizationRequest):
31
+ _kwargs["json"] = body.to_dict()
32
+
33
+ headers["Content-Type"] = "application/json"
34
+ if isinstance(body, OrganizationRequest):
35
+ _kwargs["data"] = body.to_dict()
36
+
37
+ headers["Content-Type"] = "application/x-www-form-urlencoded"
38
+ if isinstance(body, OrganizationRequest):
39
+ _kwargs["files"] = body.to_multipart()
40
+
41
+ headers["Content-Type"] = "multipart/form-data"
42
+
43
+ _kwargs["headers"] = headers
44
+ return _kwargs
45
+
46
+
47
+ def _parse_response(
48
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
49
+ ) -> Optional[Organization]:
50
+ if response.status_code == 200:
51
+ response_200 = Organization.from_dict(response.json())
52
+
53
+ return response_200
54
+ if client.raise_on_unexpected_status:
55
+ raise errors.UnexpectedStatus(response.status_code, response.content)
56
+ else:
57
+ return None
58
+
59
+
60
+ def _build_response(
61
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
62
+ ) -> Response[Organization]:
63
+ return Response(
64
+ status_code=HTTPStatus(response.status_code),
65
+ content=response.content,
66
+ headers=response.headers,
67
+ parsed=_parse_response(client=client, response=response),
68
+ )
69
+
70
+
71
+ def sync_detailed(
72
+ id: UUID,
73
+ *,
74
+ client: AuthenticatedClient,
75
+ body: Union[
76
+ OrganizationRequest,
77
+ OrganizationRequest,
78
+ OrganizationRequest,
79
+ ],
80
+ ) -> Response[Organization]:
81
+ """Provides access to Organization details for the authenticated user.
82
+
83
+ Web-only endpoint - requires Auth0 authentication.
84
+ Organization management and billing operations require browser context.
85
+
86
+ Args:
87
+ id (UUID):
88
+ body (OrganizationRequest):
89
+ body (OrganizationRequest):
90
+ body (OrganizationRequest):
91
+
92
+ Raises:
93
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
94
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
95
+
96
+ Returns:
97
+ Response[Organization]
98
+ """
99
+
100
+ kwargs = _get_kwargs(
101
+ id=id,
102
+ body=body,
103
+ )
104
+
105
+ response = client.get_httpx_client().request(
106
+ **kwargs,
107
+ )
108
+
109
+ return _build_response(client=client, response=response)
110
+
111
+
112
+ def sync(
113
+ id: UUID,
114
+ *,
115
+ client: AuthenticatedClient,
116
+ body: Union[
117
+ OrganizationRequest,
118
+ OrganizationRequest,
119
+ OrganizationRequest,
120
+ ],
121
+ ) -> Optional[Organization]:
122
+ """Provides access to Organization details for the authenticated user.
123
+
124
+ Web-only endpoint - requires Auth0 authentication.
125
+ Organization management and billing operations require browser context.
126
+
127
+ Args:
128
+ id (UUID):
129
+ body (OrganizationRequest):
130
+ body (OrganizationRequest):
131
+ body (OrganizationRequest):
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
+ Organization
139
+ """
140
+
141
+ return sync_detailed(
142
+ id=id,
143
+ client=client,
144
+ body=body,
145
+ ).parsed
146
+
147
+
148
+ async def asyncio_detailed(
149
+ id: UUID,
150
+ *,
151
+ client: AuthenticatedClient,
152
+ body: Union[
153
+ OrganizationRequest,
154
+ OrganizationRequest,
155
+ OrganizationRequest,
156
+ ],
157
+ ) -> Response[Organization]:
158
+ """Provides access to Organization details for the authenticated user.
159
+
160
+ Web-only endpoint - requires Auth0 authentication.
161
+ Organization management and billing operations require browser context.
162
+
163
+ Args:
164
+ id (UUID):
165
+ body (OrganizationRequest):
166
+ body (OrganizationRequest):
167
+ body (OrganizationRequest):
168
+
169
+ Raises:
170
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
171
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
172
+
173
+ Returns:
174
+ Response[Organization]
175
+ """
176
+
177
+ kwargs = _get_kwargs(
178
+ id=id,
179
+ body=body,
180
+ )
181
+
182
+ response = await client.get_async_httpx_client().request(**kwargs)
183
+
184
+ return _build_response(client=client, response=response)
185
+
186
+
187
+ async def asyncio(
188
+ id: UUID,
189
+ *,
190
+ client: AuthenticatedClient,
191
+ body: Union[
192
+ OrganizationRequest,
193
+ OrganizationRequest,
194
+ OrganizationRequest,
195
+ ],
196
+ ) -> Optional[Organization]:
197
+ """Provides access to Organization details for the authenticated user.
198
+
199
+ Web-only endpoint - requires Auth0 authentication.
200
+ Organization management and billing operations require browser context.
201
+
202
+ Args:
203
+ id (UUID):
204
+ body (OrganizationRequest):
205
+ body (OrganizationRequest):
206
+ body (OrganizationRequest):
207
+
208
+ Raises:
209
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
210
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
211
+
212
+ Returns:
213
+ Organization
214
+ """
215
+
216
+ return (
217
+ await asyncio_detailed(
218
+ id=id,
219
+ client=client,
220
+ body=body,
221
+ )
222
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,171 @@
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.prompt import Prompt
9
+ from ...models.prompt_request import PromptRequest
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ body: PromptRequest,
16
+ ) -> dict[str, Any]:
17
+ headers: dict[str, Any] = {}
18
+
19
+ _kwargs: dict[str, Any] = {
20
+ "method": "post",
21
+ "url": "/prompt",
22
+ }
23
+
24
+ _kwargs["json"] = body.to_dict()
25
+
26
+ headers["Content-Type"] = "application/json"
27
+
28
+ _kwargs["headers"] = headers
29
+ return _kwargs
30
+
31
+
32
+ def _parse_response(
33
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
34
+ ) -> Optional[Prompt]:
35
+ if response.status_code == 201:
36
+ response_201 = Prompt.from_dict(response.json())
37
+
38
+ return response_201
39
+ if client.raise_on_unexpected_status:
40
+ raise errors.UnexpectedStatus(response.status_code, response.content)
41
+ else:
42
+ return None
43
+
44
+
45
+ def _build_response(
46
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
47
+ ) -> Response[Prompt]:
48
+ return Response(
49
+ status_code=HTTPStatus(response.status_code),
50
+ content=response.content,
51
+ headers=response.headers,
52
+ parsed=_parse_response(client=client, response=response),
53
+ )
54
+
55
+
56
+ def sync_detailed(
57
+ *,
58
+ client: AuthenticatedClient,
59
+ body: PromptRequest,
60
+ ) -> Response[Prompt]:
61
+ """ViewSet for managing Prompt instances.
62
+
63
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
64
+ Auth0 authentication is supported as fallback for web dashboard use.
65
+
66
+ Args:
67
+ body (PromptRequest): Serializer for the Prompt model.
68
+
69
+ Raises:
70
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
71
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
72
+
73
+ Returns:
74
+ Response[Prompt]
75
+ """
76
+
77
+ kwargs = _get_kwargs(
78
+ body=body,
79
+ )
80
+
81
+ response = client.get_httpx_client().request(
82
+ **kwargs,
83
+ )
84
+
85
+ return _build_response(client=client, response=response)
86
+
87
+
88
+ def sync(
89
+ *,
90
+ client: AuthenticatedClient,
91
+ body: PromptRequest,
92
+ ) -> Optional[Prompt]:
93
+ """ViewSet for managing Prompt instances.
94
+
95
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
96
+ Auth0 authentication is supported as fallback for web dashboard use.
97
+
98
+ Args:
99
+ body (PromptRequest): Serializer for the Prompt model.
100
+
101
+ Raises:
102
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
103
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
104
+
105
+ Returns:
106
+ Prompt
107
+ """
108
+
109
+ return sync_detailed(
110
+ client=client,
111
+ body=body,
112
+ ).parsed
113
+
114
+
115
+ async def asyncio_detailed(
116
+ *,
117
+ client: AuthenticatedClient,
118
+ body: PromptRequest,
119
+ ) -> Response[Prompt]:
120
+ """ViewSet for managing Prompt instances.
121
+
122
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
123
+ Auth0 authentication is supported as fallback for web dashboard use.
124
+
125
+ Args:
126
+ body (PromptRequest): Serializer for the Prompt model.
127
+
128
+ Raises:
129
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
130
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
131
+
132
+ Returns:
133
+ Response[Prompt]
134
+ """
135
+
136
+ kwargs = _get_kwargs(
137
+ body=body,
138
+ )
139
+
140
+ response = await client.get_async_httpx_client().request(**kwargs)
141
+
142
+ return _build_response(client=client, response=response)
143
+
144
+
145
+ async def asyncio(
146
+ *,
147
+ client: AuthenticatedClient,
148
+ body: PromptRequest,
149
+ ) -> Optional[Prompt]:
150
+ """ViewSet for managing Prompt instances.
151
+
152
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
153
+ Auth0 authentication is supported as fallback for web dashboard use.
154
+
155
+ Args:
156
+ body (PromptRequest): Serializer for the Prompt model.
157
+
158
+ Raises:
159
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
160
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
161
+
162
+ Returns:
163
+ Prompt
164
+ """
165
+
166
+ return (
167
+ await asyncio_detailed(
168
+ client=client,
169
+ body=body,
170
+ )
171
+ ).parsed
@@ -0,0 +1,104 @@
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 ...types import Response
10
+
11
+
12
+ def _get_kwargs(
13
+ id: UUID,
14
+ ) -> dict[str, Any]:
15
+ _kwargs: dict[str, Any] = {
16
+ "method": "delete",
17
+ "url": f"/prompt/{id}",
18
+ }
19
+
20
+ return _kwargs
21
+
22
+
23
+ def _parse_response(
24
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25
+ ) -> Optional[Any]:
26
+ if response.status_code == 204:
27
+ return None
28
+ if client.raise_on_unexpected_status:
29
+ raise errors.UnexpectedStatus(response.status_code, response.content)
30
+ else:
31
+ return None
32
+
33
+
34
+ def _build_response(
35
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
36
+ ) -> Response[Any]:
37
+ return Response(
38
+ status_code=HTTPStatus(response.status_code),
39
+ content=response.content,
40
+ headers=response.headers,
41
+ parsed=_parse_response(client=client, response=response),
42
+ )
43
+
44
+
45
+ def sync_detailed(
46
+ id: UUID,
47
+ *,
48
+ client: AuthenticatedClient,
49
+ ) -> Response[Any]:
50
+ """ViewSet for managing Prompt instances.
51
+
52
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
53
+ Auth0 authentication is supported as fallback for web dashboard use.
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[Any]
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
+ async def asyncio_detailed(
78
+ id: UUID,
79
+ *,
80
+ client: AuthenticatedClient,
81
+ ) -> Response[Any]:
82
+ """ViewSet for managing Prompt instances.
83
+
84
+ SDK-primary endpoint - API Key authentication is recommended for programmatic access.
85
+ Auth0 authentication is supported as fallback for web dashboard use.
86
+
87
+ Args:
88
+ id (UUID):
89
+
90
+ Raises:
91
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
92
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
93
+
94
+ Returns:
95
+ Response[Any]
96
+ """
97
+
98
+ kwargs = _get_kwargs(
99
+ id=id,
100
+ )
101
+
102
+ response = await client.get_async_httpx_client().request(**kwargs)
103
+
104
+ return _build_response(client=client, response=response)