athena-intelligence 0.1.126__py3-none-any.whl → 0.1.184__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 +28 -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 +267 -653
- 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 +28 -2
- athena/types/asset_content_request_out.py +26 -0
- athena/types/asset_node.py +3 -3
- athena/types/asset_not_found_error.py +2 -2
- athena/types/asset_screenshot_response_out.py +43 -0
- 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 +4 -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.126.dist-info → athena_intelligence-0.1.184.dist-info}/METADATA +3 -7
- athena_intelligence-0.1.184.dist-info/RECORD +112 -0
- {athena_intelligence-0.1.126.dist-info → athena_intelligence-0.1.184.dist-info}/WHEEL +1 -1
- athena_intelligence-0.1.126.dist-info/RECORD +0 -87
@@ -0,0 +1,369 @@
|
|
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 ...core.serialization import convert_and_respect_annotation_metadata
|
12
|
+
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
13
|
+
from ...types.general_agent_request import GeneralAgentRequest
|
14
|
+
from ...types.general_agent_response import GeneralAgentResponse
|
15
|
+
|
16
|
+
# this is used as the default value for optional parameters
|
17
|
+
OMIT = typing.cast(typing.Any, ...)
|
18
|
+
|
19
|
+
|
20
|
+
class RawGeneralClient:
|
21
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
22
|
+
self._client_wrapper = client_wrapper
|
23
|
+
|
24
|
+
def batch(
|
25
|
+
self, *, request: typing.Sequence[GeneralAgentRequest], request_options: typing.Optional[RequestOptions] = None
|
26
|
+
) -> HttpResponse[typing.List[GeneralAgentResponse]]:
|
27
|
+
"""
|
28
|
+
Coming soon! Call the general agent with batched requests and return the results.
|
29
|
+
|
30
|
+
Parameters
|
31
|
+
----------
|
32
|
+
request : typing.Sequence[GeneralAgentRequest]
|
33
|
+
|
34
|
+
request_options : typing.Optional[RequestOptions]
|
35
|
+
Request-specific configuration.
|
36
|
+
|
37
|
+
Returns
|
38
|
+
-------
|
39
|
+
HttpResponse[typing.List[GeneralAgentResponse]]
|
40
|
+
Successful Response
|
41
|
+
"""
|
42
|
+
_response = self._client_wrapper.httpx_client.request(
|
43
|
+
"api/v0/agents/general/batch",
|
44
|
+
method="POST",
|
45
|
+
json=convert_and_respect_annotation_metadata(
|
46
|
+
object_=request, annotation=typing.Sequence[GeneralAgentRequest], direction="write"
|
47
|
+
),
|
48
|
+
headers={
|
49
|
+
"content-type": "application/json",
|
50
|
+
},
|
51
|
+
request_options=request_options,
|
52
|
+
omit=OMIT,
|
53
|
+
)
|
54
|
+
try:
|
55
|
+
if 200 <= _response.status_code < 300:
|
56
|
+
_data = typing.cast(
|
57
|
+
typing.List[GeneralAgentResponse],
|
58
|
+
parse_obj_as(
|
59
|
+
type_=typing.List[GeneralAgentResponse], # type: ignore
|
60
|
+
object_=_response.json(),
|
61
|
+
),
|
62
|
+
)
|
63
|
+
return HttpResponse(response=_response, data=_data)
|
64
|
+
if _response.status_code == 422:
|
65
|
+
raise UnprocessableEntityError(
|
66
|
+
headers=dict(_response.headers),
|
67
|
+
body=typing.cast(
|
68
|
+
typing.Optional[typing.Any],
|
69
|
+
parse_obj_as(
|
70
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
71
|
+
object_=_response.json(),
|
72
|
+
),
|
73
|
+
),
|
74
|
+
)
|
75
|
+
_response_json = _response.json()
|
76
|
+
except JSONDecodeError:
|
77
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
78
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
79
|
+
|
80
|
+
def invoke(
|
81
|
+
self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
|
82
|
+
) -> HttpResponse[GeneralAgentResponse]:
|
83
|
+
"""
|
84
|
+
Call the general Athena agent synchronously.
|
85
|
+
|
86
|
+
Call the agent with the messages list, wait for the agent to complete,
|
87
|
+
and return the result.
|
88
|
+
|
89
|
+
Parameters
|
90
|
+
----------
|
91
|
+
request : GeneralAgentRequest
|
92
|
+
|
93
|
+
request_options : typing.Optional[RequestOptions]
|
94
|
+
Request-specific configuration.
|
95
|
+
|
96
|
+
Returns
|
97
|
+
-------
|
98
|
+
HttpResponse[GeneralAgentResponse]
|
99
|
+
Successful Response
|
100
|
+
"""
|
101
|
+
_response = self._client_wrapper.httpx_client.request(
|
102
|
+
"api/v0/agents/general/invoke",
|
103
|
+
method="POST",
|
104
|
+
json=convert_and_respect_annotation_metadata(
|
105
|
+
object_=request, annotation=GeneralAgentRequest, direction="write"
|
106
|
+
),
|
107
|
+
headers={
|
108
|
+
"content-type": "application/json",
|
109
|
+
},
|
110
|
+
request_options=request_options,
|
111
|
+
omit=OMIT,
|
112
|
+
)
|
113
|
+
try:
|
114
|
+
if 200 <= _response.status_code < 300:
|
115
|
+
_data = typing.cast(
|
116
|
+
GeneralAgentResponse,
|
117
|
+
parse_obj_as(
|
118
|
+
type_=GeneralAgentResponse, # type: ignore
|
119
|
+
object_=_response.json(),
|
120
|
+
),
|
121
|
+
)
|
122
|
+
return HttpResponse(response=_response, data=_data)
|
123
|
+
if _response.status_code == 422:
|
124
|
+
raise UnprocessableEntityError(
|
125
|
+
headers=dict(_response.headers),
|
126
|
+
body=typing.cast(
|
127
|
+
typing.Optional[typing.Any],
|
128
|
+
parse_obj_as(
|
129
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
130
|
+
object_=_response.json(),
|
131
|
+
),
|
132
|
+
),
|
133
|
+
)
|
134
|
+
_response_json = _response.json()
|
135
|
+
except JSONDecodeError:
|
136
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
137
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
138
|
+
|
139
|
+
def stream_events(
|
140
|
+
self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
|
141
|
+
) -> HttpResponse[GeneralAgentResponse]:
|
142
|
+
"""
|
143
|
+
Coming soon! Call the general agent and stream events for real-time chat applications.
|
144
|
+
|
145
|
+
Parameters
|
146
|
+
----------
|
147
|
+
request : GeneralAgentRequest
|
148
|
+
|
149
|
+
request_options : typing.Optional[RequestOptions]
|
150
|
+
Request-specific configuration.
|
151
|
+
|
152
|
+
Returns
|
153
|
+
-------
|
154
|
+
HttpResponse[GeneralAgentResponse]
|
155
|
+
Successful Response
|
156
|
+
"""
|
157
|
+
_response = self._client_wrapper.httpx_client.request(
|
158
|
+
"api/v0/agents/general/stream_events",
|
159
|
+
method="POST",
|
160
|
+
json=convert_and_respect_annotation_metadata(
|
161
|
+
object_=request, annotation=GeneralAgentRequest, direction="write"
|
162
|
+
),
|
163
|
+
headers={
|
164
|
+
"content-type": "application/json",
|
165
|
+
},
|
166
|
+
request_options=request_options,
|
167
|
+
omit=OMIT,
|
168
|
+
)
|
169
|
+
try:
|
170
|
+
if 200 <= _response.status_code < 300:
|
171
|
+
_data = typing.cast(
|
172
|
+
GeneralAgentResponse,
|
173
|
+
parse_obj_as(
|
174
|
+
type_=GeneralAgentResponse, # type: ignore
|
175
|
+
object_=_response.json(),
|
176
|
+
),
|
177
|
+
)
|
178
|
+
return HttpResponse(response=_response, data=_data)
|
179
|
+
if _response.status_code == 422:
|
180
|
+
raise UnprocessableEntityError(
|
181
|
+
headers=dict(_response.headers),
|
182
|
+
body=typing.cast(
|
183
|
+
typing.Optional[typing.Any],
|
184
|
+
parse_obj_as(
|
185
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
186
|
+
object_=_response.json(),
|
187
|
+
),
|
188
|
+
),
|
189
|
+
)
|
190
|
+
_response_json = _response.json()
|
191
|
+
except JSONDecodeError:
|
192
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
193
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
194
|
+
|
195
|
+
|
196
|
+
class AsyncRawGeneralClient:
|
197
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
198
|
+
self._client_wrapper = client_wrapper
|
199
|
+
|
200
|
+
async def batch(
|
201
|
+
self, *, request: typing.Sequence[GeneralAgentRequest], request_options: typing.Optional[RequestOptions] = None
|
202
|
+
) -> AsyncHttpResponse[typing.List[GeneralAgentResponse]]:
|
203
|
+
"""
|
204
|
+
Coming soon! Call the general agent with batched requests and return the results.
|
205
|
+
|
206
|
+
Parameters
|
207
|
+
----------
|
208
|
+
request : typing.Sequence[GeneralAgentRequest]
|
209
|
+
|
210
|
+
request_options : typing.Optional[RequestOptions]
|
211
|
+
Request-specific configuration.
|
212
|
+
|
213
|
+
Returns
|
214
|
+
-------
|
215
|
+
AsyncHttpResponse[typing.List[GeneralAgentResponse]]
|
216
|
+
Successful Response
|
217
|
+
"""
|
218
|
+
_response = await self._client_wrapper.httpx_client.request(
|
219
|
+
"api/v0/agents/general/batch",
|
220
|
+
method="POST",
|
221
|
+
json=convert_and_respect_annotation_metadata(
|
222
|
+
object_=request, annotation=typing.Sequence[GeneralAgentRequest], direction="write"
|
223
|
+
),
|
224
|
+
headers={
|
225
|
+
"content-type": "application/json",
|
226
|
+
},
|
227
|
+
request_options=request_options,
|
228
|
+
omit=OMIT,
|
229
|
+
)
|
230
|
+
try:
|
231
|
+
if 200 <= _response.status_code < 300:
|
232
|
+
_data = typing.cast(
|
233
|
+
typing.List[GeneralAgentResponse],
|
234
|
+
parse_obj_as(
|
235
|
+
type_=typing.List[GeneralAgentResponse], # type: ignore
|
236
|
+
object_=_response.json(),
|
237
|
+
),
|
238
|
+
)
|
239
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
240
|
+
if _response.status_code == 422:
|
241
|
+
raise UnprocessableEntityError(
|
242
|
+
headers=dict(_response.headers),
|
243
|
+
body=typing.cast(
|
244
|
+
typing.Optional[typing.Any],
|
245
|
+
parse_obj_as(
|
246
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
247
|
+
object_=_response.json(),
|
248
|
+
),
|
249
|
+
),
|
250
|
+
)
|
251
|
+
_response_json = _response.json()
|
252
|
+
except JSONDecodeError:
|
253
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
254
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
255
|
+
|
256
|
+
async def invoke(
|
257
|
+
self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
|
258
|
+
) -> AsyncHttpResponse[GeneralAgentResponse]:
|
259
|
+
"""
|
260
|
+
Call the general Athena agent synchronously.
|
261
|
+
|
262
|
+
Call the agent with the messages list, wait for the agent to complete,
|
263
|
+
and return the result.
|
264
|
+
|
265
|
+
Parameters
|
266
|
+
----------
|
267
|
+
request : GeneralAgentRequest
|
268
|
+
|
269
|
+
request_options : typing.Optional[RequestOptions]
|
270
|
+
Request-specific configuration.
|
271
|
+
|
272
|
+
Returns
|
273
|
+
-------
|
274
|
+
AsyncHttpResponse[GeneralAgentResponse]
|
275
|
+
Successful Response
|
276
|
+
"""
|
277
|
+
_response = await self._client_wrapper.httpx_client.request(
|
278
|
+
"api/v0/agents/general/invoke",
|
279
|
+
method="POST",
|
280
|
+
json=convert_and_respect_annotation_metadata(
|
281
|
+
object_=request, annotation=GeneralAgentRequest, direction="write"
|
282
|
+
),
|
283
|
+
headers={
|
284
|
+
"content-type": "application/json",
|
285
|
+
},
|
286
|
+
request_options=request_options,
|
287
|
+
omit=OMIT,
|
288
|
+
)
|
289
|
+
try:
|
290
|
+
if 200 <= _response.status_code < 300:
|
291
|
+
_data = typing.cast(
|
292
|
+
GeneralAgentResponse,
|
293
|
+
parse_obj_as(
|
294
|
+
type_=GeneralAgentResponse, # type: ignore
|
295
|
+
object_=_response.json(),
|
296
|
+
),
|
297
|
+
)
|
298
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
299
|
+
if _response.status_code == 422:
|
300
|
+
raise UnprocessableEntityError(
|
301
|
+
headers=dict(_response.headers),
|
302
|
+
body=typing.cast(
|
303
|
+
typing.Optional[typing.Any],
|
304
|
+
parse_obj_as(
|
305
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
306
|
+
object_=_response.json(),
|
307
|
+
),
|
308
|
+
),
|
309
|
+
)
|
310
|
+
_response_json = _response.json()
|
311
|
+
except JSONDecodeError:
|
312
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
313
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
314
|
+
|
315
|
+
async def stream_events(
|
316
|
+
self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
|
317
|
+
) -> AsyncHttpResponse[GeneralAgentResponse]:
|
318
|
+
"""
|
319
|
+
Coming soon! Call the general agent and stream events for real-time chat applications.
|
320
|
+
|
321
|
+
Parameters
|
322
|
+
----------
|
323
|
+
request : GeneralAgentRequest
|
324
|
+
|
325
|
+
request_options : typing.Optional[RequestOptions]
|
326
|
+
Request-specific configuration.
|
327
|
+
|
328
|
+
Returns
|
329
|
+
-------
|
330
|
+
AsyncHttpResponse[GeneralAgentResponse]
|
331
|
+
Successful Response
|
332
|
+
"""
|
333
|
+
_response = await self._client_wrapper.httpx_client.request(
|
334
|
+
"api/v0/agents/general/stream_events",
|
335
|
+
method="POST",
|
336
|
+
json=convert_and_respect_annotation_metadata(
|
337
|
+
object_=request, annotation=GeneralAgentRequest, direction="write"
|
338
|
+
),
|
339
|
+
headers={
|
340
|
+
"content-type": "application/json",
|
341
|
+
},
|
342
|
+
request_options=request_options,
|
343
|
+
omit=OMIT,
|
344
|
+
)
|
345
|
+
try:
|
346
|
+
if 200 <= _response.status_code < 300:
|
347
|
+
_data = typing.cast(
|
348
|
+
GeneralAgentResponse,
|
349
|
+
parse_obj_as(
|
350
|
+
type_=GeneralAgentResponse, # type: ignore
|
351
|
+
object_=_response.json(),
|
352
|
+
),
|
353
|
+
)
|
354
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
355
|
+
if _response.status_code == 422:
|
356
|
+
raise UnprocessableEntityError(
|
357
|
+
headers=dict(_response.headers),
|
358
|
+
body=typing.cast(
|
359
|
+
typing.Optional[typing.Any],
|
360
|
+
parse_obj_as(
|
361
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
362
|
+
object_=_response.json(),
|
363
|
+
),
|
364
|
+
),
|
365
|
+
)
|
366
|
+
_response_json = _response.json()
|
367
|
+
except JSONDecodeError:
|
368
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
369
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
@@ -0,0 +1,176 @@
|
|
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.jsonable_encoder import jsonable_encoder
|
10
|
+
from ..core.pydantic_utilities import parse_obj_as
|
11
|
+
from ..core.request_options import RequestOptions
|
12
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
13
|
+
from ..types.custom_agent_response import CustomAgentResponse
|
14
|
+
|
15
|
+
# this is used as the default value for optional parameters
|
16
|
+
OMIT = typing.cast(typing.Any, ...)
|
17
|
+
|
18
|
+
|
19
|
+
class RawAgentsClient:
|
20
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
21
|
+
self._client_wrapper = client_wrapper
|
22
|
+
|
23
|
+
def invoke_by_id(
|
24
|
+
self,
|
25
|
+
agent_id: str,
|
26
|
+
*,
|
27
|
+
config: typing.Dict[str, typing.Optional[typing.Any]],
|
28
|
+
messages: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
29
|
+
request_options: typing.Optional[RequestOptions] = None,
|
30
|
+
) -> HttpResponse[CustomAgentResponse]:
|
31
|
+
"""
|
32
|
+
Coming soon!
|
33
|
+
|
34
|
+
Invoke a custom agent created in [spaces](https://resources.athenaintel.com/docs/agents/create-your-agent).
|
35
|
+
|
36
|
+
Custom agents can be created and configured in spaces to perform specialized tasks.
|
37
|
+
Refer to the specific agent's documentation for details on configuration options
|
38
|
+
and expected responses.
|
39
|
+
|
40
|
+
Parameters
|
41
|
+
----------
|
42
|
+
agent_id : str
|
43
|
+
The ID of the custom agent to invoke. Create custom agents in [spaces](https://resources.athenaintel.com/docs/agents/create-your-agent).
|
44
|
+
|
45
|
+
config : typing.Dict[str, typing.Optional[typing.Any]]
|
46
|
+
Configuration for the custom agent. See the agent's documentation for specific configuration options.
|
47
|
+
|
48
|
+
messages : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
49
|
+
The messages to send to the custom agent
|
50
|
+
|
51
|
+
request_options : typing.Optional[RequestOptions]
|
52
|
+
Request-specific configuration.
|
53
|
+
|
54
|
+
Returns
|
55
|
+
-------
|
56
|
+
HttpResponse[CustomAgentResponse]
|
57
|
+
Successful Response
|
58
|
+
"""
|
59
|
+
_response = self._client_wrapper.httpx_client.request(
|
60
|
+
f"api/v0/agents/{jsonable_encoder(agent_id)}/invoke",
|
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
|
+
_data = typing.cast(
|
75
|
+
CustomAgentResponse,
|
76
|
+
parse_obj_as(
|
77
|
+
type_=CustomAgentResponse, # type: ignore
|
78
|
+
object_=_response.json(),
|
79
|
+
),
|
80
|
+
)
|
81
|
+
return HttpResponse(response=_response, data=_data)
|
82
|
+
if _response.status_code == 422:
|
83
|
+
raise UnprocessableEntityError(
|
84
|
+
headers=dict(_response.headers),
|
85
|
+
body=typing.cast(
|
86
|
+
typing.Optional[typing.Any],
|
87
|
+
parse_obj_as(
|
88
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
89
|
+
object_=_response.json(),
|
90
|
+
),
|
91
|
+
),
|
92
|
+
)
|
93
|
+
_response_json = _response.json()
|
94
|
+
except JSONDecodeError:
|
95
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
96
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
97
|
+
|
98
|
+
|
99
|
+
class AsyncRawAgentsClient:
|
100
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
101
|
+
self._client_wrapper = client_wrapper
|
102
|
+
|
103
|
+
async def invoke_by_id(
|
104
|
+
self,
|
105
|
+
agent_id: str,
|
106
|
+
*,
|
107
|
+
config: typing.Dict[str, typing.Optional[typing.Any]],
|
108
|
+
messages: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
109
|
+
request_options: typing.Optional[RequestOptions] = None,
|
110
|
+
) -> AsyncHttpResponse[CustomAgentResponse]:
|
111
|
+
"""
|
112
|
+
Coming soon!
|
113
|
+
|
114
|
+
Invoke a custom agent created in [spaces](https://resources.athenaintel.com/docs/agents/create-your-agent).
|
115
|
+
|
116
|
+
Custom agents can be created and configured in spaces to perform specialized tasks.
|
117
|
+
Refer to the specific agent's documentation for details on configuration options
|
118
|
+
and expected responses.
|
119
|
+
|
120
|
+
Parameters
|
121
|
+
----------
|
122
|
+
agent_id : str
|
123
|
+
The ID of the custom agent to invoke. Create custom agents in [spaces](https://resources.athenaintel.com/docs/agents/create-your-agent).
|
124
|
+
|
125
|
+
config : typing.Dict[str, typing.Optional[typing.Any]]
|
126
|
+
Configuration for the custom agent. See the agent's documentation for specific configuration options.
|
127
|
+
|
128
|
+
messages : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
129
|
+
The messages to send to the custom agent
|
130
|
+
|
131
|
+
request_options : typing.Optional[RequestOptions]
|
132
|
+
Request-specific configuration.
|
133
|
+
|
134
|
+
Returns
|
135
|
+
-------
|
136
|
+
AsyncHttpResponse[CustomAgentResponse]
|
137
|
+
Successful Response
|
138
|
+
"""
|
139
|
+
_response = await self._client_wrapper.httpx_client.request(
|
140
|
+
f"api/v0/agents/{jsonable_encoder(agent_id)}/invoke",
|
141
|
+
method="POST",
|
142
|
+
json={
|
143
|
+
"config": config,
|
144
|
+
"messages": messages,
|
145
|
+
},
|
146
|
+
headers={
|
147
|
+
"content-type": "application/json",
|
148
|
+
},
|
149
|
+
request_options=request_options,
|
150
|
+
omit=OMIT,
|
151
|
+
)
|
152
|
+
try:
|
153
|
+
if 200 <= _response.status_code < 300:
|
154
|
+
_data = typing.cast(
|
155
|
+
CustomAgentResponse,
|
156
|
+
parse_obj_as(
|
157
|
+
type_=CustomAgentResponse, # type: ignore
|
158
|
+
object_=_response.json(),
|
159
|
+
),
|
160
|
+
)
|
161
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
162
|
+
if _response.status_code == 422:
|
163
|
+
raise UnprocessableEntityError(
|
164
|
+
headers=dict(_response.headers),
|
165
|
+
body=typing.cast(
|
166
|
+
typing.Optional[typing.Any],
|
167
|
+
parse_obj_as(
|
168
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
169
|
+
object_=_response.json(),
|
170
|
+
),
|
171
|
+
),
|
172
|
+
)
|
173
|
+
_response_json = _response.json()
|
174
|
+
except JSONDecodeError:
|
175
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
176
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
athena/agents/research/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.research_agent_response import ResearchAgentResponse
|
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 AsyncRawResearchClient, RawResearchClient
|
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 ResearchClient:
|
18
15
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
19
|
-
self.
|
16
|
+
self._raw_client = RawResearchClient(client_wrapper=client_wrapper)
|
17
|
+
|
18
|
+
@property
|
19
|
+
def with_raw_response(self) -> RawResearchClient:
|
20
|
+
"""
|
21
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
22
|
+
|
23
|
+
Returns
|
24
|
+
-------
|
25
|
+
RawResearchClient
|
26
|
+
"""
|
27
|
+
return self._raw_client
|
20
28
|
|
21
29
|
def invoke(
|
22
30
|
self,
|
@@ -56,47 +64,24 @@ class ResearchClient:
|
|
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
|
-
ResearchAgentResponse,
|
76
|
-
parse_obj_as(
|
77
|
-
type_=ResearchAgentResponse, # 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 AsyncResearchClient:
|
98
72
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
99
|
-
self.
|
73
|
+
self._raw_client = AsyncRawResearchClient(client_wrapper=client_wrapper)
|
74
|
+
|
75
|
+
@property
|
76
|
+
def with_raw_response(self) -> AsyncRawResearchClient:
|
77
|
+
"""
|
78
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
79
|
+
|
80
|
+
Returns
|
81
|
+
-------
|
82
|
+
AsyncRawResearchClient
|
83
|
+
"""
|
84
|
+
return self._raw_client
|
100
85
|
|
101
86
|
async def invoke(
|
102
87
|
self,
|
@@ -144,39 +129,5 @@ class AsyncResearchClient:
|
|
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
|
-
ResearchAgentResponse,
|
164
|
-
parse_obj_as(
|
165
|
-
type_=ResearchAgentResponse, # 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
|