athena-intelligence 0.1.119__py3-none-any.whl → 0.1.121__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 +16 -8
- athena/agents/__init__.py +2 -2
- athena/agents/client.py +156 -6
- athena/agents/drive/client.py +134 -0
- athena/agents/{athena_assistant → general}/client.py +106 -98
- athena/agents/research/__init__.py +2 -0
- athena/agents/research/client.py +134 -0
- athena/agents/sql/__init__.py +2 -0
- athena/agents/sql/client.py +134 -0
- athena/core/client_wrapper.py +1 -1
- athena/tools/__init__.py +2 -1
- athena/tools/calendar/__init__.py +2 -0
- athena/tools/calendar/client.py +155 -0
- athena/tools/client.py +12 -0
- athena/tools/email/__init__.py +2 -0
- athena/tools/email/client.py +223 -0
- athena/tools/structured_data_extractor/__init__.py +2 -0
- athena/{agents → tools}/structured_data_extractor/client.py +6 -6
- athena/tools/tasks/__init__.py +2 -0
- athena/tools/tasks/client.py +87 -0
- athena/types/__init__.py +16 -8
- athena/types/custom_agent_response.py +32 -0
- athena/types/drive_agent_response.py +32 -0
- athena/types/{athena_assistant_config.py → general_agent_config.py} +4 -4
- athena/types/{athena_assistant_config_enabled_tools_item.py → general_agent_config_enabled_tools_item.py} +1 -1
- athena/types/{athena_assistant_request.py → general_agent_request.py} +4 -4
- athena/types/{athena_assistant_reponse.py → general_agent_response.py} +2 -2
- athena/types/research_agent_response.py +32 -0
- athena/types/sql_agent_response.py +37 -0
- {athena_intelligence-0.1.119.dist-info → athena_intelligence-0.1.121.dist-info}/METADATA +1 -1
- {athena_intelligence-0.1.119.dist-info → athena_intelligence-0.1.121.dist-info}/RECORD +34 -18
- /athena/agents/{athena_assistant → drive}/__init__.py +0 -0
- /athena/agents/{structured_data_extractor → general}/__init__.py +0 -0
- {athena_intelligence-0.1.119.dist-info → athena_intelligence-0.1.121.dist-info}/WHEEL +0 -0
@@ -8,66 +8,64 @@ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
8
|
from ...core.pydantic_utilities import pydantic_v1
|
9
9
|
from ...core.request_options import RequestOptions
|
10
10
|
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
11
|
-
from ...types.
|
12
|
-
from ...types.
|
11
|
+
from ...types.general_agent_request import GeneralAgentRequest
|
12
|
+
from ...types.general_agent_response import GeneralAgentResponse
|
13
13
|
|
14
14
|
# this is used as the default value for optional parameters
|
15
15
|
OMIT = typing.cast(typing.Any, ...)
|
16
16
|
|
17
17
|
|
18
|
-
class
|
18
|
+
class GeneralClient:
|
19
19
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
20
20
|
self._client_wrapper = client_wrapper
|
21
21
|
|
22
22
|
def batch(
|
23
|
-
self,
|
24
|
-
|
25
|
-
request: typing.Sequence[AthenaAssistantRequest],
|
26
|
-
request_options: typing.Optional[RequestOptions] = None
|
27
|
-
) -> typing.List[AthenaAssistantReponse]:
|
23
|
+
self, *, request: typing.Sequence[GeneralAgentRequest], request_options: typing.Optional[RequestOptions] = None
|
24
|
+
) -> typing.List[GeneralAgentResponse]:
|
28
25
|
"""
|
29
|
-
Call the
|
26
|
+
Coming soon! Call the general agent with batched requests and return the results.
|
30
27
|
|
31
28
|
Parameters
|
32
29
|
----------
|
33
|
-
request : typing.Sequence[
|
30
|
+
request : typing.Sequence[GeneralAgentRequest]
|
34
31
|
|
35
32
|
request_options : typing.Optional[RequestOptions]
|
36
33
|
Request-specific configuration.
|
37
34
|
|
38
35
|
Returns
|
39
36
|
-------
|
40
|
-
typing.List[
|
37
|
+
typing.List[GeneralAgentResponse]
|
41
38
|
Successful Response
|
42
39
|
|
43
40
|
Examples
|
44
41
|
--------
|
45
|
-
from athena import
|
42
|
+
from athena import GeneralAgentConfig, GeneralAgentRequest, Tool
|
46
43
|
from athena.client import Athena
|
47
44
|
|
48
45
|
client = Athena(
|
49
46
|
api_key="YOUR_API_KEY",
|
50
47
|
)
|
51
|
-
client.agents.
|
48
|
+
client.agents.general.batch(
|
52
49
|
request=[
|
53
|
-
|
54
|
-
config=
|
50
|
+
GeneralAgentRequest(
|
51
|
+
config=GeneralAgentConfig(
|
55
52
|
enabled_tools=[Tool.SEARCH],
|
56
53
|
),
|
57
|
-
messages=[
|
54
|
+
messages=[
|
55
|
+
{
|
56
|
+
"content": "Please call the search tool for AAPL news.",
|
57
|
+
"type": "user",
|
58
|
+
}
|
59
|
+
],
|
58
60
|
)
|
59
61
|
],
|
60
62
|
)
|
61
63
|
"""
|
62
64
|
_response = self._client_wrapper.httpx_client.request(
|
63
|
-
"api/v0/agents/
|
64
|
-
method="POST",
|
65
|
-
json=request,
|
66
|
-
request_options=request_options,
|
67
|
-
omit=OMIT,
|
65
|
+
"api/v0/agents/general/batch", method="POST", json=request, request_options=request_options, omit=OMIT
|
68
66
|
)
|
69
67
|
if 200 <= _response.status_code < 300:
|
70
|
-
return pydantic_v1.parse_obj_as(typing.List[
|
68
|
+
return pydantic_v1.parse_obj_as(typing.List[GeneralAgentResponse], _response.json()) # type: ignore
|
71
69
|
if _response.status_code == 422:
|
72
70
|
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
73
71
|
try:
|
@@ -77,52 +75,53 @@ class AthenaAssistantClient:
|
|
77
75
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
78
76
|
|
79
77
|
def invoke(
|
80
|
-
self, *, request:
|
81
|
-
) ->
|
78
|
+
self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
|
79
|
+
) -> GeneralAgentResponse:
|
82
80
|
"""
|
83
|
-
Call the Athena
|
81
|
+
Call the general Athena agent synchronously.
|
84
82
|
|
85
83
|
Call the agent with the messages list, wait for the agent to complete,
|
86
84
|
and return the result.
|
87
85
|
|
88
86
|
Parameters
|
89
87
|
----------
|
90
|
-
request :
|
88
|
+
request : GeneralAgentRequest
|
91
89
|
|
92
90
|
request_options : typing.Optional[RequestOptions]
|
93
91
|
Request-specific configuration.
|
94
92
|
|
95
93
|
Returns
|
96
94
|
-------
|
97
|
-
|
95
|
+
GeneralAgentResponse
|
98
96
|
Successful Response
|
99
97
|
|
100
98
|
Examples
|
101
99
|
--------
|
102
|
-
from athena import
|
100
|
+
from athena import GeneralAgentConfig, GeneralAgentRequest, Tool
|
103
101
|
from athena.client import Athena
|
104
102
|
|
105
103
|
client = Athena(
|
106
104
|
api_key="YOUR_API_KEY",
|
107
105
|
)
|
108
|
-
client.agents.
|
109
|
-
request=
|
110
|
-
config=
|
106
|
+
client.agents.general.invoke(
|
107
|
+
request=GeneralAgentRequest(
|
108
|
+
config=GeneralAgentConfig(
|
111
109
|
enabled_tools=[Tool.SEARCH],
|
112
110
|
),
|
113
|
-
messages=[
|
111
|
+
messages=[
|
112
|
+
{
|
113
|
+
"content": "Please call the search tool for AAPL news.",
|
114
|
+
"type": "user",
|
115
|
+
}
|
116
|
+
],
|
114
117
|
),
|
115
118
|
)
|
116
119
|
"""
|
117
120
|
_response = self._client_wrapper.httpx_client.request(
|
118
|
-
"api/v0/agents/
|
119
|
-
method="POST",
|
120
|
-
json=request,
|
121
|
-
request_options=request_options,
|
122
|
-
omit=OMIT,
|
121
|
+
"api/v0/agents/general/invoke", method="POST", json=request, request_options=request_options, omit=OMIT
|
123
122
|
)
|
124
123
|
if 200 <= _response.status_code < 300:
|
125
|
-
return pydantic_v1.parse_obj_as(
|
124
|
+
return pydantic_v1.parse_obj_as(GeneralAgentResponse, _response.json()) # type: ignore
|
126
125
|
if _response.status_code == 422:
|
127
126
|
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
128
127
|
try:
|
@@ -132,49 +131,54 @@ class AthenaAssistantClient:
|
|
132
131
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
133
132
|
|
134
133
|
def stream_events(
|
135
|
-
self, *, request:
|
136
|
-
) ->
|
134
|
+
self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
|
135
|
+
) -> GeneralAgentResponse:
|
137
136
|
"""
|
138
|
-
Call the
|
137
|
+
Coming soon! Call the general agent and stream events for real-time chat applications.
|
139
138
|
|
140
139
|
Parameters
|
141
140
|
----------
|
142
|
-
request :
|
141
|
+
request : GeneralAgentRequest
|
143
142
|
|
144
143
|
request_options : typing.Optional[RequestOptions]
|
145
144
|
Request-specific configuration.
|
146
145
|
|
147
146
|
Returns
|
148
147
|
-------
|
149
|
-
|
148
|
+
GeneralAgentResponse
|
150
149
|
Successful Response
|
151
150
|
|
152
151
|
Examples
|
153
152
|
--------
|
154
|
-
from athena import
|
153
|
+
from athena import GeneralAgentConfig, GeneralAgentRequest, Tool
|
155
154
|
from athena.client import Athena
|
156
155
|
|
157
156
|
client = Athena(
|
158
157
|
api_key="YOUR_API_KEY",
|
159
158
|
)
|
160
|
-
client.agents.
|
161
|
-
request=
|
162
|
-
config=
|
159
|
+
client.agents.general.stream_events(
|
160
|
+
request=GeneralAgentRequest(
|
161
|
+
config=GeneralAgentConfig(
|
163
162
|
enabled_tools=[Tool.SEARCH],
|
164
163
|
),
|
165
|
-
messages=[
|
164
|
+
messages=[
|
165
|
+
{
|
166
|
+
"content": "Please call the search tool for AAPL news.",
|
167
|
+
"type": "user",
|
168
|
+
}
|
169
|
+
],
|
166
170
|
),
|
167
171
|
)
|
168
172
|
"""
|
169
173
|
_response = self._client_wrapper.httpx_client.request(
|
170
|
-
"api/v0/agents/
|
174
|
+
"api/v0/agents/general/stream_events",
|
171
175
|
method="POST",
|
172
176
|
json=request,
|
173
177
|
request_options=request_options,
|
174
178
|
omit=OMIT,
|
175
179
|
)
|
176
180
|
if 200 <= _response.status_code < 300:
|
177
|
-
return pydantic_v1.parse_obj_as(
|
181
|
+
return pydantic_v1.parse_obj_as(GeneralAgentResponse, _response.json()) # type: ignore
|
178
182
|
if _response.status_code == 422:
|
179
183
|
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
180
184
|
try:
|
@@ -184,59 +188,57 @@ class AthenaAssistantClient:
|
|
184
188
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
185
189
|
|
186
190
|
|
187
|
-
class
|
191
|
+
class AsyncGeneralClient:
|
188
192
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
189
193
|
self._client_wrapper = client_wrapper
|
190
194
|
|
191
195
|
async def batch(
|
192
|
-
self,
|
193
|
-
|
194
|
-
request: typing.Sequence[AthenaAssistantRequest],
|
195
|
-
request_options: typing.Optional[RequestOptions] = None
|
196
|
-
) -> typing.List[AthenaAssistantReponse]:
|
196
|
+
self, *, request: typing.Sequence[GeneralAgentRequest], request_options: typing.Optional[RequestOptions] = None
|
197
|
+
) -> typing.List[GeneralAgentResponse]:
|
197
198
|
"""
|
198
|
-
Call the
|
199
|
+
Coming soon! Call the general agent with batched requests and return the results.
|
199
200
|
|
200
201
|
Parameters
|
201
202
|
----------
|
202
|
-
request : typing.Sequence[
|
203
|
+
request : typing.Sequence[GeneralAgentRequest]
|
203
204
|
|
204
205
|
request_options : typing.Optional[RequestOptions]
|
205
206
|
Request-specific configuration.
|
206
207
|
|
207
208
|
Returns
|
208
209
|
-------
|
209
|
-
typing.List[
|
210
|
+
typing.List[GeneralAgentResponse]
|
210
211
|
Successful Response
|
211
212
|
|
212
213
|
Examples
|
213
214
|
--------
|
214
|
-
from athena import
|
215
|
+
from athena import GeneralAgentConfig, GeneralAgentRequest, Tool
|
215
216
|
from athena.client import AsyncAthena
|
216
217
|
|
217
218
|
client = AsyncAthena(
|
218
219
|
api_key="YOUR_API_KEY",
|
219
220
|
)
|
220
|
-
await client.agents.
|
221
|
+
await client.agents.general.batch(
|
221
222
|
request=[
|
222
|
-
|
223
|
-
config=
|
223
|
+
GeneralAgentRequest(
|
224
|
+
config=GeneralAgentConfig(
|
224
225
|
enabled_tools=[Tool.SEARCH],
|
225
226
|
),
|
226
|
-
messages=[
|
227
|
+
messages=[
|
228
|
+
{
|
229
|
+
"content": "Please call the search tool for AAPL news.",
|
230
|
+
"type": "user",
|
231
|
+
}
|
232
|
+
],
|
227
233
|
)
|
228
234
|
],
|
229
235
|
)
|
230
236
|
"""
|
231
237
|
_response = await self._client_wrapper.httpx_client.request(
|
232
|
-
"api/v0/agents/
|
233
|
-
method="POST",
|
234
|
-
json=request,
|
235
|
-
request_options=request_options,
|
236
|
-
omit=OMIT,
|
238
|
+
"api/v0/agents/general/batch", method="POST", json=request, request_options=request_options, omit=OMIT
|
237
239
|
)
|
238
240
|
if 200 <= _response.status_code < 300:
|
239
|
-
return pydantic_v1.parse_obj_as(typing.List[
|
241
|
+
return pydantic_v1.parse_obj_as(typing.List[GeneralAgentResponse], _response.json()) # type: ignore
|
240
242
|
if _response.status_code == 422:
|
241
243
|
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
242
244
|
try:
|
@@ -246,52 +248,53 @@ class AsyncAthenaAssistantClient:
|
|
246
248
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
247
249
|
|
248
250
|
async def invoke(
|
249
|
-
self, *, request:
|
250
|
-
) ->
|
251
|
+
self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
|
252
|
+
) -> GeneralAgentResponse:
|
251
253
|
"""
|
252
|
-
Call the Athena
|
254
|
+
Call the general Athena agent synchronously.
|
253
255
|
|
254
256
|
Call the agent with the messages list, wait for the agent to complete,
|
255
257
|
and return the result.
|
256
258
|
|
257
259
|
Parameters
|
258
260
|
----------
|
259
|
-
request :
|
261
|
+
request : GeneralAgentRequest
|
260
262
|
|
261
263
|
request_options : typing.Optional[RequestOptions]
|
262
264
|
Request-specific configuration.
|
263
265
|
|
264
266
|
Returns
|
265
267
|
-------
|
266
|
-
|
268
|
+
GeneralAgentResponse
|
267
269
|
Successful Response
|
268
270
|
|
269
271
|
Examples
|
270
272
|
--------
|
271
|
-
from athena import
|
273
|
+
from athena import GeneralAgentConfig, GeneralAgentRequest, Tool
|
272
274
|
from athena.client import AsyncAthena
|
273
275
|
|
274
276
|
client = AsyncAthena(
|
275
277
|
api_key="YOUR_API_KEY",
|
276
278
|
)
|
277
|
-
await client.agents.
|
278
|
-
request=
|
279
|
-
config=
|
279
|
+
await client.agents.general.invoke(
|
280
|
+
request=GeneralAgentRequest(
|
281
|
+
config=GeneralAgentConfig(
|
280
282
|
enabled_tools=[Tool.SEARCH],
|
281
283
|
),
|
282
|
-
messages=[
|
284
|
+
messages=[
|
285
|
+
{
|
286
|
+
"content": "Please call the search tool for AAPL news.",
|
287
|
+
"type": "user",
|
288
|
+
}
|
289
|
+
],
|
283
290
|
),
|
284
291
|
)
|
285
292
|
"""
|
286
293
|
_response = await self._client_wrapper.httpx_client.request(
|
287
|
-
"api/v0/agents/
|
288
|
-
method="POST",
|
289
|
-
json=request,
|
290
|
-
request_options=request_options,
|
291
|
-
omit=OMIT,
|
294
|
+
"api/v0/agents/general/invoke", method="POST", json=request, request_options=request_options, omit=OMIT
|
292
295
|
)
|
293
296
|
if 200 <= _response.status_code < 300:
|
294
|
-
return pydantic_v1.parse_obj_as(
|
297
|
+
return pydantic_v1.parse_obj_as(GeneralAgentResponse, _response.json()) # type: ignore
|
295
298
|
if _response.status_code == 422:
|
296
299
|
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
297
300
|
try:
|
@@ -301,49 +304,54 @@ class AsyncAthenaAssistantClient:
|
|
301
304
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
302
305
|
|
303
306
|
async def stream_events(
|
304
|
-
self, *, request:
|
305
|
-
) ->
|
307
|
+
self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
|
308
|
+
) -> GeneralAgentResponse:
|
306
309
|
"""
|
307
|
-
Call the
|
310
|
+
Coming soon! Call the general agent and stream events for real-time chat applications.
|
308
311
|
|
309
312
|
Parameters
|
310
313
|
----------
|
311
|
-
request :
|
314
|
+
request : GeneralAgentRequest
|
312
315
|
|
313
316
|
request_options : typing.Optional[RequestOptions]
|
314
317
|
Request-specific configuration.
|
315
318
|
|
316
319
|
Returns
|
317
320
|
-------
|
318
|
-
|
321
|
+
GeneralAgentResponse
|
319
322
|
Successful Response
|
320
323
|
|
321
324
|
Examples
|
322
325
|
--------
|
323
|
-
from athena import
|
326
|
+
from athena import GeneralAgentConfig, GeneralAgentRequest, Tool
|
324
327
|
from athena.client import AsyncAthena
|
325
328
|
|
326
329
|
client = AsyncAthena(
|
327
330
|
api_key="YOUR_API_KEY",
|
328
331
|
)
|
329
|
-
await client.agents.
|
330
|
-
request=
|
331
|
-
config=
|
332
|
+
await client.agents.general.stream_events(
|
333
|
+
request=GeneralAgentRequest(
|
334
|
+
config=GeneralAgentConfig(
|
332
335
|
enabled_tools=[Tool.SEARCH],
|
333
336
|
),
|
334
|
-
messages=[
|
337
|
+
messages=[
|
338
|
+
{
|
339
|
+
"content": "Please call the search tool for AAPL news.",
|
340
|
+
"type": "user",
|
341
|
+
}
|
342
|
+
],
|
335
343
|
),
|
336
344
|
)
|
337
345
|
"""
|
338
346
|
_response = await self._client_wrapper.httpx_client.request(
|
339
|
-
"api/v0/agents/
|
347
|
+
"api/v0/agents/general/stream_events",
|
340
348
|
method="POST",
|
341
349
|
json=request,
|
342
350
|
request_options=request_options,
|
343
351
|
omit=OMIT,
|
344
352
|
)
|
345
353
|
if 200 <= _response.status_code < 300:
|
346
|
-
return pydantic_v1.parse_obj_as(
|
354
|
+
return pydantic_v1.parse_obj_as(GeneralAgentResponse, _response.json()) # type: ignore
|
347
355
|
if _response.status_code == 422:
|
348
356
|
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
349
357
|
try:
|
@@ -0,0 +1,134 @@
|
|
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.pydantic_utilities import pydantic_v1
|
9
|
+
from ...core.request_options import RequestOptions
|
10
|
+
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
11
|
+
from ...types.research_agent_response import ResearchAgentResponse
|
12
|
+
|
13
|
+
# this is used as the default value for optional parameters
|
14
|
+
OMIT = typing.cast(typing.Any, ...)
|
15
|
+
|
16
|
+
|
17
|
+
class ResearchClient:
|
18
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
19
|
+
self._client_wrapper = client_wrapper
|
20
|
+
|
21
|
+
def invoke(
|
22
|
+
self,
|
23
|
+
*,
|
24
|
+
config: typing.Dict[str, typing.Any],
|
25
|
+
messages: typing.Sequence[typing.Dict[str, typing.Any]],
|
26
|
+
request_options: typing.Optional[RequestOptions] = None
|
27
|
+
) -> ResearchAgentResponse:
|
28
|
+
"""
|
29
|
+
Coming soon! Conduct research using web and other sources.
|
30
|
+
|
31
|
+
Parameters
|
32
|
+
----------
|
33
|
+
config : typing.Dict[str, typing.Any]
|
34
|
+
Configuration for the research agent including search parameters and sources
|
35
|
+
|
36
|
+
messages : typing.Sequence[typing.Dict[str, typing.Any]]
|
37
|
+
The messages to send to the research agent
|
38
|
+
|
39
|
+
request_options : typing.Optional[RequestOptions]
|
40
|
+
Request-specific configuration.
|
41
|
+
|
42
|
+
Returns
|
43
|
+
-------
|
44
|
+
ResearchAgentResponse
|
45
|
+
Successful Response
|
46
|
+
|
47
|
+
Examples
|
48
|
+
--------
|
49
|
+
from athena.client import Athena
|
50
|
+
|
51
|
+
client = Athena(
|
52
|
+
api_key="YOUR_API_KEY",
|
53
|
+
)
|
54
|
+
client.agents.research.invoke(
|
55
|
+
config={"key": "value"},
|
56
|
+
messages=[{"key": "value"}],
|
57
|
+
)
|
58
|
+
"""
|
59
|
+
_response = self._client_wrapper.httpx_client.request(
|
60
|
+
"api/v0/agents/research/invoke",
|
61
|
+
method="POST",
|
62
|
+
json={"config": config, "messages": messages},
|
63
|
+
request_options=request_options,
|
64
|
+
omit=OMIT,
|
65
|
+
)
|
66
|
+
if 200 <= _response.status_code < 300:
|
67
|
+
return pydantic_v1.parse_obj_as(ResearchAgentResponse, _response.json()) # type: ignore
|
68
|
+
if _response.status_code == 422:
|
69
|
+
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
70
|
+
try:
|
71
|
+
_response_json = _response.json()
|
72
|
+
except JSONDecodeError:
|
73
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
74
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
75
|
+
|
76
|
+
|
77
|
+
class AsyncResearchClient:
|
78
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
79
|
+
self._client_wrapper = client_wrapper
|
80
|
+
|
81
|
+
async def invoke(
|
82
|
+
self,
|
83
|
+
*,
|
84
|
+
config: typing.Dict[str, typing.Any],
|
85
|
+
messages: typing.Sequence[typing.Dict[str, typing.Any]],
|
86
|
+
request_options: typing.Optional[RequestOptions] = None
|
87
|
+
) -> ResearchAgentResponse:
|
88
|
+
"""
|
89
|
+
Coming soon! Conduct research using web and other sources.
|
90
|
+
|
91
|
+
Parameters
|
92
|
+
----------
|
93
|
+
config : typing.Dict[str, typing.Any]
|
94
|
+
Configuration for the research agent including search parameters and sources
|
95
|
+
|
96
|
+
messages : typing.Sequence[typing.Dict[str, typing.Any]]
|
97
|
+
The messages to send to the research agent
|
98
|
+
|
99
|
+
request_options : typing.Optional[RequestOptions]
|
100
|
+
Request-specific configuration.
|
101
|
+
|
102
|
+
Returns
|
103
|
+
-------
|
104
|
+
ResearchAgentResponse
|
105
|
+
Successful Response
|
106
|
+
|
107
|
+
Examples
|
108
|
+
--------
|
109
|
+
from athena.client import AsyncAthena
|
110
|
+
|
111
|
+
client = AsyncAthena(
|
112
|
+
api_key="YOUR_API_KEY",
|
113
|
+
)
|
114
|
+
await client.agents.research.invoke(
|
115
|
+
config={"key": "value"},
|
116
|
+
messages=[{"key": "value"}],
|
117
|
+
)
|
118
|
+
"""
|
119
|
+
_response = await self._client_wrapper.httpx_client.request(
|
120
|
+
"api/v0/agents/research/invoke",
|
121
|
+
method="POST",
|
122
|
+
json={"config": config, "messages": messages},
|
123
|
+
request_options=request_options,
|
124
|
+
omit=OMIT,
|
125
|
+
)
|
126
|
+
if 200 <= _response.status_code < 300:
|
127
|
+
return pydantic_v1.parse_obj_as(ResearchAgentResponse, _response.json()) # type: ignore
|
128
|
+
if _response.status_code == 422:
|
129
|
+
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
130
|
+
try:
|
131
|
+
_response_json = _response.json()
|
132
|
+
except JSONDecodeError:
|
133
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
134
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|