athena-intelligence 0.1.119__py3-none-any.whl → 0.1.120__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 +32 -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 +142 -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 +36 -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/general_agent_request.py +39 -0
- athena/types/general_agent_request_messages_item.py +32 -0
- athena/types/general_agent_request_messages_item_content.py +7 -0
- athena/types/general_agent_request_messages_item_content_item.py +60 -0
- athena/types/general_agent_request_messages_item_content_item_image_url.py +29 -0
- athena/types/general_agent_request_messages_item_content_item_text.py +29 -0
- athena/types/general_agent_request_messages_item_type.py +25 -0
- athena/types/{athena_assistant_reponse.py → general_agent_response.py} +2 -2
- athena/types/research_agent_response.py +32 -0
- athena/types/{athena_assistant_request.py → sql_agent_response.py} +5 -6
- {athena_intelligence-0.1.119.dist-info → athena_intelligence-0.1.120.dist-info}/METADATA +1 -1
- {athena_intelligence-0.1.119.dist-info → athena_intelligence-0.1.120.dist-info}/RECORD +40 -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.120.dist-info}/WHEEL +0 -0
@@ -8,66 +8,70 @@ 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 (
|
43
|
+
GeneralAgentConfig,
|
44
|
+
GeneralAgentRequest,
|
45
|
+
GeneralAgentRequestMessagesItem,
|
46
|
+
GeneralAgentRequestMessagesItemType,
|
47
|
+
Tool,
|
48
|
+
)
|
46
49
|
from athena.client import Athena
|
47
50
|
|
48
51
|
client = Athena(
|
49
52
|
api_key="YOUR_API_KEY",
|
50
53
|
)
|
51
|
-
client.agents.
|
54
|
+
client.agents.general.batch(
|
52
55
|
request=[
|
53
|
-
|
54
|
-
config=
|
56
|
+
GeneralAgentRequest(
|
57
|
+
config=GeneralAgentConfig(
|
55
58
|
enabled_tools=[Tool.SEARCH],
|
56
59
|
),
|
57
|
-
messages=[
|
60
|
+
messages=[
|
61
|
+
GeneralAgentRequestMessagesItem(
|
62
|
+
content="Please call the search tool for AAPL news.",
|
63
|
+
type=GeneralAgentRequestMessagesItemType.USER,
|
64
|
+
)
|
65
|
+
],
|
58
66
|
)
|
59
67
|
],
|
60
68
|
)
|
61
69
|
"""
|
62
70
|
_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,
|
71
|
+
"api/v0/agents/general/batch", method="POST", json=request, request_options=request_options, omit=OMIT
|
68
72
|
)
|
69
73
|
if 200 <= _response.status_code < 300:
|
70
|
-
return pydantic_v1.parse_obj_as(typing.List[
|
74
|
+
return pydantic_v1.parse_obj_as(typing.List[GeneralAgentResponse], _response.json()) # type: ignore
|
71
75
|
if _response.status_code == 422:
|
72
76
|
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
73
77
|
try:
|
@@ -77,52 +81,59 @@ class AthenaAssistantClient:
|
|
77
81
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
78
82
|
|
79
83
|
def invoke(
|
80
|
-
self, *, request:
|
81
|
-
) ->
|
84
|
+
self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
|
85
|
+
) -> GeneralAgentResponse:
|
82
86
|
"""
|
83
|
-
Call the Athena
|
87
|
+
Call the general Athena agent synchronously.
|
84
88
|
|
85
89
|
Call the agent with the messages list, wait for the agent to complete,
|
86
90
|
and return the result.
|
87
91
|
|
88
92
|
Parameters
|
89
93
|
----------
|
90
|
-
request :
|
94
|
+
request : GeneralAgentRequest
|
91
95
|
|
92
96
|
request_options : typing.Optional[RequestOptions]
|
93
97
|
Request-specific configuration.
|
94
98
|
|
95
99
|
Returns
|
96
100
|
-------
|
97
|
-
|
101
|
+
GeneralAgentResponse
|
98
102
|
Successful Response
|
99
103
|
|
100
104
|
Examples
|
101
105
|
--------
|
102
|
-
from athena import
|
106
|
+
from athena import (
|
107
|
+
GeneralAgentConfig,
|
108
|
+
GeneralAgentRequest,
|
109
|
+
GeneralAgentRequestMessagesItem,
|
110
|
+
GeneralAgentRequestMessagesItemType,
|
111
|
+
Tool,
|
112
|
+
)
|
103
113
|
from athena.client import Athena
|
104
114
|
|
105
115
|
client = Athena(
|
106
116
|
api_key="YOUR_API_KEY",
|
107
117
|
)
|
108
|
-
client.agents.
|
109
|
-
request=
|
110
|
-
config=
|
118
|
+
client.agents.general.invoke(
|
119
|
+
request=GeneralAgentRequest(
|
120
|
+
config=GeneralAgentConfig(
|
111
121
|
enabled_tools=[Tool.SEARCH],
|
112
122
|
),
|
113
|
-
messages=[
|
123
|
+
messages=[
|
124
|
+
GeneralAgentRequestMessagesItem(
|
125
|
+
content="Please call the search tool for AAPL news.",
|
126
|
+
type=GeneralAgentRequestMessagesItemType.USER,
|
127
|
+
)
|
128
|
+
],
|
114
129
|
),
|
115
130
|
)
|
116
131
|
"""
|
117
132
|
_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,
|
133
|
+
"api/v0/agents/general/invoke", method="POST", json=request, request_options=request_options, omit=OMIT
|
123
134
|
)
|
124
135
|
if 200 <= _response.status_code < 300:
|
125
|
-
return pydantic_v1.parse_obj_as(
|
136
|
+
return pydantic_v1.parse_obj_as(GeneralAgentResponse, _response.json()) # type: ignore
|
126
137
|
if _response.status_code == 422:
|
127
138
|
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
128
139
|
try:
|
@@ -132,49 +143,60 @@ class AthenaAssistantClient:
|
|
132
143
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
133
144
|
|
134
145
|
def stream_events(
|
135
|
-
self, *, request:
|
136
|
-
) ->
|
146
|
+
self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
|
147
|
+
) -> GeneralAgentResponse:
|
137
148
|
"""
|
138
|
-
Call the
|
149
|
+
Coming soon! Call the general agent and stream events for real-time chat applications.
|
139
150
|
|
140
151
|
Parameters
|
141
152
|
----------
|
142
|
-
request :
|
153
|
+
request : GeneralAgentRequest
|
143
154
|
|
144
155
|
request_options : typing.Optional[RequestOptions]
|
145
156
|
Request-specific configuration.
|
146
157
|
|
147
158
|
Returns
|
148
159
|
-------
|
149
|
-
|
160
|
+
GeneralAgentResponse
|
150
161
|
Successful Response
|
151
162
|
|
152
163
|
Examples
|
153
164
|
--------
|
154
|
-
from athena import
|
165
|
+
from athena import (
|
166
|
+
GeneralAgentConfig,
|
167
|
+
GeneralAgentRequest,
|
168
|
+
GeneralAgentRequestMessagesItem,
|
169
|
+
GeneralAgentRequestMessagesItemType,
|
170
|
+
Tool,
|
171
|
+
)
|
155
172
|
from athena.client import Athena
|
156
173
|
|
157
174
|
client = Athena(
|
158
175
|
api_key="YOUR_API_KEY",
|
159
176
|
)
|
160
|
-
client.agents.
|
161
|
-
request=
|
162
|
-
config=
|
177
|
+
client.agents.general.stream_events(
|
178
|
+
request=GeneralAgentRequest(
|
179
|
+
config=GeneralAgentConfig(
|
163
180
|
enabled_tools=[Tool.SEARCH],
|
164
181
|
),
|
165
|
-
messages=[
|
182
|
+
messages=[
|
183
|
+
GeneralAgentRequestMessagesItem(
|
184
|
+
content="Please call the search tool for AAPL news.",
|
185
|
+
type=GeneralAgentRequestMessagesItemType.USER,
|
186
|
+
)
|
187
|
+
],
|
166
188
|
),
|
167
189
|
)
|
168
190
|
"""
|
169
191
|
_response = self._client_wrapper.httpx_client.request(
|
170
|
-
"api/v0/agents/
|
192
|
+
"api/v0/agents/general/stream_events",
|
171
193
|
method="POST",
|
172
194
|
json=request,
|
173
195
|
request_options=request_options,
|
174
196
|
omit=OMIT,
|
175
197
|
)
|
176
198
|
if 200 <= _response.status_code < 300:
|
177
|
-
return pydantic_v1.parse_obj_as(
|
199
|
+
return pydantic_v1.parse_obj_as(GeneralAgentResponse, _response.json()) # type: ignore
|
178
200
|
if _response.status_code == 422:
|
179
201
|
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
180
202
|
try:
|
@@ -184,59 +206,63 @@ class AthenaAssistantClient:
|
|
184
206
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
185
207
|
|
186
208
|
|
187
|
-
class
|
209
|
+
class AsyncGeneralClient:
|
188
210
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
189
211
|
self._client_wrapper = client_wrapper
|
190
212
|
|
191
213
|
async def batch(
|
192
|
-
self,
|
193
|
-
|
194
|
-
request: typing.Sequence[AthenaAssistantRequest],
|
195
|
-
request_options: typing.Optional[RequestOptions] = None
|
196
|
-
) -> typing.List[AthenaAssistantReponse]:
|
214
|
+
self, *, request: typing.Sequence[GeneralAgentRequest], request_options: typing.Optional[RequestOptions] = None
|
215
|
+
) -> typing.List[GeneralAgentResponse]:
|
197
216
|
"""
|
198
|
-
Call the
|
217
|
+
Coming soon! Call the general agent with batched requests and return the results.
|
199
218
|
|
200
219
|
Parameters
|
201
220
|
----------
|
202
|
-
request : typing.Sequence[
|
221
|
+
request : typing.Sequence[GeneralAgentRequest]
|
203
222
|
|
204
223
|
request_options : typing.Optional[RequestOptions]
|
205
224
|
Request-specific configuration.
|
206
225
|
|
207
226
|
Returns
|
208
227
|
-------
|
209
|
-
typing.List[
|
228
|
+
typing.List[GeneralAgentResponse]
|
210
229
|
Successful Response
|
211
230
|
|
212
231
|
Examples
|
213
232
|
--------
|
214
|
-
from athena import
|
233
|
+
from athena import (
|
234
|
+
GeneralAgentConfig,
|
235
|
+
GeneralAgentRequest,
|
236
|
+
GeneralAgentRequestMessagesItem,
|
237
|
+
GeneralAgentRequestMessagesItemType,
|
238
|
+
Tool,
|
239
|
+
)
|
215
240
|
from athena.client import AsyncAthena
|
216
241
|
|
217
242
|
client = AsyncAthena(
|
218
243
|
api_key="YOUR_API_KEY",
|
219
244
|
)
|
220
|
-
await client.agents.
|
245
|
+
await client.agents.general.batch(
|
221
246
|
request=[
|
222
|
-
|
223
|
-
config=
|
247
|
+
GeneralAgentRequest(
|
248
|
+
config=GeneralAgentConfig(
|
224
249
|
enabled_tools=[Tool.SEARCH],
|
225
250
|
),
|
226
|
-
messages=[
|
251
|
+
messages=[
|
252
|
+
GeneralAgentRequestMessagesItem(
|
253
|
+
content="Please call the search tool for AAPL news.",
|
254
|
+
type=GeneralAgentRequestMessagesItemType.USER,
|
255
|
+
)
|
256
|
+
],
|
227
257
|
)
|
228
258
|
],
|
229
259
|
)
|
230
260
|
"""
|
231
261
|
_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,
|
262
|
+
"api/v0/agents/general/batch", method="POST", json=request, request_options=request_options, omit=OMIT
|
237
263
|
)
|
238
264
|
if 200 <= _response.status_code < 300:
|
239
|
-
return pydantic_v1.parse_obj_as(typing.List[
|
265
|
+
return pydantic_v1.parse_obj_as(typing.List[GeneralAgentResponse], _response.json()) # type: ignore
|
240
266
|
if _response.status_code == 422:
|
241
267
|
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
242
268
|
try:
|
@@ -246,52 +272,59 @@ class AsyncAthenaAssistantClient:
|
|
246
272
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
247
273
|
|
248
274
|
async def invoke(
|
249
|
-
self, *, request:
|
250
|
-
) ->
|
275
|
+
self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
|
276
|
+
) -> GeneralAgentResponse:
|
251
277
|
"""
|
252
|
-
Call the Athena
|
278
|
+
Call the general Athena agent synchronously.
|
253
279
|
|
254
280
|
Call the agent with the messages list, wait for the agent to complete,
|
255
281
|
and return the result.
|
256
282
|
|
257
283
|
Parameters
|
258
284
|
----------
|
259
|
-
request :
|
285
|
+
request : GeneralAgentRequest
|
260
286
|
|
261
287
|
request_options : typing.Optional[RequestOptions]
|
262
288
|
Request-specific configuration.
|
263
289
|
|
264
290
|
Returns
|
265
291
|
-------
|
266
|
-
|
292
|
+
GeneralAgentResponse
|
267
293
|
Successful Response
|
268
294
|
|
269
295
|
Examples
|
270
296
|
--------
|
271
|
-
from athena import
|
297
|
+
from athena import (
|
298
|
+
GeneralAgentConfig,
|
299
|
+
GeneralAgentRequest,
|
300
|
+
GeneralAgentRequestMessagesItem,
|
301
|
+
GeneralAgentRequestMessagesItemType,
|
302
|
+
Tool,
|
303
|
+
)
|
272
304
|
from athena.client import AsyncAthena
|
273
305
|
|
274
306
|
client = AsyncAthena(
|
275
307
|
api_key="YOUR_API_KEY",
|
276
308
|
)
|
277
|
-
await client.agents.
|
278
|
-
request=
|
279
|
-
config=
|
309
|
+
await client.agents.general.invoke(
|
310
|
+
request=GeneralAgentRequest(
|
311
|
+
config=GeneralAgentConfig(
|
280
312
|
enabled_tools=[Tool.SEARCH],
|
281
313
|
),
|
282
|
-
messages=[
|
314
|
+
messages=[
|
315
|
+
GeneralAgentRequestMessagesItem(
|
316
|
+
content="Please call the search tool for AAPL news.",
|
317
|
+
type=GeneralAgentRequestMessagesItemType.USER,
|
318
|
+
)
|
319
|
+
],
|
283
320
|
),
|
284
321
|
)
|
285
322
|
"""
|
286
323
|
_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,
|
324
|
+
"api/v0/agents/general/invoke", method="POST", json=request, request_options=request_options, omit=OMIT
|
292
325
|
)
|
293
326
|
if 200 <= _response.status_code < 300:
|
294
|
-
return pydantic_v1.parse_obj_as(
|
327
|
+
return pydantic_v1.parse_obj_as(GeneralAgentResponse, _response.json()) # type: ignore
|
295
328
|
if _response.status_code == 422:
|
296
329
|
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
297
330
|
try:
|
@@ -301,49 +334,60 @@ class AsyncAthenaAssistantClient:
|
|
301
334
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
302
335
|
|
303
336
|
async def stream_events(
|
304
|
-
self, *, request:
|
305
|
-
) ->
|
337
|
+
self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
|
338
|
+
) -> GeneralAgentResponse:
|
306
339
|
"""
|
307
|
-
Call the
|
340
|
+
Coming soon! Call the general agent and stream events for real-time chat applications.
|
308
341
|
|
309
342
|
Parameters
|
310
343
|
----------
|
311
|
-
request :
|
344
|
+
request : GeneralAgentRequest
|
312
345
|
|
313
346
|
request_options : typing.Optional[RequestOptions]
|
314
347
|
Request-specific configuration.
|
315
348
|
|
316
349
|
Returns
|
317
350
|
-------
|
318
|
-
|
351
|
+
GeneralAgentResponse
|
319
352
|
Successful Response
|
320
353
|
|
321
354
|
Examples
|
322
355
|
--------
|
323
|
-
from athena import
|
356
|
+
from athena import (
|
357
|
+
GeneralAgentConfig,
|
358
|
+
GeneralAgentRequest,
|
359
|
+
GeneralAgentRequestMessagesItem,
|
360
|
+
GeneralAgentRequestMessagesItemType,
|
361
|
+
Tool,
|
362
|
+
)
|
324
363
|
from athena.client import AsyncAthena
|
325
364
|
|
326
365
|
client = AsyncAthena(
|
327
366
|
api_key="YOUR_API_KEY",
|
328
367
|
)
|
329
|
-
await client.agents.
|
330
|
-
request=
|
331
|
-
config=
|
368
|
+
await client.agents.general.stream_events(
|
369
|
+
request=GeneralAgentRequest(
|
370
|
+
config=GeneralAgentConfig(
|
332
371
|
enabled_tools=[Tool.SEARCH],
|
333
372
|
),
|
334
|
-
messages=[
|
373
|
+
messages=[
|
374
|
+
GeneralAgentRequestMessagesItem(
|
375
|
+
content="Please call the search tool for AAPL news.",
|
376
|
+
type=GeneralAgentRequestMessagesItemType.USER,
|
377
|
+
)
|
378
|
+
],
|
335
379
|
),
|
336
380
|
)
|
337
381
|
"""
|
338
382
|
_response = await self._client_wrapper.httpx_client.request(
|
339
|
-
"api/v0/agents/
|
383
|
+
"api/v0/agents/general/stream_events",
|
340
384
|
method="POST",
|
341
385
|
json=request,
|
342
386
|
request_options=request_options,
|
343
387
|
omit=OMIT,
|
344
388
|
)
|
345
389
|
if 200 <= _response.status_code < 300:
|
346
|
-
return pydantic_v1.parse_obj_as(
|
390
|
+
return pydantic_v1.parse_obj_as(GeneralAgentResponse, _response.json()) # type: ignore
|
347
391
|
if _response.status_code == 422:
|
348
392
|
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
349
393
|
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)
|