asteroid-odyssey 0.1.22__py3-none-any.whl → 0.4.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.
- asteroid_odyssey/__init__.py +28 -34
- asteroid_odyssey/agents_v1_gen/__init__.py +87 -0
- asteroid_odyssey/agents_v1_gen/api/__init__.py +7 -0
- asteroid_odyssey/agents_v1_gen/api/agent_profile_api.py +1696 -0
- asteroid_odyssey/agents_v1_gen/api/api_api.py +516 -0
- asteroid_odyssey/agents_v1_gen/api/execution_api.py +1734 -0
- asteroid_odyssey/agents_v1_gen/api_client.py +801 -0
- asteroid_odyssey/agents_v1_gen/api_response.py +21 -0
- asteroid_odyssey/agents_v1_gen/configuration.py +606 -0
- asteroid_odyssey/agents_v1_gen/exceptions.py +216 -0
- asteroid_odyssey/agents_v1_gen/models/__init__.py +34 -0
- asteroid_odyssey/agents_v1_gen/models/agent_profile.py +118 -0
- asteroid_odyssey/agents_v1_gen/models/browser_session_recording_response.py +87 -0
- asteroid_odyssey/agents_v1_gen/models/country_code.py +44 -0
- asteroid_odyssey/agents_v1_gen/models/create_agent_profile_request.py +112 -0
- asteroid_odyssey/agents_v1_gen/models/credential.py +95 -0
- asteroid_odyssey/agents_v1_gen/models/delete_agent_profile200_response.py +87 -0
- asteroid_odyssey/agents_v1_gen/models/error_response.py +87 -0
- asteroid_odyssey/agents_v1_gen/models/execution_response.py +87 -0
- asteroid_odyssey/agents_v1_gen/models/execution_result.py +101 -0
- asteroid_odyssey/agents_v1_gen/models/execution_result_response.py +100 -0
- asteroid_odyssey/agents_v1_gen/models/execution_status_response.py +95 -0
- asteroid_odyssey/agents_v1_gen/models/health_check200_response.py +87 -0
- asteroid_odyssey/agents_v1_gen/models/health_check500_response.py +87 -0
- asteroid_odyssey/agents_v1_gen/models/proxy_type.py +37 -0
- asteroid_odyssey/agents_v1_gen/models/status.py +43 -0
- asteroid_odyssey/agents_v1_gen/models/structured_agent_execution_request.py +89 -0
- asteroid_odyssey/agents_v1_gen/models/update_agent_profile_request.py +112 -0
- asteroid_odyssey/agents_v1_gen/models/upload_execution_files200_response.py +89 -0
- asteroid_odyssey/agents_v1_gen/rest.py +258 -0
- asteroid_odyssey/agents_v2_gen/__init__.py +99 -0
- asteroid_odyssey/agents_v2_gen/api/__init__.py +5 -0
- asteroid_odyssey/agents_v2_gen/api/execution_api.py +625 -0
- asteroid_odyssey/agents_v2_gen/api_client.py +801 -0
- asteroid_odyssey/agents_v2_gen/api_response.py +21 -0
- asteroid_odyssey/agents_v2_gen/configuration.py +612 -0
- asteroid_odyssey/agents_v2_gen/exceptions.py +216 -0
- asteroid_odyssey/agents_v2_gen/models/__init__.py +42 -0
- asteroid_odyssey/agents_v2_gen/models/activity_payload_union_action_completed.py +100 -0
- asteroid_odyssey/agents_v2_gen/models/activity_payload_union_action_failed.py +100 -0
- asteroid_odyssey/agents_v2_gen/models/activity_payload_union_action_started.py +100 -0
- asteroid_odyssey/agents_v2_gen/models/activity_payload_union_generic.py +100 -0
- asteroid_odyssey/agents_v2_gen/models/activity_payload_union_status_changed.py +100 -0
- asteroid_odyssey/agents_v2_gen/models/activity_payload_union_step_completed.py +100 -0
- asteroid_odyssey/agents_v2_gen/models/activity_payload_union_step_started.py +100 -0
- asteroid_odyssey/agents_v2_gen/models/activity_payload_union_terminal.py +100 -0
- asteroid_odyssey/agents_v2_gen/models/activity_payload_union_transitioned_node.py +100 -0
- asteroid_odyssey/agents_v2_gen/models/activity_payload_union_user_message_received.py +100 -0
- asteroid_odyssey/agents_v2_gen/models/error.py +89 -0
- asteroid_odyssey/agents_v2_gen/models/execution_activity.py +98 -0
- asteroid_odyssey/agents_v2_gen/models/execution_activity_action_completed_payload.py +87 -0
- asteroid_odyssey/agents_v2_gen/models/execution_activity_action_failed_payload.py +87 -0
- asteroid_odyssey/agents_v2_gen/models/execution_activity_action_started_payload.py +87 -0
- asteroid_odyssey/agents_v2_gen/models/execution_activity_generic_payload.py +87 -0
- asteroid_odyssey/agents_v2_gen/models/execution_activity_payload_union.py +252 -0
- asteroid_odyssey/agents_v2_gen/models/execution_activity_status_changed_payload.py +88 -0
- asteroid_odyssey/agents_v2_gen/models/execution_activity_step_completed_payload.py +87 -0
- asteroid_odyssey/agents_v2_gen/models/execution_activity_step_started_payload.py +87 -0
- asteroid_odyssey/agents_v2_gen/models/execution_activity_transitioned_node_payload.py +89 -0
- asteroid_odyssey/agents_v2_gen/models/execution_activity_user_message_received_payload.py +89 -0
- asteroid_odyssey/agents_v2_gen/models/execution_status.py +43 -0
- asteroid_odyssey/agents_v2_gen/models/execution_terminal_payload.py +96 -0
- asteroid_odyssey/agents_v2_gen/models/execution_user_messages_add_text_body.py +87 -0
- asteroid_odyssey/agents_v2_gen/models/versions.py +37 -0
- asteroid_odyssey/agents_v2_gen/rest.py +258 -0
- asteroid_odyssey/client.py +881 -304
- asteroid_odyssey-0.4.0.dist-info/METADATA +213 -0
- asteroid_odyssey-0.4.0.dist-info/RECORD +72 -0
- {asteroid_odyssey-0.1.22.dist-info → asteroid_odyssey-0.4.0.dist-info}/WHEEL +1 -1
- asteroid_odyssey/api/generated/asteroid_agents_api_client/__init__.py +0 -8
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/__init__.py +0 -1
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/agent/get_agents.py +0 -127
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/api/get_open_api.py +0 -79
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/api/health_check.py +0 -131
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/credentials/__init__.py +0 -0
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/credentials/get_credentials_public_key.py +0 -127
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/__init__.py +0 -0
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/delete_execution.py +0 -156
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/get_browser_session.py +0 -154
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/get_execution.py +0 -154
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/get_execution_files.py +0 -159
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/get_execution_progress.py +0 -159
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/get_executions_for_workflow.py +0 -156
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/update_execution_status.py +0 -115
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/notifications/__init__.py +0 -0
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/notifications/set_slack_channel.py +0 -107
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/optimiser/__init__.py +0 -0
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/optimiser/queue_optimisation_job.py +0 -103
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/__init__.py +0 -0
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/add_workflow_credential.py +0 -111
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/create_workflow.py +0 -174
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/delete_workflow.py +0 -156
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/delete_workflow_credentials.py +0 -96
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/execute_workflow.py +0 -179
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/get_agent_workflow_executions.py +0 -155
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/get_workflow.py +0 -154
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/get_workflow_credentials.py +0 -154
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/get_workflow_versions.py +0 -159
- asteroid_odyssey/api/generated/asteroid_agents_api_client/client.py +0 -268
- asteroid_odyssey/api/generated/asteroid_agents_api_client/errors.py +0 -16
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/__init__.py +0 -61
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/agent.py +0 -90
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/browser_session.py +0 -136
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/create_workflow_request.py +0 -126
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/create_workflow_request_fields.py +0 -48
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/create_workflow_request_provider.py +0 -9
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/credential.py +0 -66
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/credentials_request.py +0 -72
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/credentials_response.py +0 -80
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/delete_execution_response_200.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/delete_execution_response_404.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/delete_workflow_response_200.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/delete_workflow_response_404.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/execution.py +0 -147
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/execution_dynamic_data.py +0 -48
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/execution_result.py +0 -43
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/execution_status.py +0 -89
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/file.py +0 -127
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/health_check_response_200.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/health_check_response_500.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/optimisation_request.py +0 -59
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/progress_update.py +0 -77
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/result_schema.py +0 -51
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/slack_channel_request.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/status.py +0 -13
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/workflow.py +0 -152
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/workflow_execution.py +0 -82
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/workflow_execution_request.py +0 -48
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/workflow_fields.py +0 -48
- asteroid_odyssey/api/generated/asteroid_agents_api_client/py.typed +0 -1
- asteroid_odyssey/api/generated/asteroid_agents_api_client/types.py +0 -45
- asteroid_odyssey/exceptions.py +0 -15
- asteroid_odyssey-0.1.22.dist-info/METADATA +0 -31
- asteroid_odyssey-0.1.22.dist-info/RECORD +0 -72
- asteroid_odyssey-0.1.22.dist-info/entry_points.txt +0 -2
- /asteroid_odyssey/{api/generated/asteroid_agents_api_client/api/agent/__init__.py → agents_v1_gen/py.typed} +0 -0
- /asteroid_odyssey/{api/generated/asteroid_agents_api_client/api/api/__init__.py → agents_v2_gen/py.typed} +0 -0
- {asteroid_odyssey-0.1.22.dist-info → asteroid_odyssey-0.4.0.dist-info}/top_level.txt +0 -0
asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/get_workflow_versions.py
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
from http import HTTPStatus
|
|
2
|
-
from typing import Any, Dict, List, Optional, Union, cast
|
|
3
|
-
from uuid import UUID
|
|
4
|
-
|
|
5
|
-
import httpx
|
|
6
|
-
|
|
7
|
-
from ... import errors
|
|
8
|
-
from ...client import AuthenticatedClient, Client
|
|
9
|
-
from ...models.workflow import Workflow
|
|
10
|
-
from ...types import Response
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_kwargs(
|
|
14
|
-
workflow_id: UUID,
|
|
15
|
-
) -> Dict[str, Any]:
|
|
16
|
-
_kwargs: Dict[str, Any] = {
|
|
17
|
-
"method": "get",
|
|
18
|
-
"url": f"/workflow/{workflow_id}/versions",
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return _kwargs
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def _parse_response(
|
|
25
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
26
|
-
) -> Optional[Union[Any, List["Workflow"]]]:
|
|
27
|
-
if response.status_code == 200:
|
|
28
|
-
response_200 = []
|
|
29
|
-
_response_200 = response.json()
|
|
30
|
-
for response_200_item_data in _response_200:
|
|
31
|
-
response_200_item = Workflow.from_dict(response_200_item_data)
|
|
32
|
-
|
|
33
|
-
response_200.append(response_200_item)
|
|
34
|
-
|
|
35
|
-
return response_200
|
|
36
|
-
if response.status_code == 404:
|
|
37
|
-
response_404 = cast(Any, None)
|
|
38
|
-
return response_404
|
|
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[Union[Any, List["Workflow"]]]:
|
|
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
|
-
workflow_id: UUID,
|
|
58
|
-
*,
|
|
59
|
-
client: Union[AuthenticatedClient, Client],
|
|
60
|
-
) -> Response[Union[Any, List["Workflow"]]]:
|
|
61
|
-
"""Get all versions of a workflow
|
|
62
|
-
|
|
63
|
-
Args:
|
|
64
|
-
workflow_id (UUID):
|
|
65
|
-
|
|
66
|
-
Raises:
|
|
67
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
68
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
69
|
-
|
|
70
|
-
Returns:
|
|
71
|
-
Response[Union[Any, List['Workflow']]]
|
|
72
|
-
"""
|
|
73
|
-
|
|
74
|
-
kwargs = _get_kwargs(
|
|
75
|
-
workflow_id=workflow_id,
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
response = client.get_httpx_client().request(
|
|
79
|
-
**kwargs,
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
return _build_response(client=client, response=response)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def sync(
|
|
86
|
-
workflow_id: UUID,
|
|
87
|
-
*,
|
|
88
|
-
client: Union[AuthenticatedClient, Client],
|
|
89
|
-
) -> Optional[Union[Any, List["Workflow"]]]:
|
|
90
|
-
"""Get all versions of a workflow
|
|
91
|
-
|
|
92
|
-
Args:
|
|
93
|
-
workflow_id (UUID):
|
|
94
|
-
|
|
95
|
-
Raises:
|
|
96
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
97
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
98
|
-
|
|
99
|
-
Returns:
|
|
100
|
-
Union[Any, List['Workflow']]
|
|
101
|
-
"""
|
|
102
|
-
|
|
103
|
-
return sync_detailed(
|
|
104
|
-
workflow_id=workflow_id,
|
|
105
|
-
client=client,
|
|
106
|
-
).parsed
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
async def asyncio_detailed(
|
|
110
|
-
workflow_id: UUID,
|
|
111
|
-
*,
|
|
112
|
-
client: Union[AuthenticatedClient, Client],
|
|
113
|
-
) -> Response[Union[Any, List["Workflow"]]]:
|
|
114
|
-
"""Get all versions of a workflow
|
|
115
|
-
|
|
116
|
-
Args:
|
|
117
|
-
workflow_id (UUID):
|
|
118
|
-
|
|
119
|
-
Raises:
|
|
120
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
121
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
122
|
-
|
|
123
|
-
Returns:
|
|
124
|
-
Response[Union[Any, List['Workflow']]]
|
|
125
|
-
"""
|
|
126
|
-
|
|
127
|
-
kwargs = _get_kwargs(
|
|
128
|
-
workflow_id=workflow_id,
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
response = await client.get_async_httpx_client().request(**kwargs)
|
|
132
|
-
|
|
133
|
-
return _build_response(client=client, response=response)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
async def asyncio(
|
|
137
|
-
workflow_id: UUID,
|
|
138
|
-
*,
|
|
139
|
-
client: Union[AuthenticatedClient, Client],
|
|
140
|
-
) -> Optional[Union[Any, List["Workflow"]]]:
|
|
141
|
-
"""Get all versions of a workflow
|
|
142
|
-
|
|
143
|
-
Args:
|
|
144
|
-
workflow_id (UUID):
|
|
145
|
-
|
|
146
|
-
Raises:
|
|
147
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
148
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
149
|
-
|
|
150
|
-
Returns:
|
|
151
|
-
Union[Any, List['Workflow']]
|
|
152
|
-
"""
|
|
153
|
-
|
|
154
|
-
return (
|
|
155
|
-
await asyncio_detailed(
|
|
156
|
-
workflow_id=workflow_id,
|
|
157
|
-
client=client,
|
|
158
|
-
)
|
|
159
|
-
).parsed
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import ssl
|
|
2
|
-
from typing import Any, Dict, Optional, Union
|
|
3
|
-
|
|
4
|
-
import httpx
|
|
5
|
-
from attrs import define, evolve, field
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@define
|
|
9
|
-
class Client:
|
|
10
|
-
"""A class for keeping track of data related to the API
|
|
11
|
-
|
|
12
|
-
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
|
13
|
-
|
|
14
|
-
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
|
15
|
-
|
|
16
|
-
``cookies``: A dictionary of cookies to be sent with every request
|
|
17
|
-
|
|
18
|
-
``headers``: A dictionary of headers to be sent with every request
|
|
19
|
-
|
|
20
|
-
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
|
21
|
-
httpx.TimeoutException if this is exceeded.
|
|
22
|
-
|
|
23
|
-
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
|
24
|
-
but can be set to False for testing purposes.
|
|
25
|
-
|
|
26
|
-
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
|
27
|
-
|
|
28
|
-
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Attributes:
|
|
32
|
-
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
|
33
|
-
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
34
|
-
argument to the constructor.
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
38
|
-
_base_url: str = field(alias="base_url")
|
|
39
|
-
_cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
40
|
-
_headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
41
|
-
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
|
42
|
-
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
|
43
|
-
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
|
44
|
-
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
45
|
-
_client: Optional[httpx.Client] = field(default=None, init=False)
|
|
46
|
-
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
|
47
|
-
|
|
48
|
-
def with_headers(self, headers: Dict[str, str]) -> "Client":
|
|
49
|
-
"""Get a new client matching this one with additional headers"""
|
|
50
|
-
if self._client is not None:
|
|
51
|
-
self._client.headers.update(headers)
|
|
52
|
-
if self._async_client is not None:
|
|
53
|
-
self._async_client.headers.update(headers)
|
|
54
|
-
return evolve(self, headers={**self._headers, **headers})
|
|
55
|
-
|
|
56
|
-
def with_cookies(self, cookies: Dict[str, str]) -> "Client":
|
|
57
|
-
"""Get a new client matching this one with additional cookies"""
|
|
58
|
-
if self._client is not None:
|
|
59
|
-
self._client.cookies.update(cookies)
|
|
60
|
-
if self._async_client is not None:
|
|
61
|
-
self._async_client.cookies.update(cookies)
|
|
62
|
-
return evolve(self, cookies={**self._cookies, **cookies})
|
|
63
|
-
|
|
64
|
-
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
|
|
65
|
-
"""Get a new client matching this one with a new timeout (in seconds)"""
|
|
66
|
-
if self._client is not None:
|
|
67
|
-
self._client.timeout = timeout
|
|
68
|
-
if self._async_client is not None:
|
|
69
|
-
self._async_client.timeout = timeout
|
|
70
|
-
return evolve(self, timeout=timeout)
|
|
71
|
-
|
|
72
|
-
def set_httpx_client(self, client: httpx.Client) -> "Client":
|
|
73
|
-
"""Manually set the underlying httpx.Client
|
|
74
|
-
|
|
75
|
-
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
76
|
-
"""
|
|
77
|
-
self._client = client
|
|
78
|
-
return self
|
|
79
|
-
|
|
80
|
-
def get_httpx_client(self) -> httpx.Client:
|
|
81
|
-
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
82
|
-
if self._client is None:
|
|
83
|
-
self._client = httpx.Client(
|
|
84
|
-
base_url=self._base_url,
|
|
85
|
-
cookies=self._cookies,
|
|
86
|
-
headers=self._headers,
|
|
87
|
-
timeout=self._timeout,
|
|
88
|
-
verify=self._verify_ssl,
|
|
89
|
-
follow_redirects=self._follow_redirects,
|
|
90
|
-
**self._httpx_args,
|
|
91
|
-
)
|
|
92
|
-
return self._client
|
|
93
|
-
|
|
94
|
-
def __enter__(self) -> "Client":
|
|
95
|
-
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
|
96
|
-
self.get_httpx_client().__enter__()
|
|
97
|
-
return self
|
|
98
|
-
|
|
99
|
-
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
|
100
|
-
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
|
101
|
-
self.get_httpx_client().__exit__(*args, **kwargs)
|
|
102
|
-
|
|
103
|
-
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
|
|
104
|
-
"""Manually the underlying httpx.AsyncClient
|
|
105
|
-
|
|
106
|
-
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
107
|
-
"""
|
|
108
|
-
self._async_client = async_client
|
|
109
|
-
return self
|
|
110
|
-
|
|
111
|
-
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
112
|
-
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
113
|
-
if self._async_client is None:
|
|
114
|
-
self._async_client = httpx.AsyncClient(
|
|
115
|
-
base_url=self._base_url,
|
|
116
|
-
cookies=self._cookies,
|
|
117
|
-
headers=self._headers,
|
|
118
|
-
timeout=self._timeout,
|
|
119
|
-
verify=self._verify_ssl,
|
|
120
|
-
follow_redirects=self._follow_redirects,
|
|
121
|
-
**self._httpx_args,
|
|
122
|
-
)
|
|
123
|
-
return self._async_client
|
|
124
|
-
|
|
125
|
-
async def __aenter__(self) -> "Client":
|
|
126
|
-
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
|
127
|
-
await self.get_async_httpx_client().__aenter__()
|
|
128
|
-
return self
|
|
129
|
-
|
|
130
|
-
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
131
|
-
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
132
|
-
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
@define
|
|
136
|
-
class AuthenticatedClient:
|
|
137
|
-
"""A Client which has been authenticated for use on secured endpoints
|
|
138
|
-
|
|
139
|
-
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
|
140
|
-
|
|
141
|
-
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
|
142
|
-
|
|
143
|
-
``cookies``: A dictionary of cookies to be sent with every request
|
|
144
|
-
|
|
145
|
-
``headers``: A dictionary of headers to be sent with every request
|
|
146
|
-
|
|
147
|
-
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
|
148
|
-
httpx.TimeoutException if this is exceeded.
|
|
149
|
-
|
|
150
|
-
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
|
151
|
-
but can be set to False for testing purposes.
|
|
152
|
-
|
|
153
|
-
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
|
154
|
-
|
|
155
|
-
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
Attributes:
|
|
159
|
-
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
|
160
|
-
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
161
|
-
argument to the constructor.
|
|
162
|
-
token: The token to use for authentication
|
|
163
|
-
prefix: The prefix to use for the Authorization header
|
|
164
|
-
auth_header_name: The name of the Authorization header
|
|
165
|
-
"""
|
|
166
|
-
|
|
167
|
-
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
168
|
-
_base_url: str = field(alias="base_url")
|
|
169
|
-
_cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
170
|
-
_headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
171
|
-
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
|
172
|
-
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
|
173
|
-
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
|
174
|
-
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
175
|
-
_client: Optional[httpx.Client] = field(default=None, init=False)
|
|
176
|
-
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
|
177
|
-
|
|
178
|
-
token: str
|
|
179
|
-
prefix: str = "Bearer"
|
|
180
|
-
auth_header_name: str = "Authorization"
|
|
181
|
-
|
|
182
|
-
def with_headers(self, headers: Dict[str, str]) -> "AuthenticatedClient":
|
|
183
|
-
"""Get a new client matching this one with additional headers"""
|
|
184
|
-
if self._client is not None:
|
|
185
|
-
self._client.headers.update(headers)
|
|
186
|
-
if self._async_client is not None:
|
|
187
|
-
self._async_client.headers.update(headers)
|
|
188
|
-
return evolve(self, headers={**self._headers, **headers})
|
|
189
|
-
|
|
190
|
-
def with_cookies(self, cookies: Dict[str, str]) -> "AuthenticatedClient":
|
|
191
|
-
"""Get a new client matching this one with additional cookies"""
|
|
192
|
-
if self._client is not None:
|
|
193
|
-
self._client.cookies.update(cookies)
|
|
194
|
-
if self._async_client is not None:
|
|
195
|
-
self._async_client.cookies.update(cookies)
|
|
196
|
-
return evolve(self, cookies={**self._cookies, **cookies})
|
|
197
|
-
|
|
198
|
-
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
|
|
199
|
-
"""Get a new client matching this one with a new timeout (in seconds)"""
|
|
200
|
-
if self._client is not None:
|
|
201
|
-
self._client.timeout = timeout
|
|
202
|
-
if self._async_client is not None:
|
|
203
|
-
self._async_client.timeout = timeout
|
|
204
|
-
return evolve(self, timeout=timeout)
|
|
205
|
-
|
|
206
|
-
def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
|
|
207
|
-
"""Manually set the underlying httpx.Client
|
|
208
|
-
|
|
209
|
-
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
210
|
-
"""
|
|
211
|
-
self._client = client
|
|
212
|
-
return self
|
|
213
|
-
|
|
214
|
-
def get_httpx_client(self) -> httpx.Client:
|
|
215
|
-
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
216
|
-
if self._client is None:
|
|
217
|
-
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
|
218
|
-
self._client = httpx.Client(
|
|
219
|
-
base_url=self._base_url,
|
|
220
|
-
cookies=self._cookies,
|
|
221
|
-
headers=self._headers,
|
|
222
|
-
timeout=self._timeout,
|
|
223
|
-
verify=self._verify_ssl,
|
|
224
|
-
follow_redirects=self._follow_redirects,
|
|
225
|
-
**self._httpx_args,
|
|
226
|
-
)
|
|
227
|
-
return self._client
|
|
228
|
-
|
|
229
|
-
def __enter__(self) -> "AuthenticatedClient":
|
|
230
|
-
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
|
231
|
-
self.get_httpx_client().__enter__()
|
|
232
|
-
return self
|
|
233
|
-
|
|
234
|
-
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
|
235
|
-
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
|
236
|
-
self.get_httpx_client().__exit__(*args, **kwargs)
|
|
237
|
-
|
|
238
|
-
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
|
|
239
|
-
"""Manually the underlying httpx.AsyncClient
|
|
240
|
-
|
|
241
|
-
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
242
|
-
"""
|
|
243
|
-
self._async_client = async_client
|
|
244
|
-
return self
|
|
245
|
-
|
|
246
|
-
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
247
|
-
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
248
|
-
if self._async_client is None:
|
|
249
|
-
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
|
250
|
-
self._async_client = httpx.AsyncClient(
|
|
251
|
-
base_url=self._base_url,
|
|
252
|
-
cookies=self._cookies,
|
|
253
|
-
headers=self._headers,
|
|
254
|
-
timeout=self._timeout,
|
|
255
|
-
verify=self._verify_ssl,
|
|
256
|
-
follow_redirects=self._follow_redirects,
|
|
257
|
-
**self._httpx_args,
|
|
258
|
-
)
|
|
259
|
-
return self._async_client
|
|
260
|
-
|
|
261
|
-
async def __aenter__(self) -> "AuthenticatedClient":
|
|
262
|
-
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
|
263
|
-
await self.get_async_httpx_client().__aenter__()
|
|
264
|
-
return self
|
|
265
|
-
|
|
266
|
-
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
267
|
-
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
268
|
-
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"""Contains shared errors types that can be raised from API functions"""
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class UnexpectedStatus(Exception):
|
|
5
|
-
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
|
6
|
-
|
|
7
|
-
def __init__(self, status_code: int, content: bytes):
|
|
8
|
-
self.status_code = status_code
|
|
9
|
-
self.content = content
|
|
10
|
-
|
|
11
|
-
super().__init__(
|
|
12
|
-
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
__all__ = ["UnexpectedStatus"]
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"""Contains all the data models used in inputs/outputs"""
|
|
2
|
-
|
|
3
|
-
from .agent import Agent
|
|
4
|
-
from .browser_session import BrowserSession
|
|
5
|
-
from .create_workflow_request import CreateWorkflowRequest
|
|
6
|
-
from .create_workflow_request_fields import CreateWorkflowRequestFields
|
|
7
|
-
from .create_workflow_request_provider import CreateWorkflowRequestProvider
|
|
8
|
-
from .credential import Credential
|
|
9
|
-
from .credentials_request import CredentialsRequest
|
|
10
|
-
from .credentials_response import CredentialsResponse
|
|
11
|
-
from .delete_execution_response_200 import DeleteExecutionResponse200
|
|
12
|
-
from .delete_execution_response_404 import DeleteExecutionResponse404
|
|
13
|
-
from .delete_workflow_response_200 import DeleteWorkflowResponse200
|
|
14
|
-
from .delete_workflow_response_404 import DeleteWorkflowResponse404
|
|
15
|
-
from .execution import Execution
|
|
16
|
-
from .execution_dynamic_data import ExecutionDynamicData
|
|
17
|
-
from .execution_result import ExecutionResult
|
|
18
|
-
from .execution_status import ExecutionStatus
|
|
19
|
-
from .file import File
|
|
20
|
-
from .health_check_response_200 import HealthCheckResponse200
|
|
21
|
-
from .health_check_response_500 import HealthCheckResponse500
|
|
22
|
-
from .optimisation_request import OptimisationRequest
|
|
23
|
-
from .progress_update import ProgressUpdate
|
|
24
|
-
from .result_schema import ResultSchema
|
|
25
|
-
from .slack_channel_request import SlackChannelRequest
|
|
26
|
-
from .status import Status
|
|
27
|
-
from .workflow import Workflow
|
|
28
|
-
from .workflow_execution import WorkflowExecution
|
|
29
|
-
from .workflow_execution_request import WorkflowExecutionRequest
|
|
30
|
-
from .workflow_fields import WorkflowFields
|
|
31
|
-
|
|
32
|
-
__all__ = (
|
|
33
|
-
"Agent",
|
|
34
|
-
"BrowserSession",
|
|
35
|
-
"CreateWorkflowRequest",
|
|
36
|
-
"CreateWorkflowRequestFields",
|
|
37
|
-
"CreateWorkflowRequestProvider",
|
|
38
|
-
"Credential",
|
|
39
|
-
"CredentialsRequest",
|
|
40
|
-
"CredentialsResponse",
|
|
41
|
-
"DeleteExecutionResponse200",
|
|
42
|
-
"DeleteExecutionResponse404",
|
|
43
|
-
"DeleteWorkflowResponse200",
|
|
44
|
-
"DeleteWorkflowResponse404",
|
|
45
|
-
"Execution",
|
|
46
|
-
"ExecutionDynamicData",
|
|
47
|
-
"ExecutionResult",
|
|
48
|
-
"ExecutionStatus",
|
|
49
|
-
"File",
|
|
50
|
-
"HealthCheckResponse200",
|
|
51
|
-
"HealthCheckResponse500",
|
|
52
|
-
"OptimisationRequest",
|
|
53
|
-
"ProgressUpdate",
|
|
54
|
-
"ResultSchema",
|
|
55
|
-
"SlackChannelRequest",
|
|
56
|
-
"Status",
|
|
57
|
-
"Workflow",
|
|
58
|
-
"WorkflowExecution",
|
|
59
|
-
"WorkflowExecutionRequest",
|
|
60
|
-
"WorkflowFields",
|
|
61
|
-
)
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
from typing import Any, Dict, List, Type, TypeVar, cast
|
|
2
|
-
|
|
3
|
-
from attrs import define as _attrs_define
|
|
4
|
-
from attrs import field as _attrs_field
|
|
5
|
-
|
|
6
|
-
T = TypeVar("T", bound="Agent")
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@_attrs_define
|
|
10
|
-
class Agent:
|
|
11
|
-
"""
|
|
12
|
-
Attributes:
|
|
13
|
-
name (str): The name of the agent Example: my_agent.
|
|
14
|
-
description (str): The description of the agent Example: This agent is used to queue jobs.
|
|
15
|
-
visibility (str): The visibility of the agent Example: public.
|
|
16
|
-
required_fields (List[str]): The required fields for the agent Example: ['system_prompt_template'].
|
|
17
|
-
required_prompts (List[str]): The prompts for the agent Example: ['Hello {{.name}}, your model is {{.model}}'].
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
name: str
|
|
21
|
-
description: str
|
|
22
|
-
visibility: str
|
|
23
|
-
required_fields: List[str]
|
|
24
|
-
required_prompts: List[str]
|
|
25
|
-
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
26
|
-
|
|
27
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
28
|
-
name = self.name
|
|
29
|
-
|
|
30
|
-
description = self.description
|
|
31
|
-
|
|
32
|
-
visibility = self.visibility
|
|
33
|
-
|
|
34
|
-
required_fields = self.required_fields
|
|
35
|
-
|
|
36
|
-
required_prompts = self.required_prompts
|
|
37
|
-
|
|
38
|
-
field_dict: Dict[str, Any] = {}
|
|
39
|
-
field_dict.update(self.additional_properties)
|
|
40
|
-
field_dict.update(
|
|
41
|
-
{
|
|
42
|
-
"name": name,
|
|
43
|
-
"description": description,
|
|
44
|
-
"visibility": visibility,
|
|
45
|
-
"required_fields": required_fields,
|
|
46
|
-
"required_prompts": required_prompts,
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
return field_dict
|
|
51
|
-
|
|
52
|
-
@classmethod
|
|
53
|
-
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
|
54
|
-
d = src_dict.copy()
|
|
55
|
-
name = d.pop("name")
|
|
56
|
-
|
|
57
|
-
description = d.pop("description")
|
|
58
|
-
|
|
59
|
-
visibility = d.pop("visibility")
|
|
60
|
-
|
|
61
|
-
required_fields = cast(List[str], d.pop("required_fields"))
|
|
62
|
-
|
|
63
|
-
required_prompts = cast(List[str], d.pop("required_prompts"))
|
|
64
|
-
|
|
65
|
-
agent = cls(
|
|
66
|
-
name=name,
|
|
67
|
-
description=description,
|
|
68
|
-
visibility=visibility,
|
|
69
|
-
required_fields=required_fields,
|
|
70
|
-
required_prompts=required_prompts,
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
agent.additional_properties = d
|
|
74
|
-
return agent
|
|
75
|
-
|
|
76
|
-
@property
|
|
77
|
-
def additional_keys(self) -> List[str]:
|
|
78
|
-
return list(self.additional_properties.keys())
|
|
79
|
-
|
|
80
|
-
def __getitem__(self, key: str) -> Any:
|
|
81
|
-
return self.additional_properties[key]
|
|
82
|
-
|
|
83
|
-
def __setitem__(self, key: str, value: Any) -> None:
|
|
84
|
-
self.additional_properties[key] = value
|
|
85
|
-
|
|
86
|
-
def __delitem__(self, key: str) -> None:
|
|
87
|
-
del self.additional_properties[key]
|
|
88
|
-
|
|
89
|
-
def __contains__(self, key: str) -> bool:
|
|
90
|
-
return key in self.additional_properties
|