athena-intelligence 0.1.127__py3-none-any.whl → 0.1.185__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.
- athena/__init__.py +24 -3
- athena/agents/__init__.py +2 -0
- athena/agents/client.py +51 -95
- athena/agents/drive/__init__.py +2 -0
- athena/agents/drive/client.py +31 -80
- athena/agents/drive/raw_client.py +155 -0
- athena/agents/general/__init__.py +2 -0
- athena/agents/general/client.py +91 -238
- athena/agents/general/raw_client.py +369 -0
- athena/agents/raw_client.py +176 -0
- athena/agents/research/__init__.py +2 -0
- athena/agents/research/client.py +31 -80
- athena/agents/research/raw_client.py +155 -0
- athena/agents/sql/__init__.py +2 -0
- athena/agents/sql/client.py +31 -80
- athena/agents/sql/raw_client.py +155 -0
- athena/assets/__init__.py +4 -0
- athena/assets/client.py +144 -0
- athena/assets/raw_client.py +164 -0
- athena/base_client.py +25 -11
- athena/client.py +1 -1
- athena/core/__init__.py +5 -0
- athena/core/api_error.py +13 -5
- athena/core/client_wrapper.py +33 -8
- athena/core/force_multipart.py +16 -0
- athena/core/http_client.py +70 -26
- athena/core/http_response.py +55 -0
- athena/core/jsonable_encoder.py +0 -1
- athena/core/pydantic_utilities.py +70 -111
- athena/core/serialization.py +7 -3
- athena/errors/__init__.py +2 -0
- athena/errors/bad_request_error.py +4 -2
- athena/errors/content_too_large_error.py +4 -2
- athena/errors/internal_server_error.py +4 -3
- athena/errors/not_found_error.py +4 -2
- athena/errors/unauthorized_error.py +4 -3
- athena/errors/unprocessable_entity_error.py +4 -3
- athena/errors/unsupported_media_type_error.py +4 -2
- athena/query/__init__.py +2 -0
- athena/query/client.py +39 -219
- athena/query/raw_client.py +344 -0
- athena/query/types/__init__.py +2 -0
- athena/tools/__init__.py +2 -0
- athena/tools/calendar/__init__.py +2 -0
- athena/tools/calendar/client.py +35 -79
- athena/tools/calendar/raw_client.py +172 -0
- athena/tools/client.py +114 -876
- athena/tools/email/__init__.py +2 -0
- athena/tools/email/client.py +39 -115
- athena/tools/email/raw_client.py +248 -0
- athena/tools/raw_client.py +1328 -0
- athena/tools/structured_data_extractor/__init__.py +2 -0
- athena/tools/structured_data_extractor/client.py +42 -96
- athena/tools/structured_data_extractor/raw_client.py +240 -0
- athena/tools/tasks/__init__.py +2 -0
- athena/tools/tasks/client.py +31 -43
- athena/tools/tasks/raw_client.py +96 -0
- athena/tools/types/__init__.py +2 -0
- athena/types/__init__.py +24 -2
- athena/types/asset_content_request_out.py +3 -3
- athena/types/asset_node.py +3 -3
- athena/types/asset_not_found_error.py +2 -2
- athena/types/asset_screenshot_response_out.py +4 -4
- athena/types/chunk.py +3 -3
- athena/types/chunk_content_item.py +3 -2
- athena/types/chunk_result.py +3 -3
- athena/types/content.py +7 -0
- athena/types/custom_agent_response.py +2 -2
- athena/types/data_frame_request_out.py +3 -3
- athena/types/data_frame_unknown_format_error.py +2 -2
- athena/types/document_chunk.py +2 -2
- athena/types/drive_agent_response.py +2 -2
- athena/types/file_chunk_request_out.py +3 -3
- athena/types/file_too_large_error.py +2 -2
- athena/types/folder_response.py +10 -4
- athena/types/general_agent_config.py +3 -3
- athena/types/general_agent_config_enabled_tools_item.py +1 -2
- athena/types/general_agent_request.py +15 -4
- athena/types/general_agent_response.py +4 -3
- athena/types/general_agent_response_message.py +100 -0
- athena/types/general_agent_response_message_kwargs.py +74 -0
- athena/types/{tool.py → id.py} +1 -1
- athena/types/image_url_content.py +2 -2
- athena/types/input_message.py +29 -0
- athena/types/input_message_content_item.py +39 -0
- athena/types/paginated_assets_out.py +52 -0
- athena/types/parent_folder_error.py +2 -2
- athena/types/prompt_message.py +3 -3
- athena/types/public_asset_out.py +97 -0
- athena/types/research_agent_response.py +2 -2
- athena/types/save_asset_request_out.py +2 -2
- athena/types/sql_agent_response.py +2 -2
- athena/types/structured_data_extractor_response.py +3 -3
- athena/types/text_content.py +2 -2
- athena/types/type.py +1 -1
- {athena_intelligence-0.1.127.dist-info → athena_intelligence-0.1.185.dist-info}/METADATA +3 -7
- athena_intelligence-0.1.185.dist-info/RECORD +112 -0
- {athena_intelligence-0.1.127.dist-info → athena_intelligence-0.1.185.dist-info}/WHEEL +1 -1
- athena_intelligence-0.1.127.dist-info/RECORD +0 -89
athena/__init__.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
|
+
# isort: skip_file
|
4
|
+
|
3
5
|
from .types import (
|
4
6
|
AssetContentRequestOut,
|
5
7
|
AssetNode,
|
@@ -11,6 +13,7 @@ from .types import (
|
|
11
13
|
ChunkContentItem_Text,
|
12
14
|
ChunkResult,
|
13
15
|
ChunkResultChunkId,
|
16
|
+
Content,
|
14
17
|
CustomAgentResponse,
|
15
18
|
DataFrameRequestOut,
|
16
19
|
DataFrameRequestOutColumnsItem,
|
@@ -26,15 +29,23 @@ from .types import (
|
|
26
29
|
GeneralAgentConfigEnabledToolsItem,
|
27
30
|
GeneralAgentRequest,
|
28
31
|
GeneralAgentResponse,
|
32
|
+
GeneralAgentResponseMessage,
|
33
|
+
GeneralAgentResponseMessageKwargs,
|
34
|
+
Id,
|
29
35
|
ImageUrlContent,
|
36
|
+
InputMessage,
|
37
|
+
InputMessageContentItem,
|
38
|
+
InputMessageContentItem_ImageUrl,
|
39
|
+
InputMessageContentItem_Text,
|
40
|
+
PaginatedAssetsOut,
|
30
41
|
ParentFolderError,
|
31
42
|
PromptMessage,
|
43
|
+
PublicAssetOut,
|
32
44
|
ResearchAgentResponse,
|
33
45
|
SaveAssetRequestOut,
|
34
46
|
SqlAgentResponse,
|
35
47
|
StructuredDataExtractorResponse,
|
36
48
|
TextContent,
|
37
|
-
Tool,
|
38
49
|
Type,
|
39
50
|
)
|
40
51
|
from .errors import (
|
@@ -46,7 +57,7 @@ from .errors import (
|
|
46
57
|
UnprocessableEntityError,
|
47
58
|
UnsupportedMediaTypeError,
|
48
59
|
)
|
49
|
-
from . import agents, query, tools
|
60
|
+
from . import agents, assets, query, tools
|
50
61
|
from .client import AsyncAthena, Athena
|
51
62
|
from .environment import AthenaEnvironment
|
52
63
|
from .query import QueryExecuteRequestDatabaseAssetIds
|
@@ -68,6 +79,7 @@ __all__ = [
|
|
68
79
|
"ChunkContentItem_Text",
|
69
80
|
"ChunkResult",
|
70
81
|
"ChunkResultChunkId",
|
82
|
+
"Content",
|
71
83
|
"ContentTooLargeError",
|
72
84
|
"CustomAgentResponse",
|
73
85
|
"DataFrameRequestOut",
|
@@ -84,18 +96,26 @@ __all__ = [
|
|
84
96
|
"GeneralAgentConfigEnabledToolsItem",
|
85
97
|
"GeneralAgentRequest",
|
86
98
|
"GeneralAgentResponse",
|
99
|
+
"GeneralAgentResponseMessage",
|
100
|
+
"GeneralAgentResponseMessageKwargs",
|
101
|
+
"Id",
|
87
102
|
"ImageUrlContent",
|
103
|
+
"InputMessage",
|
104
|
+
"InputMessageContentItem",
|
105
|
+
"InputMessageContentItem_ImageUrl",
|
106
|
+
"InputMessageContentItem_Text",
|
88
107
|
"InternalServerError",
|
89
108
|
"NotFoundError",
|
109
|
+
"PaginatedAssetsOut",
|
90
110
|
"ParentFolderError",
|
91
111
|
"PromptMessage",
|
112
|
+
"PublicAssetOut",
|
92
113
|
"QueryExecuteRequestDatabaseAssetIds",
|
93
114
|
"ResearchAgentResponse",
|
94
115
|
"SaveAssetRequestOut",
|
95
116
|
"SqlAgentResponse",
|
96
117
|
"StructuredDataExtractorResponse",
|
97
118
|
"TextContent",
|
98
|
-
"Tool",
|
99
119
|
"ToolsDataFrameRequestColumnsItem",
|
100
120
|
"Type",
|
101
121
|
"UnauthorizedError",
|
@@ -103,6 +123,7 @@ __all__ = [
|
|
103
123
|
"UnsupportedMediaTypeError",
|
104
124
|
"__version__",
|
105
125
|
"agents",
|
126
|
+
"assets",
|
106
127
|
"query",
|
107
128
|
"tools",
|
108
129
|
]
|
athena/agents/__init__.py
CHANGED
athena/agents/client.py
CHANGED
@@ -1,23 +1,15 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
3
|
import typing
|
4
|
-
|
5
|
-
from .
|
6
|
-
from .general.client import GeneralClient
|
7
|
-
from .research.client import ResearchClient
|
8
|
-
from .sql.client import SqlClient
|
4
|
+
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
6
|
from ..core.request_options import RequestOptions
|
10
7
|
from ..types.custom_agent_response import CustomAgentResponse
|
11
|
-
from
|
12
|
-
from
|
13
|
-
from
|
14
|
-
from
|
15
|
-
from
|
16
|
-
from ..core.client_wrapper import AsyncClientWrapper
|
17
|
-
from .drive.client import AsyncDriveClient
|
18
|
-
from .general.client import AsyncGeneralClient
|
19
|
-
from .research.client import AsyncResearchClient
|
20
|
-
from .sql.client import AsyncSqlClient
|
8
|
+
from .drive.client import AsyncDriveClient, DriveClient
|
9
|
+
from .general.client import AsyncGeneralClient, GeneralClient
|
10
|
+
from .raw_client import AsyncRawAgentsClient, RawAgentsClient
|
11
|
+
from .research.client import AsyncResearchClient, ResearchClient
|
12
|
+
from .sql.client import AsyncSqlClient, SqlClient
|
21
13
|
|
22
14
|
# this is used as the default value for optional parameters
|
23
15
|
OMIT = typing.cast(typing.Any, ...)
|
@@ -25,11 +17,25 @@ OMIT = typing.cast(typing.Any, ...)
|
|
25
17
|
|
26
18
|
class AgentsClient:
|
27
19
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
28
|
-
self.
|
29
|
-
self.drive = DriveClient(client_wrapper=
|
30
|
-
|
31
|
-
self.
|
32
|
-
|
20
|
+
self._raw_client = RawAgentsClient(client_wrapper=client_wrapper)
|
21
|
+
self.drive = DriveClient(client_wrapper=client_wrapper)
|
22
|
+
|
23
|
+
self.general = GeneralClient(client_wrapper=client_wrapper)
|
24
|
+
|
25
|
+
self.research = ResearchClient(client_wrapper=client_wrapper)
|
26
|
+
|
27
|
+
self.sql = SqlClient(client_wrapper=client_wrapper)
|
28
|
+
|
29
|
+
@property
|
30
|
+
def with_raw_response(self) -> RawAgentsClient:
|
31
|
+
"""
|
32
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
33
|
+
|
34
|
+
Returns
|
35
|
+
-------
|
36
|
+
RawAgentsClient
|
37
|
+
"""
|
38
|
+
return self._raw_client
|
33
39
|
|
34
40
|
def invoke_by_id(
|
35
41
|
self,
|
@@ -80,51 +86,33 @@ class AgentsClient:
|
|
80
86
|
messages=[{"key": "value"}],
|
81
87
|
)
|
82
88
|
"""
|
83
|
-
_response = self.
|
84
|
-
|
85
|
-
method="POST",
|
86
|
-
json={
|
87
|
-
"config": config,
|
88
|
-
"messages": messages,
|
89
|
-
},
|
90
|
-
headers={
|
91
|
-
"content-type": "application/json",
|
92
|
-
},
|
93
|
-
request_options=request_options,
|
94
|
-
omit=OMIT,
|
89
|
+
_response = self._raw_client.invoke_by_id(
|
90
|
+
agent_id, config=config, messages=messages, request_options=request_options
|
95
91
|
)
|
96
|
-
|
97
|
-
if 200 <= _response.status_code < 300:
|
98
|
-
return typing.cast(
|
99
|
-
CustomAgentResponse,
|
100
|
-
parse_obj_as(
|
101
|
-
type_=CustomAgentResponse, # type: ignore
|
102
|
-
object_=_response.json(),
|
103
|
-
),
|
104
|
-
)
|
105
|
-
if _response.status_code == 422:
|
106
|
-
raise UnprocessableEntityError(
|
107
|
-
typing.cast(
|
108
|
-
typing.Optional[typing.Any],
|
109
|
-
parse_obj_as(
|
110
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
111
|
-
object_=_response.json(),
|
112
|
-
),
|
113
|
-
)
|
114
|
-
)
|
115
|
-
_response_json = _response.json()
|
116
|
-
except JSONDecodeError:
|
117
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
118
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
92
|
+
return _response.data
|
119
93
|
|
120
94
|
|
121
95
|
class AsyncAgentsClient:
|
122
96
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
123
|
-
self.
|
124
|
-
self.drive = AsyncDriveClient(client_wrapper=
|
125
|
-
|
126
|
-
self.
|
127
|
-
|
97
|
+
self._raw_client = AsyncRawAgentsClient(client_wrapper=client_wrapper)
|
98
|
+
self.drive = AsyncDriveClient(client_wrapper=client_wrapper)
|
99
|
+
|
100
|
+
self.general = AsyncGeneralClient(client_wrapper=client_wrapper)
|
101
|
+
|
102
|
+
self.research = AsyncResearchClient(client_wrapper=client_wrapper)
|
103
|
+
|
104
|
+
self.sql = AsyncSqlClient(client_wrapper=client_wrapper)
|
105
|
+
|
106
|
+
@property
|
107
|
+
def with_raw_response(self) -> AsyncRawAgentsClient:
|
108
|
+
"""
|
109
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
110
|
+
|
111
|
+
Returns
|
112
|
+
-------
|
113
|
+
AsyncRawAgentsClient
|
114
|
+
"""
|
115
|
+
return self._raw_client
|
128
116
|
|
129
117
|
async def invoke_by_id(
|
130
118
|
self,
|
@@ -183,39 +171,7 @@ class AsyncAgentsClient:
|
|
183
171
|
|
184
172
|
asyncio.run(main())
|
185
173
|
"""
|
186
|
-
_response = await self.
|
187
|
-
|
188
|
-
method="POST",
|
189
|
-
json={
|
190
|
-
"config": config,
|
191
|
-
"messages": messages,
|
192
|
-
},
|
193
|
-
headers={
|
194
|
-
"content-type": "application/json",
|
195
|
-
},
|
196
|
-
request_options=request_options,
|
197
|
-
omit=OMIT,
|
174
|
+
_response = await self._raw_client.invoke_by_id(
|
175
|
+
agent_id, config=config, messages=messages, request_options=request_options
|
198
176
|
)
|
199
|
-
|
200
|
-
if 200 <= _response.status_code < 300:
|
201
|
-
return typing.cast(
|
202
|
-
CustomAgentResponse,
|
203
|
-
parse_obj_as(
|
204
|
-
type_=CustomAgentResponse, # type: ignore
|
205
|
-
object_=_response.json(),
|
206
|
-
),
|
207
|
-
)
|
208
|
-
if _response.status_code == 422:
|
209
|
-
raise UnprocessableEntityError(
|
210
|
-
typing.cast(
|
211
|
-
typing.Optional[typing.Any],
|
212
|
-
parse_obj_as(
|
213
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
214
|
-
object_=_response.json(),
|
215
|
-
),
|
216
|
-
)
|
217
|
-
)
|
218
|
-
_response_json = _response.json()
|
219
|
-
except JSONDecodeError:
|
220
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
221
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
177
|
+
return _response.data
|
athena/agents/drive/__init__.py
CHANGED
athena/agents/drive/client.py
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
3
|
import typing
|
4
|
-
|
4
|
+
|
5
|
+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
5
6
|
from ...core.request_options import RequestOptions
|
6
7
|
from ...types.drive_agent_response import DriveAgentResponse
|
7
|
-
from
|
8
|
-
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
9
|
-
from json.decoder import JSONDecodeError
|
10
|
-
from ...core.api_error import ApiError
|
11
|
-
from ...core.client_wrapper import AsyncClientWrapper
|
8
|
+
from .raw_client import AsyncRawDriveClient, RawDriveClient
|
12
9
|
|
13
10
|
# this is used as the default value for optional parameters
|
14
11
|
OMIT = typing.cast(typing.Any, ...)
|
@@ -16,7 +13,18 @@ OMIT = typing.cast(typing.Any, ...)
|
|
16
13
|
|
17
14
|
class DriveClient:
|
18
15
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
19
|
-
self.
|
16
|
+
self._raw_client = RawDriveClient(client_wrapper=client_wrapper)
|
17
|
+
|
18
|
+
@property
|
19
|
+
def with_raw_response(self) -> RawDriveClient:
|
20
|
+
"""
|
21
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
22
|
+
|
23
|
+
Returns
|
24
|
+
-------
|
25
|
+
RawDriveClient
|
26
|
+
"""
|
27
|
+
return self._raw_client
|
20
28
|
|
21
29
|
def invoke(
|
22
30
|
self,
|
@@ -56,47 +64,24 @@ class DriveClient:
|
|
56
64
|
messages=[{"key": "value"}],
|
57
65
|
)
|
58
66
|
"""
|
59
|
-
_response = self.
|
60
|
-
|
61
|
-
method="POST",
|
62
|
-
json={
|
63
|
-
"config": config,
|
64
|
-
"messages": messages,
|
65
|
-
},
|
66
|
-
headers={
|
67
|
-
"content-type": "application/json",
|
68
|
-
},
|
69
|
-
request_options=request_options,
|
70
|
-
omit=OMIT,
|
71
|
-
)
|
72
|
-
try:
|
73
|
-
if 200 <= _response.status_code < 300:
|
74
|
-
return typing.cast(
|
75
|
-
DriveAgentResponse,
|
76
|
-
parse_obj_as(
|
77
|
-
type_=DriveAgentResponse, # type: ignore
|
78
|
-
object_=_response.json(),
|
79
|
-
),
|
80
|
-
)
|
81
|
-
if _response.status_code == 422:
|
82
|
-
raise UnprocessableEntityError(
|
83
|
-
typing.cast(
|
84
|
-
typing.Optional[typing.Any],
|
85
|
-
parse_obj_as(
|
86
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
87
|
-
object_=_response.json(),
|
88
|
-
),
|
89
|
-
)
|
90
|
-
)
|
91
|
-
_response_json = _response.json()
|
92
|
-
except JSONDecodeError:
|
93
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
94
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
67
|
+
_response = self._raw_client.invoke(config=config, messages=messages, request_options=request_options)
|
68
|
+
return _response.data
|
95
69
|
|
96
70
|
|
97
71
|
class AsyncDriveClient:
|
98
72
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
99
|
-
self.
|
73
|
+
self._raw_client = AsyncRawDriveClient(client_wrapper=client_wrapper)
|
74
|
+
|
75
|
+
@property
|
76
|
+
def with_raw_response(self) -> AsyncRawDriveClient:
|
77
|
+
"""
|
78
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
79
|
+
|
80
|
+
Returns
|
81
|
+
-------
|
82
|
+
AsyncRawDriveClient
|
83
|
+
"""
|
84
|
+
return self._raw_client
|
100
85
|
|
101
86
|
async def invoke(
|
102
87
|
self,
|
@@ -144,39 +129,5 @@ class AsyncDriveClient:
|
|
144
129
|
|
145
130
|
asyncio.run(main())
|
146
131
|
"""
|
147
|
-
_response = await self.
|
148
|
-
|
149
|
-
method="POST",
|
150
|
-
json={
|
151
|
-
"config": config,
|
152
|
-
"messages": messages,
|
153
|
-
},
|
154
|
-
headers={
|
155
|
-
"content-type": "application/json",
|
156
|
-
},
|
157
|
-
request_options=request_options,
|
158
|
-
omit=OMIT,
|
159
|
-
)
|
160
|
-
try:
|
161
|
-
if 200 <= _response.status_code < 300:
|
162
|
-
return typing.cast(
|
163
|
-
DriveAgentResponse,
|
164
|
-
parse_obj_as(
|
165
|
-
type_=DriveAgentResponse, # type: ignore
|
166
|
-
object_=_response.json(),
|
167
|
-
),
|
168
|
-
)
|
169
|
-
if _response.status_code == 422:
|
170
|
-
raise UnprocessableEntityError(
|
171
|
-
typing.cast(
|
172
|
-
typing.Optional[typing.Any],
|
173
|
-
parse_obj_as(
|
174
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
175
|
-
object_=_response.json(),
|
176
|
-
),
|
177
|
-
)
|
178
|
-
)
|
179
|
-
_response_json = _response.json()
|
180
|
-
except JSONDecodeError:
|
181
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
182
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
132
|
+
_response = await self._raw_client.invoke(config=config, messages=messages, request_options=request_options)
|
133
|
+
return _response.data
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
from json.decoder import JSONDecodeError
|
5
|
+
|
6
|
+
from ...core.api_error import ApiError
|
7
|
+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
8
|
+
from ...core.http_response import AsyncHttpResponse, HttpResponse
|
9
|
+
from ...core.pydantic_utilities import parse_obj_as
|
10
|
+
from ...core.request_options import RequestOptions
|
11
|
+
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
12
|
+
from ...types.drive_agent_response import DriveAgentResponse
|
13
|
+
|
14
|
+
# this is used as the default value for optional parameters
|
15
|
+
OMIT = typing.cast(typing.Any, ...)
|
16
|
+
|
17
|
+
|
18
|
+
class RawDriveClient:
|
19
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
20
|
+
self._client_wrapper = client_wrapper
|
21
|
+
|
22
|
+
def invoke(
|
23
|
+
self,
|
24
|
+
*,
|
25
|
+
config: typing.Dict[str, typing.Optional[typing.Any]],
|
26
|
+
messages: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
27
|
+
request_options: typing.Optional[RequestOptions] = None,
|
28
|
+
) -> HttpResponse[DriveAgentResponse]:
|
29
|
+
"""
|
30
|
+
Coming soon! Manage folders and search for files in the internal drive.
|
31
|
+
|
32
|
+
Parameters
|
33
|
+
----------
|
34
|
+
config : typing.Dict[str, typing.Optional[typing.Any]]
|
35
|
+
Configuration for the drive agent including folder paths and search parameters
|
36
|
+
|
37
|
+
messages : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
38
|
+
The messages to send to the drive agent
|
39
|
+
|
40
|
+
request_options : typing.Optional[RequestOptions]
|
41
|
+
Request-specific configuration.
|
42
|
+
|
43
|
+
Returns
|
44
|
+
-------
|
45
|
+
HttpResponse[DriveAgentResponse]
|
46
|
+
Successful Response
|
47
|
+
"""
|
48
|
+
_response = self._client_wrapper.httpx_client.request(
|
49
|
+
"api/v0/agents/drive/invoke",
|
50
|
+
method="POST",
|
51
|
+
json={
|
52
|
+
"config": config,
|
53
|
+
"messages": messages,
|
54
|
+
},
|
55
|
+
headers={
|
56
|
+
"content-type": "application/json",
|
57
|
+
},
|
58
|
+
request_options=request_options,
|
59
|
+
omit=OMIT,
|
60
|
+
)
|
61
|
+
try:
|
62
|
+
if 200 <= _response.status_code < 300:
|
63
|
+
_data = typing.cast(
|
64
|
+
DriveAgentResponse,
|
65
|
+
parse_obj_as(
|
66
|
+
type_=DriveAgentResponse, # type: ignore
|
67
|
+
object_=_response.json(),
|
68
|
+
),
|
69
|
+
)
|
70
|
+
return HttpResponse(response=_response, data=_data)
|
71
|
+
if _response.status_code == 422:
|
72
|
+
raise UnprocessableEntityError(
|
73
|
+
headers=dict(_response.headers),
|
74
|
+
body=typing.cast(
|
75
|
+
typing.Optional[typing.Any],
|
76
|
+
parse_obj_as(
|
77
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
78
|
+
object_=_response.json(),
|
79
|
+
),
|
80
|
+
),
|
81
|
+
)
|
82
|
+
_response_json = _response.json()
|
83
|
+
except JSONDecodeError:
|
84
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
85
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
86
|
+
|
87
|
+
|
88
|
+
class AsyncRawDriveClient:
|
89
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
90
|
+
self._client_wrapper = client_wrapper
|
91
|
+
|
92
|
+
async def invoke(
|
93
|
+
self,
|
94
|
+
*,
|
95
|
+
config: typing.Dict[str, typing.Optional[typing.Any]],
|
96
|
+
messages: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
97
|
+
request_options: typing.Optional[RequestOptions] = None,
|
98
|
+
) -> AsyncHttpResponse[DriveAgentResponse]:
|
99
|
+
"""
|
100
|
+
Coming soon! Manage folders and search for files in the internal drive.
|
101
|
+
|
102
|
+
Parameters
|
103
|
+
----------
|
104
|
+
config : typing.Dict[str, typing.Optional[typing.Any]]
|
105
|
+
Configuration for the drive agent including folder paths and search parameters
|
106
|
+
|
107
|
+
messages : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
108
|
+
The messages to send to the drive agent
|
109
|
+
|
110
|
+
request_options : typing.Optional[RequestOptions]
|
111
|
+
Request-specific configuration.
|
112
|
+
|
113
|
+
Returns
|
114
|
+
-------
|
115
|
+
AsyncHttpResponse[DriveAgentResponse]
|
116
|
+
Successful Response
|
117
|
+
"""
|
118
|
+
_response = await self._client_wrapper.httpx_client.request(
|
119
|
+
"api/v0/agents/drive/invoke",
|
120
|
+
method="POST",
|
121
|
+
json={
|
122
|
+
"config": config,
|
123
|
+
"messages": messages,
|
124
|
+
},
|
125
|
+
headers={
|
126
|
+
"content-type": "application/json",
|
127
|
+
},
|
128
|
+
request_options=request_options,
|
129
|
+
omit=OMIT,
|
130
|
+
)
|
131
|
+
try:
|
132
|
+
if 200 <= _response.status_code < 300:
|
133
|
+
_data = typing.cast(
|
134
|
+
DriveAgentResponse,
|
135
|
+
parse_obj_as(
|
136
|
+
type_=DriveAgentResponse, # type: ignore
|
137
|
+
object_=_response.json(),
|
138
|
+
),
|
139
|
+
)
|
140
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
141
|
+
if _response.status_code == 422:
|
142
|
+
raise UnprocessableEntityError(
|
143
|
+
headers=dict(_response.headers),
|
144
|
+
body=typing.cast(
|
145
|
+
typing.Optional[typing.Any],
|
146
|
+
parse_obj_as(
|
147
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
148
|
+
object_=_response.json(),
|
149
|
+
),
|
150
|
+
),
|
151
|
+
)
|
152
|
+
_response_json = _response.json()
|
153
|
+
except JSONDecodeError:
|
154
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
155
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|