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