athena-intelligence 0.1.111__py3-none-any.whl → 0.1.113__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 +4 -0
- athena/client.py +19 -1
- athena/core/client_wrapper.py +1 -1
- athena/tools/client.py +109 -0
- athena/types/__init__.py +4 -0
- athena/types/document_chunk.py +34 -0
- athena/types/file_chunk_request_out.py +34 -0
- {athena_intelligence-0.1.111.dist-info → athena_intelligence-0.1.113.dist-info}/METADATA +1 -1
- {athena_intelligence-0.1.111.dist-info → athena_intelligence-0.1.113.dist-info}/RECORD +10 -8
- {athena_intelligence-0.1.111.dist-info → athena_intelligence-0.1.113.dist-info}/WHEEL +0 -0
athena/__init__.py
CHANGED
@@ -7,6 +7,8 @@ from .types import (
|
|
7
7
|
DataFrameRequestOutDataItemItem,
|
8
8
|
DataFrameRequestOutIndexItem,
|
9
9
|
DataFrameUnknownFormatError,
|
10
|
+
DocumentChunk,
|
11
|
+
FileChunkRequestOut,
|
10
12
|
FileTooLargeError,
|
11
13
|
ParentFolderError,
|
12
14
|
SaveAssetRequestOut,
|
@@ -36,6 +38,8 @@ __all__ = [
|
|
36
38
|
"DataFrameRequestOutDataItemItem",
|
37
39
|
"DataFrameRequestOutIndexItem",
|
38
40
|
"DataFrameUnknownFormatError",
|
41
|
+
"DocumentChunk",
|
42
|
+
"FileChunkRequestOut",
|
39
43
|
"FileTooLargeError",
|
40
44
|
"InternalServerError",
|
41
45
|
"NotFoundError",
|
athena/client.py
CHANGED
@@ -131,7 +131,7 @@ class WrappedToolsClient(ToolsClient):
|
|
131
131
|
Parameters
|
132
132
|
----------
|
133
133
|
asset_object : pd.DataFrame | pd.Series | core.File
|
134
|
-
A pandas data frame, series, or core.File
|
134
|
+
A pandas data frame, series, matplotlib figure, or core.File
|
135
135
|
|
136
136
|
parent_folder_id : typing.Optional[str]
|
137
137
|
Identifier of the folder into which the asset should be saved
|
@@ -515,6 +515,10 @@ def _convert_asset_object(
|
|
515
515
|
name: Union[str, None] = None,
|
516
516
|
) -> core.File:
|
517
517
|
import pandas as pd
|
518
|
+
try:
|
519
|
+
from IPython.core.formatters import format_display_data # type: ignore[import]
|
520
|
+
except ImportError:
|
521
|
+
format_display_data = None
|
518
522
|
|
519
523
|
if isinstance(asset_object, pd.Series):
|
520
524
|
asset_object = asset_object.to_frame()
|
@@ -524,4 +528,18 @@ def _convert_asset_object(
|
|
524
528
|
asset_object.to_parquet(path=None),
|
525
529
|
"application/vnd.apache.parquet",
|
526
530
|
)
|
531
|
+
if format_display_data:
|
532
|
+
data, _metadata = format_display_data(asset_object)
|
533
|
+
image_types = {
|
534
|
+
"image/png": "Plot",
|
535
|
+
"image/jpeg": "Image",
|
536
|
+
"image/gif": "Gif",
|
537
|
+
}
|
538
|
+
for media_type, label in image_types.items():
|
539
|
+
if media_type in data:
|
540
|
+
return (
|
541
|
+
name or f"Untitled {label}",
|
542
|
+
data[media_type],
|
543
|
+
media_type,
|
544
|
+
)
|
527
545
|
return asset_object # type: ignore[return-value]
|
athena/core/client_wrapper.py
CHANGED
@@ -17,7 +17,7 @@ class BaseClientWrapper:
|
|
17
17
|
headers: typing.Dict[str, str] = {
|
18
18
|
"X-Fern-Language": "Python",
|
19
19
|
"X-Fern-SDK-Name": "athena-intelligence",
|
20
|
-
"X-Fern-SDK-Version": "0.1.
|
20
|
+
"X-Fern-SDK-Version": "0.1.113",
|
21
21
|
}
|
22
22
|
headers["X-API-KEY"] = self.api_key
|
23
23
|
return headers
|
athena/tools/client.py
CHANGED
@@ -18,6 +18,7 @@ from ..errors.unsupported_media_type_error import UnsupportedMediaTypeError
|
|
18
18
|
from ..types.asset_not_found_error import AssetNotFoundError
|
19
19
|
from ..types.data_frame_request_out import DataFrameRequestOut
|
20
20
|
from ..types.data_frame_unknown_format_error import DataFrameUnknownFormatError
|
21
|
+
from ..types.file_chunk_request_out import FileChunkRequestOut
|
21
22
|
from ..types.file_too_large_error import FileTooLargeError
|
22
23
|
from ..types.parent_folder_error import ParentFolderError
|
23
24
|
from ..types.save_asset_request_out import SaveAssetRequestOut
|
@@ -31,6 +32,60 @@ class ToolsClient:
|
|
31
32
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
32
33
|
self._client_wrapper = client_wrapper
|
33
34
|
|
35
|
+
def get_file_chunks(
|
36
|
+
self, *, asset_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
|
37
|
+
) -> FileChunkRequestOut:
|
38
|
+
"""
|
39
|
+
Get the chunks of a file.
|
40
|
+
|
41
|
+
Parameters
|
42
|
+
----------
|
43
|
+
asset_ids : typing.Sequence[str]
|
44
|
+
Identifiers of the assets
|
45
|
+
|
46
|
+
request_options : typing.Optional[RequestOptions]
|
47
|
+
Request-specific configuration.
|
48
|
+
|
49
|
+
Returns
|
50
|
+
-------
|
51
|
+
FileChunkRequestOut
|
52
|
+
Successful Response
|
53
|
+
|
54
|
+
Examples
|
55
|
+
--------
|
56
|
+
from athena.client import Athena
|
57
|
+
|
58
|
+
client = Athena(
|
59
|
+
api_key="YOUR_API_KEY",
|
60
|
+
)
|
61
|
+
client.tools.get_file_chunks(
|
62
|
+
asset_ids=[
|
63
|
+
"asset_9249292-d118-42d3-96b4-00eccfe0754f",
|
64
|
+
"asset_9249292-d118-42d3-95b4-01eccfe0754f",
|
65
|
+
],
|
66
|
+
)
|
67
|
+
"""
|
68
|
+
_response = self._client_wrapper.httpx_client.request(
|
69
|
+
"api/v0/tools/file/chunks",
|
70
|
+
method="POST",
|
71
|
+
json={"asset_ids": asset_ids},
|
72
|
+
request_options=request_options,
|
73
|
+
omit=OMIT,
|
74
|
+
)
|
75
|
+
if 200 <= _response.status_code < 300:
|
76
|
+
return pydantic_v1.parse_obj_as(FileChunkRequestOut, _response.json()) # type: ignore
|
77
|
+
if _response.status_code == 401:
|
78
|
+
raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
79
|
+
if _response.status_code == 404:
|
80
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(AssetNotFoundError, _response.json())) # type: ignore
|
81
|
+
if _response.status_code == 422:
|
82
|
+
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
83
|
+
try:
|
84
|
+
_response_json = _response.json()
|
85
|
+
except JSONDecodeError:
|
86
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
87
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
88
|
+
|
34
89
|
def data_frame(
|
35
90
|
self,
|
36
91
|
*,
|
@@ -226,6 +281,60 @@ class AsyncToolsClient:
|
|
226
281
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
227
282
|
self._client_wrapper = client_wrapper
|
228
283
|
|
284
|
+
async def get_file_chunks(
|
285
|
+
self, *, asset_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
|
286
|
+
) -> FileChunkRequestOut:
|
287
|
+
"""
|
288
|
+
Get the chunks of a file.
|
289
|
+
|
290
|
+
Parameters
|
291
|
+
----------
|
292
|
+
asset_ids : typing.Sequence[str]
|
293
|
+
Identifiers of the assets
|
294
|
+
|
295
|
+
request_options : typing.Optional[RequestOptions]
|
296
|
+
Request-specific configuration.
|
297
|
+
|
298
|
+
Returns
|
299
|
+
-------
|
300
|
+
FileChunkRequestOut
|
301
|
+
Successful Response
|
302
|
+
|
303
|
+
Examples
|
304
|
+
--------
|
305
|
+
from athena.client import AsyncAthena
|
306
|
+
|
307
|
+
client = AsyncAthena(
|
308
|
+
api_key="YOUR_API_KEY",
|
309
|
+
)
|
310
|
+
await client.tools.get_file_chunks(
|
311
|
+
asset_ids=[
|
312
|
+
"asset_9249292-d118-42d3-96b4-00eccfe0754f",
|
313
|
+
"asset_9249292-d118-42d3-95b4-01eccfe0754f",
|
314
|
+
],
|
315
|
+
)
|
316
|
+
"""
|
317
|
+
_response = await self._client_wrapper.httpx_client.request(
|
318
|
+
"api/v0/tools/file/chunks",
|
319
|
+
method="POST",
|
320
|
+
json={"asset_ids": asset_ids},
|
321
|
+
request_options=request_options,
|
322
|
+
omit=OMIT,
|
323
|
+
)
|
324
|
+
if 200 <= _response.status_code < 300:
|
325
|
+
return pydantic_v1.parse_obj_as(FileChunkRequestOut, _response.json()) # type: ignore
|
326
|
+
if _response.status_code == 401:
|
327
|
+
raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
328
|
+
if _response.status_code == 404:
|
329
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(AssetNotFoundError, _response.json())) # type: ignore
|
330
|
+
if _response.status_code == 422:
|
331
|
+
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
332
|
+
try:
|
333
|
+
_response_json = _response.json()
|
334
|
+
except JSONDecodeError:
|
335
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
336
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
337
|
+
|
229
338
|
async def data_frame(
|
230
339
|
self,
|
231
340
|
*,
|
athena/types/__init__.py
CHANGED
@@ -6,6 +6,8 @@ from .data_frame_request_out_columns_item import DataFrameRequestOutColumnsItem
|
|
6
6
|
from .data_frame_request_out_data_item_item import DataFrameRequestOutDataItemItem
|
7
7
|
from .data_frame_request_out_index_item import DataFrameRequestOutIndexItem
|
8
8
|
from .data_frame_unknown_format_error import DataFrameUnknownFormatError
|
9
|
+
from .document_chunk import DocumentChunk
|
10
|
+
from .file_chunk_request_out import FileChunkRequestOut
|
9
11
|
from .file_too_large_error import FileTooLargeError
|
10
12
|
from .parent_folder_error import ParentFolderError
|
11
13
|
from .save_asset_request_out import SaveAssetRequestOut
|
@@ -17,6 +19,8 @@ __all__ = [
|
|
17
19
|
"DataFrameRequestOutDataItemItem",
|
18
20
|
"DataFrameRequestOutIndexItem",
|
19
21
|
"DataFrameUnknownFormatError",
|
22
|
+
"DocumentChunk",
|
23
|
+
"FileChunkRequestOut",
|
20
24
|
"FileTooLargeError",
|
21
25
|
"ParentFolderError",
|
22
26
|
"SaveAssetRequestOut",
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import datetime as dt
|
4
|
+
import typing
|
5
|
+
|
6
|
+
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
8
|
+
|
9
|
+
|
10
|
+
class DocumentChunk(pydantic_v1.BaseModel):
|
11
|
+
"""
|
12
|
+
A document chunk.
|
13
|
+
"""
|
14
|
+
|
15
|
+
metadata: typing.Optional[typing.Dict[str, typing.Any]] = None
|
16
|
+
page_content: str
|
17
|
+
|
18
|
+
def json(self, **kwargs: typing.Any) -> str:
|
19
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
20
|
+
return super().json(**kwargs_with_defaults)
|
21
|
+
|
22
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
23
|
+
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
24
|
+
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
25
|
+
|
26
|
+
return deep_union_pydantic_dicts(
|
27
|
+
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
28
|
+
)
|
29
|
+
|
30
|
+
class Config:
|
31
|
+
frozen = True
|
32
|
+
smart_union = True
|
33
|
+
extra = pydantic_v1.Extra.allow
|
34
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import datetime as dt
|
4
|
+
import typing
|
5
|
+
|
6
|
+
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
8
|
+
from .document_chunk import DocumentChunk
|
9
|
+
|
10
|
+
|
11
|
+
class FileChunkRequestOut(pydantic_v1.BaseModel):
|
12
|
+
"""
|
13
|
+
Response model for a file chunk.
|
14
|
+
"""
|
15
|
+
|
16
|
+
chunks: typing.Dict[str, typing.List[DocumentChunk]]
|
17
|
+
|
18
|
+
def json(self, **kwargs: typing.Any) -> str:
|
19
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
20
|
+
return super().json(**kwargs_with_defaults)
|
21
|
+
|
22
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
23
|
+
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
24
|
+
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
25
|
+
|
26
|
+
return deep_union_pydantic_dicts(
|
27
|
+
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
28
|
+
)
|
29
|
+
|
30
|
+
class Config:
|
31
|
+
frozen = True
|
32
|
+
smart_union = True
|
33
|
+
extra = pydantic_v1.Extra.allow
|
34
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
athena/__init__.py,sha256=
|
1
|
+
athena/__init__.py,sha256=5ayB3YWH8AYc_ahG2b8ovLPX2u5xugauR2luprNXi0E,1484
|
2
2
|
athena/base_client.py,sha256=TlP599mOBvj7Tk8IpFe5dgrDM98GJu3lEQh_zwl4vtA,5439
|
3
|
-
athena/client.py,sha256=
|
3
|
+
athena/client.py,sha256=em5UYFrE-2NMO391Stf6p7n1vTDqK-qfyOl1ajuo5aI,18765
|
4
4
|
athena/core/__init__.py,sha256=UFXpYzcGxWQUucU1TkjOQ9mGWN3A5JohluOIWVYKU4I,973
|
5
5
|
athena/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
6
|
-
athena/core/client_wrapper.py,sha256
|
6
|
+
athena/core/client_wrapper.py,sha256=gLeaSAPiG-nCTmstAt7nS4I_wTVggpdEg54ShE5Y8w8,1806
|
7
7
|
athena/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
8
8
|
athena/core/file.py,sha256=sy1RUGZ3aJYuw998bZytxxo6QdgKmlnlgBaMvwEKCGg,1480
|
9
9
|
athena/core/http_client.py,sha256=Z4NuAsJD-51yqmoME17O5sxwx5orSp1wsnd6bPyKcgA,17768
|
@@ -27,20 +27,22 @@ athena/query/client.py,sha256=GYvBV7YFYjL3gyskeF6C8BJZlLvU7R045gJ5kGiYkvg,9043
|
|
27
27
|
athena/query/types/__init__.py,sha256=WX-Or2h5NY2sv93ojrZsHcmiFHGYdqd0yxNo-5iGHR4,206
|
28
28
|
athena/query/types/query_execute_request_database_asset_ids.py,sha256=aoVl5Xb34Q27hYGuVTnByGIxtHkL67wAwzXh7eJctew,154
|
29
29
|
athena/tools/__init__.py,sha256=3n7oOoMebo06MAQqYRE2CX9Q0fTNnKBYE0cTlh1MPkM,165
|
30
|
-
athena/tools/client.py,sha256=
|
30
|
+
athena/tools/client.py,sha256=1l9MrzkTlZdszyuLLrqF_kREt11X2DjXjsp2pCIsBMo,20203
|
31
31
|
athena/tools/types/__init__.py,sha256=cA-ZQm6veQAP3_vKu9KkZpISsQqgTBN_Z--FGY1c2iA,197
|
32
32
|
athena/tools/types/tools_data_frame_request_columns_item.py,sha256=GA1FUlTV_CfSc-KToTAwFf4Exl0rr4fsweVZupztjw0,138
|
33
|
-
athena/types/__init__.py,sha256=
|
33
|
+
athena/types/__init__.py,sha256=863IuasnsjdZ4LFKjfQhczKesHHp_Ey68A9AWuNcDlc,1085
|
34
34
|
athena/types/asset_not_found_error.py,sha256=ZcgqRuzvO4Z8vVVxwtDB-QtKhpVIVV3hqQuJeUoOoJE,1121
|
35
35
|
athena/types/data_frame_request_out.py,sha256=1CEBe-baDQi0uz_EgMw0TKGYXGj6KV44cL3ViRTZLKM,1669
|
36
36
|
athena/types/data_frame_request_out_columns_item.py,sha256=9cjzciFv6C8n8Griytt_q_8ovkzHViS5tvUcMDfkfKE,143
|
37
37
|
athena/types/data_frame_request_out_data_item_item.py,sha256=KMTJRr-1bdKDNMbUericCliwRoPHLGRV-n2bJtxdRW0,144
|
38
38
|
athena/types/data_frame_request_out_index_item.py,sha256=bW7oe912trpkYKodj-I_AiTXXy61yWzliekcsUZkZE0,141
|
39
39
|
athena/types/data_frame_unknown_format_error.py,sha256=lbgAUArEgIYZt3P5Ji4Clp-xyXnKJR7-v5VzXwKu0J8,1168
|
40
|
+
athena/types/document_chunk.py,sha256=deXiiMA_U5EabUh1Fg2AB4ElYuc5OsTnrU7JwLApJmA,1227
|
41
|
+
athena/types/file_chunk_request_out.py,sha256=Ju0I_UpSitjQ-XqSIRvvg2XA6QtfCLZClPq5PUqmPNg,1258
|
40
42
|
athena/types/file_too_large_error.py,sha256=AinkrcgR7lcTILAD8RX0x48P3GlSoAh1OihxMvSvRuo,1120
|
41
43
|
athena/types/parent_folder_error.py,sha256=ZMF-i3mZY6Mu1n5uQ60Q3mIIfehlWuXtgFUkSYspkx8,1120
|
42
44
|
athena/types/save_asset_request_out.py,sha256=5bpBaUV3oeuL_hz4s07c-6MQHkn4cBsyxgT_SD5oi6I,1193
|
43
45
|
athena/version.py,sha256=8aYAOJtVLaJLpRp6mTiEIhnl8gXA7yE0aDtZ-3mKQ4k,87
|
44
|
-
athena_intelligence-0.1.
|
45
|
-
athena_intelligence-0.1.
|
46
|
-
athena_intelligence-0.1.
|
46
|
+
athena_intelligence-0.1.113.dist-info/METADATA,sha256=XegkvOoDvfCcAxFft1S8_vtcBxwuox-4aTOZABdHUvo,5274
|
47
|
+
athena_intelligence-0.1.113.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
48
|
+
athena_intelligence-0.1.113.dist-info/RECORD,,
|
File without changes
|