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