athena-intelligence 0.1.127__py3-none-any.whl → 0.1.185__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. athena/__init__.py +24 -3
  2. athena/agents/__init__.py +2 -0
  3. athena/agents/client.py +51 -95
  4. athena/agents/drive/__init__.py +2 -0
  5. athena/agents/drive/client.py +31 -80
  6. athena/agents/drive/raw_client.py +155 -0
  7. athena/agents/general/__init__.py +2 -0
  8. athena/agents/general/client.py +91 -238
  9. athena/agents/general/raw_client.py +369 -0
  10. athena/agents/raw_client.py +176 -0
  11. athena/agents/research/__init__.py +2 -0
  12. athena/agents/research/client.py +31 -80
  13. athena/agents/research/raw_client.py +155 -0
  14. athena/agents/sql/__init__.py +2 -0
  15. athena/agents/sql/client.py +31 -80
  16. athena/agents/sql/raw_client.py +155 -0
  17. athena/assets/__init__.py +4 -0
  18. athena/assets/client.py +144 -0
  19. athena/assets/raw_client.py +164 -0
  20. athena/base_client.py +25 -11
  21. athena/client.py +1 -1
  22. athena/core/__init__.py +5 -0
  23. athena/core/api_error.py +13 -5
  24. athena/core/client_wrapper.py +33 -8
  25. athena/core/force_multipart.py +16 -0
  26. athena/core/http_client.py +70 -26
  27. athena/core/http_response.py +55 -0
  28. athena/core/jsonable_encoder.py +0 -1
  29. athena/core/pydantic_utilities.py +70 -111
  30. athena/core/serialization.py +7 -3
  31. athena/errors/__init__.py +2 -0
  32. athena/errors/bad_request_error.py +4 -2
  33. athena/errors/content_too_large_error.py +4 -2
  34. athena/errors/internal_server_error.py +4 -3
  35. athena/errors/not_found_error.py +4 -2
  36. athena/errors/unauthorized_error.py +4 -3
  37. athena/errors/unprocessable_entity_error.py +4 -3
  38. athena/errors/unsupported_media_type_error.py +4 -2
  39. athena/query/__init__.py +2 -0
  40. athena/query/client.py +39 -219
  41. athena/query/raw_client.py +344 -0
  42. athena/query/types/__init__.py +2 -0
  43. athena/tools/__init__.py +2 -0
  44. athena/tools/calendar/__init__.py +2 -0
  45. athena/tools/calendar/client.py +35 -79
  46. athena/tools/calendar/raw_client.py +172 -0
  47. athena/tools/client.py +114 -876
  48. athena/tools/email/__init__.py +2 -0
  49. athena/tools/email/client.py +39 -115
  50. athena/tools/email/raw_client.py +248 -0
  51. athena/tools/raw_client.py +1328 -0
  52. athena/tools/structured_data_extractor/__init__.py +2 -0
  53. athena/tools/structured_data_extractor/client.py +42 -96
  54. athena/tools/structured_data_extractor/raw_client.py +240 -0
  55. athena/tools/tasks/__init__.py +2 -0
  56. athena/tools/tasks/client.py +31 -43
  57. athena/tools/tasks/raw_client.py +96 -0
  58. athena/tools/types/__init__.py +2 -0
  59. athena/types/__init__.py +24 -2
  60. athena/types/asset_content_request_out.py +3 -3
  61. athena/types/asset_node.py +3 -3
  62. athena/types/asset_not_found_error.py +2 -2
  63. athena/types/asset_screenshot_response_out.py +4 -4
  64. athena/types/chunk.py +3 -3
  65. athena/types/chunk_content_item.py +3 -2
  66. athena/types/chunk_result.py +3 -3
  67. athena/types/content.py +7 -0
  68. athena/types/custom_agent_response.py +2 -2
  69. athena/types/data_frame_request_out.py +3 -3
  70. athena/types/data_frame_unknown_format_error.py +2 -2
  71. athena/types/document_chunk.py +2 -2
  72. athena/types/drive_agent_response.py +2 -2
  73. athena/types/file_chunk_request_out.py +3 -3
  74. athena/types/file_too_large_error.py +2 -2
  75. athena/types/folder_response.py +10 -4
  76. athena/types/general_agent_config.py +3 -3
  77. athena/types/general_agent_config_enabled_tools_item.py +1 -2
  78. athena/types/general_agent_request.py +15 -4
  79. athena/types/general_agent_response.py +4 -3
  80. athena/types/general_agent_response_message.py +100 -0
  81. athena/types/general_agent_response_message_kwargs.py +74 -0
  82. athena/types/{tool.py → id.py} +1 -1
  83. athena/types/image_url_content.py +2 -2
  84. athena/types/input_message.py +29 -0
  85. athena/types/input_message_content_item.py +39 -0
  86. athena/types/paginated_assets_out.py +52 -0
  87. athena/types/parent_folder_error.py +2 -2
  88. athena/types/prompt_message.py +3 -3
  89. athena/types/public_asset_out.py +97 -0
  90. athena/types/research_agent_response.py +2 -2
  91. athena/types/save_asset_request_out.py +2 -2
  92. athena/types/sql_agent_response.py +2 -2
  93. athena/types/structured_data_extractor_response.py +3 -3
  94. athena/types/text_content.py +2 -2
  95. athena/types/type.py +1 -1
  96. {athena_intelligence-0.1.127.dist-info → athena_intelligence-0.1.185.dist-info}/METADATA +3 -7
  97. athena_intelligence-0.1.185.dist-info/RECORD +112 -0
  98. {athena_intelligence-0.1.127.dist-info → athena_intelligence-0.1.185.dist-info}/WHEEL +1 -1
  99. athena_intelligence-0.1.127.dist-info/RECORD +0 -89
@@ -1,16 +1,12 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  import typing
4
- from ...core.client_wrapper import SyncClientWrapper
5
- from ...types.general_agent_request import GeneralAgentRequest
4
+
5
+ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
6
  from ...core.request_options import RequestOptions
7
+ from ...types.general_agent_request import GeneralAgentRequest
7
8
  from ...types.general_agent_response import GeneralAgentResponse
8
- from ...core.serialization import convert_and_respect_annotation_metadata
9
- from ...core.pydantic_utilities import parse_obj_as
10
- from ...errors.unprocessable_entity_error import UnprocessableEntityError
11
- from json.decoder import JSONDecodeError
12
- from ...core.api_error import ApiError
13
- from ...core.client_wrapper import AsyncClientWrapper
9
+ from .raw_client import AsyncRawGeneralClient, RawGeneralClient
14
10
 
15
11
  # this is used as the default value for optional parameters
16
12
  OMIT = typing.cast(typing.Any, ...)
@@ -18,7 +14,18 @@ OMIT = typing.cast(typing.Any, ...)
18
14
 
19
15
  class GeneralClient:
20
16
  def __init__(self, *, client_wrapper: SyncClientWrapper):
21
- self._client_wrapper = client_wrapper
17
+ self._raw_client = RawGeneralClient(client_wrapper=client_wrapper)
18
+
19
+ @property
20
+ def with_raw_response(self) -> RawGeneralClient:
21
+ """
22
+ Retrieves a raw implementation of this client that returns raw responses.
23
+
24
+ Returns
25
+ -------
26
+ RawGeneralClient
27
+ """
28
+ return self._raw_client
22
29
 
23
30
  def batch(
24
31
  self, *, request: typing.Sequence[GeneralAgentRequest], request_options: typing.Optional[RequestOptions] = None
@@ -40,7 +47,7 @@ class GeneralClient:
40
47
 
41
48
  Examples
42
49
  --------
43
- from athena import Athena, GeneralAgentConfig, GeneralAgentRequest
50
+ from athena import Athena, GeneralAgentConfig, GeneralAgentRequest, InputMessage
44
51
 
45
52
  client = Athena(
46
53
  api_key="YOUR_API_KEY",
@@ -49,50 +56,20 @@ class GeneralClient:
49
56
  request=[
50
57
  GeneralAgentRequest(
51
58
  config=GeneralAgentConfig(
52
- enabled_tools=["search"],
59
+ enabled_tools=[],
53
60
  ),
54
61
  messages=[
55
- {
56
- "content": "Please call the search tool for AAPL news.",
57
- "type": "user",
58
- }
62
+ InputMessage(
63
+ content="Please call the search tool for AAPL news.",
64
+ role="user",
65
+ )
59
66
  ],
60
67
  )
61
68
  ],
62
69
  )
63
70
  """
64
- _response = self._client_wrapper.httpx_client.request(
65
- "api/v0/agents/general/batch",
66
- method="POST",
67
- json=convert_and_respect_annotation_metadata(
68
- object_=request, annotation=typing.Sequence[GeneralAgentRequest], direction="write"
69
- ),
70
- request_options=request_options,
71
- omit=OMIT,
72
- )
73
- try:
74
- if 200 <= _response.status_code < 300:
75
- return typing.cast(
76
- typing.List[GeneralAgentResponse],
77
- parse_obj_as(
78
- type_=typing.List[GeneralAgentResponse], # type: ignore
79
- object_=_response.json(),
80
- ),
81
- )
82
- if _response.status_code == 422:
83
- raise UnprocessableEntityError(
84
- typing.cast(
85
- typing.Optional[typing.Any],
86
- parse_obj_as(
87
- type_=typing.Optional[typing.Any], # type: ignore
88
- object_=_response.json(),
89
- ),
90
- )
91
- )
92
- _response_json = _response.json()
93
- except JSONDecodeError:
94
- raise ApiError(status_code=_response.status_code, body=_response.text)
95
- raise ApiError(status_code=_response.status_code, body=_response_json)
71
+ _response = self._raw_client.batch(request=request, request_options=request_options)
72
+ return _response.data
96
73
 
97
74
  def invoke(
98
75
  self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
@@ -117,7 +94,7 @@ class GeneralClient:
117
94
 
118
95
  Examples
119
96
  --------
120
- from athena import Athena, GeneralAgentConfig, GeneralAgentRequest
97
+ from athena import Athena, GeneralAgentConfig, GeneralAgentRequest, InputMessage
121
98
 
122
99
  client = Athena(
123
100
  api_key="YOUR_API_KEY",
@@ -125,49 +102,19 @@ class GeneralClient:
125
102
  client.agents.general.invoke(
126
103
  request=GeneralAgentRequest(
127
104
  config=GeneralAgentConfig(
128
- enabled_tools=["search"],
105
+ enabled_tools=[],
129
106
  ),
130
107
  messages=[
131
- {
132
- "content": "Please call the search tool for AAPL news.",
133
- "type": "user",
134
- }
108
+ InputMessage(
109
+ content="Please call the search tool for AAPL news.",
110
+ role="user",
111
+ )
135
112
  ],
136
113
  ),
137
114
  )
138
115
  """
139
- _response = self._client_wrapper.httpx_client.request(
140
- "api/v0/agents/general/invoke",
141
- method="POST",
142
- json=convert_and_respect_annotation_metadata(
143
- object_=request, annotation=GeneralAgentRequest, direction="write"
144
- ),
145
- request_options=request_options,
146
- omit=OMIT,
147
- )
148
- try:
149
- if 200 <= _response.status_code < 300:
150
- return typing.cast(
151
- GeneralAgentResponse,
152
- parse_obj_as(
153
- type_=GeneralAgentResponse, # type: ignore
154
- object_=_response.json(),
155
- ),
156
- )
157
- if _response.status_code == 422:
158
- raise UnprocessableEntityError(
159
- typing.cast(
160
- typing.Optional[typing.Any],
161
- parse_obj_as(
162
- type_=typing.Optional[typing.Any], # type: ignore
163
- object_=_response.json(),
164
- ),
165
- )
166
- )
167
- _response_json = _response.json()
168
- except JSONDecodeError:
169
- raise ApiError(status_code=_response.status_code, body=_response.text)
170
- raise ApiError(status_code=_response.status_code, body=_response_json)
116
+ _response = self._raw_client.invoke(request=request, request_options=request_options)
117
+ return _response.data
171
118
 
172
119
  def stream_events(
173
120
  self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
@@ -189,7 +136,7 @@ class GeneralClient:
189
136
 
190
137
  Examples
191
138
  --------
192
- from athena import Athena, GeneralAgentConfig, GeneralAgentRequest
139
+ from athena import Athena, GeneralAgentConfig, GeneralAgentRequest, InputMessage
193
140
 
194
141
  client = Athena(
195
142
  api_key="YOUR_API_KEY",
@@ -197,54 +144,35 @@ class GeneralClient:
197
144
  client.agents.general.stream_events(
198
145
  request=GeneralAgentRequest(
199
146
  config=GeneralAgentConfig(
200
- enabled_tools=["search"],
147
+ enabled_tools=[],
201
148
  ),
202
149
  messages=[
203
- {
204
- "content": "Please call the search tool for AAPL news.",
205
- "type": "user",
206
- }
150
+ InputMessage(
151
+ content="Please call the search tool for AAPL news.",
152
+ role="user",
153
+ )
207
154
  ],
208
155
  ),
209
156
  )
210
157
  """
211
- _response = self._client_wrapper.httpx_client.request(
212
- "api/v0/agents/general/stream_events",
213
- method="POST",
214
- json=convert_and_respect_annotation_metadata(
215
- object_=request, annotation=GeneralAgentRequest, direction="write"
216
- ),
217
- request_options=request_options,
218
- omit=OMIT,
219
- )
220
- try:
221
- if 200 <= _response.status_code < 300:
222
- return typing.cast(
223
- GeneralAgentResponse,
224
- parse_obj_as(
225
- type_=GeneralAgentResponse, # type: ignore
226
- object_=_response.json(),
227
- ),
228
- )
229
- if _response.status_code == 422:
230
- raise UnprocessableEntityError(
231
- typing.cast(
232
- typing.Optional[typing.Any],
233
- parse_obj_as(
234
- type_=typing.Optional[typing.Any], # type: ignore
235
- object_=_response.json(),
236
- ),
237
- )
238
- )
239
- _response_json = _response.json()
240
- except JSONDecodeError:
241
- raise ApiError(status_code=_response.status_code, body=_response.text)
242
- raise ApiError(status_code=_response.status_code, body=_response_json)
158
+ _response = self._raw_client.stream_events(request=request, request_options=request_options)
159
+ return _response.data
243
160
 
244
161
 
245
162
  class AsyncGeneralClient:
246
163
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
247
- self._client_wrapper = client_wrapper
164
+ self._raw_client = AsyncRawGeneralClient(client_wrapper=client_wrapper)
165
+
166
+ @property
167
+ def with_raw_response(self) -> AsyncRawGeneralClient:
168
+ """
169
+ Retrieves a raw implementation of this client that returns raw responses.
170
+
171
+ Returns
172
+ -------
173
+ AsyncRawGeneralClient
174
+ """
175
+ return self._raw_client
248
176
 
249
177
  async def batch(
250
178
  self, *, request: typing.Sequence[GeneralAgentRequest], request_options: typing.Optional[RequestOptions] = None
@@ -268,7 +196,12 @@ class AsyncGeneralClient:
268
196
  --------
269
197
  import asyncio
270
198
 
271
- from athena import AsyncAthena, GeneralAgentConfig, GeneralAgentRequest
199
+ from athena import (
200
+ AsyncAthena,
201
+ GeneralAgentConfig,
202
+ GeneralAgentRequest,
203
+ InputMessage,
204
+ )
272
205
 
273
206
  client = AsyncAthena(
274
207
  api_key="YOUR_API_KEY",
@@ -280,13 +213,13 @@ class AsyncGeneralClient:
280
213
  request=[
281
214
  GeneralAgentRequest(
282
215
  config=GeneralAgentConfig(
283
- enabled_tools=["search"],
216
+ enabled_tools=[],
284
217
  ),
285
218
  messages=[
286
- {
287
- "content": "Please call the search tool for AAPL news.",
288
- "type": "user",
289
- }
219
+ InputMessage(
220
+ content="Please call the search tool for AAPL news.",
221
+ role="user",
222
+ )
290
223
  ],
291
224
  )
292
225
  ],
@@ -295,38 +228,8 @@ class AsyncGeneralClient:
295
228
 
296
229
  asyncio.run(main())
297
230
  """
298
- _response = await self._client_wrapper.httpx_client.request(
299
- "api/v0/agents/general/batch",
300
- method="POST",
301
- json=convert_and_respect_annotation_metadata(
302
- object_=request, annotation=typing.Sequence[GeneralAgentRequest], direction="write"
303
- ),
304
- request_options=request_options,
305
- omit=OMIT,
306
- )
307
- try:
308
- if 200 <= _response.status_code < 300:
309
- return typing.cast(
310
- typing.List[GeneralAgentResponse],
311
- parse_obj_as(
312
- type_=typing.List[GeneralAgentResponse], # type: ignore
313
- object_=_response.json(),
314
- ),
315
- )
316
- if _response.status_code == 422:
317
- raise UnprocessableEntityError(
318
- typing.cast(
319
- typing.Optional[typing.Any],
320
- parse_obj_as(
321
- type_=typing.Optional[typing.Any], # type: ignore
322
- object_=_response.json(),
323
- ),
324
- )
325
- )
326
- _response_json = _response.json()
327
- except JSONDecodeError:
328
- raise ApiError(status_code=_response.status_code, body=_response.text)
329
- raise ApiError(status_code=_response.status_code, body=_response_json)
231
+ _response = await self._raw_client.batch(request=request, request_options=request_options)
232
+ return _response.data
330
233
 
331
234
  async def invoke(
332
235
  self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
@@ -353,7 +256,12 @@ class AsyncGeneralClient:
353
256
  --------
354
257
  import asyncio
355
258
 
356
- from athena import AsyncAthena, GeneralAgentConfig, GeneralAgentRequest
259
+ from athena import (
260
+ AsyncAthena,
261
+ GeneralAgentConfig,
262
+ GeneralAgentRequest,
263
+ InputMessage,
264
+ )
357
265
 
358
266
  client = AsyncAthena(
359
267
  api_key="YOUR_API_KEY",
@@ -364,13 +272,13 @@ class AsyncGeneralClient:
364
272
  await client.agents.general.invoke(
365
273
  request=GeneralAgentRequest(
366
274
  config=GeneralAgentConfig(
367
- enabled_tools=["search"],
275
+ enabled_tools=[],
368
276
  ),
369
277
  messages=[
370
- {
371
- "content": "Please call the search tool for AAPL news.",
372
- "type": "user",
373
- }
278
+ InputMessage(
279
+ content="Please call the search tool for AAPL news.",
280
+ role="user",
281
+ )
374
282
  ],
375
283
  ),
376
284
  )
@@ -378,38 +286,8 @@ class AsyncGeneralClient:
378
286
 
379
287
  asyncio.run(main())
380
288
  """
381
- _response = await self._client_wrapper.httpx_client.request(
382
- "api/v0/agents/general/invoke",
383
- method="POST",
384
- json=convert_and_respect_annotation_metadata(
385
- object_=request, annotation=GeneralAgentRequest, direction="write"
386
- ),
387
- request_options=request_options,
388
- omit=OMIT,
389
- )
390
- try:
391
- if 200 <= _response.status_code < 300:
392
- return typing.cast(
393
- GeneralAgentResponse,
394
- parse_obj_as(
395
- type_=GeneralAgentResponse, # type: ignore
396
- object_=_response.json(),
397
- ),
398
- )
399
- if _response.status_code == 422:
400
- raise UnprocessableEntityError(
401
- typing.cast(
402
- typing.Optional[typing.Any],
403
- parse_obj_as(
404
- type_=typing.Optional[typing.Any], # type: ignore
405
- object_=_response.json(),
406
- ),
407
- )
408
- )
409
- _response_json = _response.json()
410
- except JSONDecodeError:
411
- raise ApiError(status_code=_response.status_code, body=_response.text)
412
- raise ApiError(status_code=_response.status_code, body=_response_json)
289
+ _response = await self._raw_client.invoke(request=request, request_options=request_options)
290
+ return _response.data
413
291
 
414
292
  async def stream_events(
415
293
  self, *, request: GeneralAgentRequest, request_options: typing.Optional[RequestOptions] = None
@@ -433,7 +311,12 @@ class AsyncGeneralClient:
433
311
  --------
434
312
  import asyncio
435
313
 
436
- from athena import AsyncAthena, GeneralAgentConfig, GeneralAgentRequest
314
+ from athena import (
315
+ AsyncAthena,
316
+ GeneralAgentConfig,
317
+ GeneralAgentRequest,
318
+ InputMessage,
319
+ )
437
320
 
438
321
  client = AsyncAthena(
439
322
  api_key="YOUR_API_KEY",
@@ -444,13 +327,13 @@ class AsyncGeneralClient:
444
327
  await client.agents.general.stream_events(
445
328
  request=GeneralAgentRequest(
446
329
  config=GeneralAgentConfig(
447
- enabled_tools=["search"],
330
+ enabled_tools=[],
448
331
  ),
449
332
  messages=[
450
- {
451
- "content": "Please call the search tool for AAPL news.",
452
- "type": "user",
453
- }
333
+ InputMessage(
334
+ content="Please call the search tool for AAPL news.",
335
+ role="user",
336
+ )
454
337
  ],
455
338
  ),
456
339
  )
@@ -458,35 +341,5 @@ class AsyncGeneralClient:
458
341
 
459
342
  asyncio.run(main())
460
343
  """
461
- _response = await self._client_wrapper.httpx_client.request(
462
- "api/v0/agents/general/stream_events",
463
- method="POST",
464
- json=convert_and_respect_annotation_metadata(
465
- object_=request, annotation=GeneralAgentRequest, direction="write"
466
- ),
467
- request_options=request_options,
468
- omit=OMIT,
469
- )
470
- try:
471
- if 200 <= _response.status_code < 300:
472
- return typing.cast(
473
- GeneralAgentResponse,
474
- parse_obj_as(
475
- type_=GeneralAgentResponse, # type: ignore
476
- object_=_response.json(),
477
- ),
478
- )
479
- if _response.status_code == 422:
480
- raise UnprocessableEntityError(
481
- typing.cast(
482
- typing.Optional[typing.Any],
483
- parse_obj_as(
484
- type_=typing.Optional[typing.Any], # type: ignore
485
- object_=_response.json(),
486
- ),
487
- )
488
- )
489
- _response_json = _response.json()
490
- except JSONDecodeError:
491
- raise ApiError(status_code=_response.status_code, body=_response.text)
492
- raise ApiError(status_code=_response.status_code, body=_response_json)
344
+ _response = await self._raw_client.stream_events(request=request, request_options=request_options)
345
+ return _response.data