athena-intelligence 0.1.94__py3-none-any.whl → 0.1.95__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 +1 -76
- athena/base_client.py +4 -31
- athena/client.py +4 -9
- athena/core/client_wrapper.py +1 -1
- athena/environment.py +1 -1
- athena/tools/client.py +61 -916
- athena/tools/types/tools_data_frame_request_columns_item.py +1 -1
- athena/types/__init__.py +0 -66
- athena/types/data_frame_parsing_error.py +1 -1
- athena/types/data_frame_request_out.py +5 -1
- athena/types/data_frame_unknown_format_error.py +1 -1
- {athena_intelligence-0.1.94.dist-info → athena_intelligence-0.1.95.dist-info}/METADATA +1 -1
- athena_intelligence-0.1.95.dist-info/RECORD +40 -0
- athena/chain/__init__.py +0 -2
- athena/chain/client.py +0 -302
- athena/dataset/__init__.py +0 -2
- athena/dataset/client.py +0 -124
- athena/message/__init__.py +0 -2
- athena/message/client.py +0 -249
- athena/polling_message_client.py +0 -125
- athena/query/__init__.py +0 -2
- athena/query/client.py +0 -123
- athena/report/__init__.py +0 -2
- athena/report/client.py +0 -125
- athena/search/__init__.py +0 -2
- athena/search/client.py +0 -171
- athena/snippet/__init__.py +0 -2
- athena/snippet/client.py +0 -208
- athena/types/athena_document_v_2_out.py +0 -29
- athena/types/convert_pdf_to_sheet_out.py +0 -30
- athena/types/dataset.py +0 -33
- athena/types/document.py +0 -47
- athena/types/excecute_tool_first_workflow_out.py +0 -29
- athena/types/file_data_response.py +0 -36
- athena/types/filter_model.py +0 -32
- athena/types/filter_operator.py +0 -73
- athena/types/firecrawl_scrape_url_data_reponse_dto.py +0 -32
- athena/types/firecrawl_scrape_url_metadata.py +0 -34
- athena/types/get_datasets_response.py +0 -34
- athena/types/get_snippet_out.py +0 -29
- athena/types/get_snippets_response.py +0 -34
- athena/types/langchain_documents_request_out.py +0 -29
- athena/types/llm_model.py +0 -141
- athena/types/map_reduce_chain_out.py +0 -32
- athena/types/message_out.py +0 -29
- athena/types/message_out_dto.py +0 -35
- athena/types/model.py +0 -93
- athena/types/publish_formats.py +0 -31
- athena/types/query_model.py +0 -40
- athena/types/report.py +0 -32
- athena/types/researcher_out.py +0 -29
- athena/types/semantic_query_out.py +0 -29
- athena/types/snippet.py +0 -35
- athena/types/sql_results.py +0 -29
- athena/types/status_enum.py +0 -29
- athena/types/structured_parse_result.py +0 -29
- athena/types/time_dimension_model.py +0 -33
- athena/types/tools.py +0 -57
- athena/types/upload_documents_out.py +0 -31
- athena/types/url_result.py +0 -29
- athena/types/workflow_status_out.py +0 -31
- athena/upload/__init__.py +0 -2
- athena/upload/client.py +0 -108
- athena/workflow/__init__.py +0 -2
- athena/workflow/client.py +0 -117
- athena_intelligence-0.1.94.dist-info/RECORD +0 -92
- {athena_intelligence-0.1.94.dist-info → athena_intelligence-0.1.95.dist-info}/WHEEL +0 -0
athena/types/__init__.py
CHANGED
@@ -1,91 +1,25 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
|
-
from .athena_document_v_2_out import AthenaDocumentV2Out
|
4
|
-
from .convert_pdf_to_sheet_out import ConvertPdfToSheetOut
|
5
3
|
from .data_frame_parsing_error import DataFrameParsingError
|
6
4
|
from .data_frame_request_out import DataFrameRequestOut
|
7
5
|
from .data_frame_request_out_columns_item import DataFrameRequestOutColumnsItem
|
8
6
|
from .data_frame_request_out_data_item_item import DataFrameRequestOutDataItemItem
|
9
7
|
from .data_frame_request_out_index_item import DataFrameRequestOutIndexItem
|
10
8
|
from .data_frame_unknown_format_error import DataFrameUnknownFormatError
|
11
|
-
from .dataset import Dataset
|
12
|
-
from .document import Document
|
13
|
-
from .excecute_tool_first_workflow_out import ExcecuteToolFirstWorkflowOut
|
14
|
-
from .file_data_response import FileDataResponse
|
15
9
|
from .file_fetch_error import FileFetchError
|
16
|
-
from .filter_model import FilterModel
|
17
|
-
from .filter_operator import FilterOperator
|
18
|
-
from .firecrawl_scrape_url_data_reponse_dto import FirecrawlScrapeUrlDataReponseDto
|
19
|
-
from .firecrawl_scrape_url_metadata import FirecrawlScrapeUrlMetadata
|
20
|
-
from .get_datasets_response import GetDatasetsResponse
|
21
|
-
from .get_snippet_out import GetSnippetOut
|
22
|
-
from .get_snippets_response import GetSnippetsResponse
|
23
10
|
from .http_validation_error import HttpValidationError
|
24
|
-
from .langchain_documents_request_out import LangchainDocumentsRequestOut
|
25
|
-
from .llm_model import LlmModel
|
26
|
-
from .map_reduce_chain_out import MapReduceChainOut
|
27
|
-
from .message_out import MessageOut
|
28
|
-
from .message_out_dto import MessageOutDto
|
29
|
-
from .model import Model
|
30
|
-
from .publish_formats import PublishFormats
|
31
|
-
from .query_model import QueryModel
|
32
|
-
from .report import Report
|
33
|
-
from .researcher_out import ResearcherOut
|
34
|
-
from .semantic_query_out import SemanticQueryOut
|
35
|
-
from .snippet import Snippet
|
36
|
-
from .sql_results import SqlResults
|
37
|
-
from .status_enum import StatusEnum
|
38
|
-
from .structured_parse_result import StructuredParseResult
|
39
|
-
from .time_dimension_model import TimeDimensionModel
|
40
|
-
from .tools import Tools
|
41
|
-
from .upload_documents_out import UploadDocumentsOut
|
42
|
-
from .url_result import UrlResult
|
43
11
|
from .validation_error import ValidationError
|
44
12
|
from .validation_error_loc_item import ValidationErrorLocItem
|
45
|
-
from .workflow_status_out import WorkflowStatusOut
|
46
13
|
|
47
14
|
__all__ = [
|
48
|
-
"AthenaDocumentV2Out",
|
49
|
-
"ConvertPdfToSheetOut",
|
50
15
|
"DataFrameParsingError",
|
51
16
|
"DataFrameRequestOut",
|
52
17
|
"DataFrameRequestOutColumnsItem",
|
53
18
|
"DataFrameRequestOutDataItemItem",
|
54
19
|
"DataFrameRequestOutIndexItem",
|
55
20
|
"DataFrameUnknownFormatError",
|
56
|
-
"Dataset",
|
57
|
-
"Document",
|
58
|
-
"ExcecuteToolFirstWorkflowOut",
|
59
|
-
"FileDataResponse",
|
60
21
|
"FileFetchError",
|
61
|
-
"FilterModel",
|
62
|
-
"FilterOperator",
|
63
|
-
"FirecrawlScrapeUrlDataReponseDto",
|
64
|
-
"FirecrawlScrapeUrlMetadata",
|
65
|
-
"GetDatasetsResponse",
|
66
|
-
"GetSnippetOut",
|
67
|
-
"GetSnippetsResponse",
|
68
22
|
"HttpValidationError",
|
69
|
-
"LangchainDocumentsRequestOut",
|
70
|
-
"LlmModel",
|
71
|
-
"MapReduceChainOut",
|
72
|
-
"MessageOut",
|
73
|
-
"MessageOutDto",
|
74
|
-
"Model",
|
75
|
-
"PublishFormats",
|
76
|
-
"QueryModel",
|
77
|
-
"Report",
|
78
|
-
"ResearcherOut",
|
79
|
-
"SemanticQueryOut",
|
80
|
-
"Snippet",
|
81
|
-
"SqlResults",
|
82
|
-
"StatusEnum",
|
83
|
-
"StructuredParseResult",
|
84
|
-
"TimeDimensionModel",
|
85
|
-
"Tools",
|
86
|
-
"UploadDocumentsOut",
|
87
|
-
"UrlResult",
|
88
23
|
"ValidationError",
|
89
24
|
"ValidationErrorLocItem",
|
90
|
-
"WorkflowStatusOut",
|
91
25
|
]
|
@@ -8,8 +8,8 @@ from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
8
|
|
9
9
|
|
10
10
|
class DataFrameParsingError(pydantic_v1.BaseModel):
|
11
|
-
message: str
|
12
11
|
document_id: str
|
12
|
+
message: str
|
13
13
|
|
14
14
|
def json(self, **kwargs: typing.Any) -> str:
|
15
15
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
@@ -11,9 +11,13 @@ from .data_frame_request_out_index_item import DataFrameRequestOutIndexItem
|
|
11
11
|
|
12
12
|
|
13
13
|
class DataFrameRequestOut(pydantic_v1.BaseModel):
|
14
|
+
"""
|
15
|
+
Response model with JSON dataframe representation.
|
16
|
+
"""
|
17
|
+
|
14
18
|
columns: typing.List[DataFrameRequestOutColumnsItem]
|
15
|
-
index: typing.List[DataFrameRequestOutIndexItem]
|
16
19
|
data: typing.List[typing.List[DataFrameRequestOutDataItemItem]]
|
20
|
+
index: typing.List[DataFrameRequestOutIndexItem]
|
17
21
|
|
18
22
|
def json(self, **kwargs: typing.Any) -> str:
|
19
23
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
@@ -8,9 +8,9 @@ from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
8
|
|
9
9
|
|
10
10
|
class DataFrameUnknownFormatError(pydantic_v1.BaseModel):
|
11
|
-
message: str
|
12
11
|
document_id: str
|
13
12
|
media_type: str
|
13
|
+
message: str
|
14
14
|
|
15
15
|
def json(self, **kwargs: typing.Any) -> str:
|
16
16
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
athena/__init__.py,sha256=Puh6njWEP0yMV514GrJSg2UrY6ojVOboWmoM38a-jeo,1161
|
2
|
+
athena/base_client.py,sha256=KS-PX4GHtkn89PP3IHPcSX54TfyBsFeOSuDn05p9YLc,5238
|
3
|
+
athena/client.py,sha256=SKZjcEFf_-NThIm8WuPUCsBVSlmWPVnVsXEsvJfWK_I,9415
|
4
|
+
athena/core/__init__.py,sha256=UFXpYzcGxWQUucU1TkjOQ9mGWN3A5JohluOIWVYKU4I,973
|
5
|
+
athena/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
6
|
+
athena/core/client_wrapper.py,sha256=UPff8A8yuhnh05jPpibiw4L3_v4Fw6MOLAHAKxiH5Ss,1805
|
7
|
+
athena/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
8
|
+
athena/core/file.py,sha256=sy1RUGZ3aJYuw998bZytxxo6QdgKmlnlgBaMvwEKCGg,1480
|
9
|
+
athena/core/http_client.py,sha256=Z4NuAsJD-51yqmoME17O5sxwx5orSp1wsnd6bPyKcgA,17768
|
10
|
+
athena/core/jsonable_encoder.py,sha256=L6G68Py6gEo8n87rXwlkLPUyzHvXftEBjJZNb2tCuOA,3742
|
11
|
+
athena/core/pydantic_utilities.py,sha256=hI3vcpSG47sVlafyPol2T2ICt8HNMIu_rM9amc2zf7w,748
|
12
|
+
athena/core/query_encoder.py,sha256=sI6XiwFby-WRIk4MVN_5wlAlm30aCHE73Uvm09fb9qQ,1266
|
13
|
+
athena/core/remove_none_from_dict.py,sha256=EU9SGgYidWq7SexuJbNs4-PZ-5Bl3Vppd864mS6vQZw,342
|
14
|
+
athena/core/request_options.py,sha256=-3QoOMMHI2exIyHH6Q2MD7rpo_6w-i6zMAy0nqWTN8c,1420
|
15
|
+
athena/environment.py,sha256=qTOfpg8B5EGqwcJFB4ANkLFn2Y6rsPWGuhU8GRPlFl0,162
|
16
|
+
athena/errors/__init__.py,sha256=0LicWKR1fNQwwL8_ohKhBkxXTD8StFlBYDFG1jPgqOk,405
|
17
|
+
athena/errors/internal_server_error.py,sha256=WEwVqzsfpBTaqZipvse-kvKbW-3NbpXVvuHXs_64U0M,315
|
18
|
+
athena/errors/not_found_error.py,sha256=uBK3JapPPgTkMoSCX9j22C6MDtSuTuSPmjT0lDRigpA,287
|
19
|
+
athena/errors/unprocessable_entity_error.py,sha256=FvR7XPlV3Xx5nu8HNlmLhBRdk4so_gCHjYT5PyZe6sM,313
|
20
|
+
athena/errors/unsupported_media_type_error.py,sha256=fQ7TYQ3QYcT_YzFzO4f8_bLger7UQfZmuF22I9jYxFA,340
|
21
|
+
athena/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
|
+
athena/tools/__init__.py,sha256=3n7oOoMebo06MAQqYRE2CX9Q0fTNnKBYE0cTlh1MPkM,165
|
23
|
+
athena/tools/client.py,sha256=2sBdhdNv-BZqLBgCtlwLFs9uFaM_bhGAGfhW8XWshkY,11028
|
24
|
+
athena/tools/types/__init__.py,sha256=cA-ZQm6veQAP3_vKu9KkZpISsQqgTBN_Z--FGY1c2iA,197
|
25
|
+
athena/tools/types/tools_data_frame_request_columns_item.py,sha256=4rve98HoxzGpDhfEcNwqkH1mUQQXL8vAnX4T04PTTLk,138
|
26
|
+
athena/types/__init__.py,sha256=ZGBn5o7_zVgGVt67H1Ukh8wDknD5M0J0afgZUwggv5s,1022
|
27
|
+
athena/types/data_frame_parsing_error.py,sha256=lECOObzDIziXpsr8fokECZmYYRG_GBtAwA6bwChMwrE,1145
|
28
|
+
athena/types/data_frame_request_out.py,sha256=cm3QgumqJ2bx2sJ2IVedkXPQ97qTu2835MoK0m1UKTg,1594
|
29
|
+
athena/types/data_frame_request_out_columns_item.py,sha256=9cjzciFv6C8n8Griytt_q_8ovkzHViS5tvUcMDfkfKE,143
|
30
|
+
athena/types/data_frame_request_out_data_item_item.py,sha256=KMTJRr-1bdKDNMbUericCliwRoPHLGRV-n2bJtxdRW0,144
|
31
|
+
athena/types/data_frame_request_out_index_item.py,sha256=bW7oe912trpkYKodj-I_AiTXXy61yWzliekcsUZkZE0,141
|
32
|
+
athena/types/data_frame_unknown_format_error.py,sha256=qeWdaMN5cRTS7JGzp0BGCZFo3IWCHtOQ-Fr0CwAO3z0,1171
|
33
|
+
athena/types/file_fetch_error.py,sha256=iR7IXjj2C4lJFcWV3aS2gfhmT3CE-_hhBDSWFaCktHU,1162
|
34
|
+
athena/types/http_validation_error.py,sha256=ZuVHc-T6RFEo7_qBO8DWHa2jGJ6O--tUIZynmLFezsI,1216
|
35
|
+
athena/types/validation_error.py,sha256=zub9I6bl192KHCE8RA0pEkdaEODR3ktTFnZ7E1B7Eco,1235
|
36
|
+
athena/types/validation_error_loc_item.py,sha256=LAtjCHIllWRBFXvAZ5QZpp7CPXjdtN9EB7HrLVo6EP0,128
|
37
|
+
athena/version.py,sha256=8aYAOJtVLaJLpRp6mTiEIhnl8gXA7yE0aDtZ-3mKQ4k,87
|
38
|
+
athena_intelligence-0.1.95.dist-info/METADATA,sha256=TuP2Tv8YY434Zc-KVJAMdSKCe4iPAAFDQ0L2Ylyx1yI,5273
|
39
|
+
athena_intelligence-0.1.95.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
40
|
+
athena_intelligence-0.1.95.dist-info/RECORD,,
|
athena/chain/__init__.py
DELETED
athena/chain/client.py
DELETED
@@ -1,302 +0,0 @@
|
|
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.document import Document
|
12
|
-
from ..types.http_validation_error import HttpValidationError
|
13
|
-
from ..types.llm_model import LlmModel
|
14
|
-
from ..types.map_reduce_chain_out import MapReduceChainOut
|
15
|
-
from ..types.structured_parse_result import StructuredParseResult
|
16
|
-
|
17
|
-
# this is used as the default value for optional parameters
|
18
|
-
OMIT = typing.cast(typing.Any, ...)
|
19
|
-
|
20
|
-
|
21
|
-
class ChainClient:
|
22
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
23
|
-
self._client_wrapper = client_wrapper
|
24
|
-
|
25
|
-
def structured_parse(
|
26
|
-
self,
|
27
|
-
*,
|
28
|
-
text_input: str,
|
29
|
-
custom_type_dict: typing.Dict[str, typing.Any],
|
30
|
-
model: LlmModel,
|
31
|
-
request_options: typing.Optional[RequestOptions] = None
|
32
|
-
) -> StructuredParseResult:
|
33
|
-
"""
|
34
|
-
Parameters
|
35
|
-
----------
|
36
|
-
text_input : str
|
37
|
-
The text input to be parsed.
|
38
|
-
|
39
|
-
custom_type_dict : typing.Dict[str, typing.Any]
|
40
|
-
A dictionary of field names and their default values.
|
41
|
-
|
42
|
-
model : LlmModel
|
43
|
-
|
44
|
-
request_options : typing.Optional[RequestOptions]
|
45
|
-
Request-specific configuration.
|
46
|
-
|
47
|
-
Returns
|
48
|
-
-------
|
49
|
-
StructuredParseResult
|
50
|
-
Successful Response
|
51
|
-
|
52
|
-
Examples
|
53
|
-
--------
|
54
|
-
from athena import LlmModel
|
55
|
-
from athena.client import Athena
|
56
|
-
|
57
|
-
client = Athena(
|
58
|
-
api_key="YOUR_API_KEY",
|
59
|
-
)
|
60
|
-
client.chain.structured_parse(
|
61
|
-
text_input='Athena is an AI-native analytics platform and artificial employee built to accelerate analytics workflows\n by offering enterprise teams co-pilot and auto-pilot modes. Athena learns your workflow as a co-pilot,\n allowing you to hand over controls to her for autonomous execution with confidence."\n\n Give me all of the modes Athena provides.',
|
62
|
-
custom_type_dict={},
|
63
|
-
model=LlmModel.GPT_4_TURBO,
|
64
|
-
)
|
65
|
-
"""
|
66
|
-
_response = self._client_wrapper.httpx_client.request(
|
67
|
-
"api/v0/structured-parse",
|
68
|
-
method="POST",
|
69
|
-
json={"text_input": text_input, "custom_type_dict": custom_type_dict, "model": model},
|
70
|
-
request_options=request_options,
|
71
|
-
omit=OMIT,
|
72
|
-
)
|
73
|
-
if 200 <= _response.status_code < 300:
|
74
|
-
return pydantic_v1.parse_obj_as(StructuredParseResult, _response.json()) # type: ignore
|
75
|
-
if _response.status_code == 422:
|
76
|
-
raise UnprocessableEntityError(
|
77
|
-
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
78
|
-
)
|
79
|
-
try:
|
80
|
-
_response_json = _response.json()
|
81
|
-
except JSONDecodeError:
|
82
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
83
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
84
|
-
|
85
|
-
def map_reduce_chain(
|
86
|
-
self,
|
87
|
-
*,
|
88
|
-
documents: typing.Sequence[Document],
|
89
|
-
model: LlmModel,
|
90
|
-
operator_prompt: str,
|
91
|
-
reducer_prompt: str,
|
92
|
-
input: str,
|
93
|
-
request_options: typing.Optional[RequestOptions] = None
|
94
|
-
) -> MapReduceChainOut:
|
95
|
-
"""
|
96
|
-
Parameters
|
97
|
-
----------
|
98
|
-
documents : typing.Sequence[Document]
|
99
|
-
|
100
|
-
model : LlmModel
|
101
|
-
|
102
|
-
operator_prompt : str
|
103
|
-
|
104
|
-
reducer_prompt : str
|
105
|
-
|
106
|
-
input : str
|
107
|
-
|
108
|
-
request_options : typing.Optional[RequestOptions]
|
109
|
-
Request-specific configuration.
|
110
|
-
|
111
|
-
Returns
|
112
|
-
-------
|
113
|
-
MapReduceChainOut
|
114
|
-
Successful Response
|
115
|
-
|
116
|
-
Examples
|
117
|
-
--------
|
118
|
-
from athena import Document, LlmModel
|
119
|
-
from athena.client import Athena
|
120
|
-
|
121
|
-
client = Athena(
|
122
|
-
api_key="YOUR_API_KEY",
|
123
|
-
)
|
124
|
-
client.chain.map_reduce_chain(
|
125
|
-
documents=[
|
126
|
-
Document(
|
127
|
-
metadata={"key": "value"},
|
128
|
-
page_content="Athena is an AI-native analytics platform and artificial employee built to accelerate analytics workflows by offering enterprise teams co-pilot and auto-pilot modes. Athena learns your workflow as a co-pilot, allowing you to hand over controls to her for autonomous execution with confidence.",
|
129
|
-
)
|
130
|
-
],
|
131
|
-
model=LlmModel.MISTRAL_LARGE_0224,
|
132
|
-
operator_prompt="summarize the content",
|
133
|
-
reducer_prompt="Combine these summaries",
|
134
|
-
input="return a summary in a single sentence",
|
135
|
-
)
|
136
|
-
"""
|
137
|
-
_response = self._client_wrapper.httpx_client.request(
|
138
|
-
"api/v0/tools/map-reduce",
|
139
|
-
method="POST",
|
140
|
-
json={
|
141
|
-
"documents": documents,
|
142
|
-
"model": model,
|
143
|
-
"operator_prompt": operator_prompt,
|
144
|
-
"reducer_prompt": reducer_prompt,
|
145
|
-
"input": input,
|
146
|
-
},
|
147
|
-
request_options=request_options,
|
148
|
-
omit=OMIT,
|
149
|
-
)
|
150
|
-
if 200 <= _response.status_code < 300:
|
151
|
-
return pydantic_v1.parse_obj_as(MapReduceChainOut, _response.json()) # type: ignore
|
152
|
-
if _response.status_code == 422:
|
153
|
-
raise UnprocessableEntityError(
|
154
|
-
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
155
|
-
)
|
156
|
-
try:
|
157
|
-
_response_json = _response.json()
|
158
|
-
except JSONDecodeError:
|
159
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
160
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
161
|
-
|
162
|
-
|
163
|
-
class AsyncChainClient:
|
164
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
165
|
-
self._client_wrapper = client_wrapper
|
166
|
-
|
167
|
-
async def structured_parse(
|
168
|
-
self,
|
169
|
-
*,
|
170
|
-
text_input: str,
|
171
|
-
custom_type_dict: typing.Dict[str, typing.Any],
|
172
|
-
model: LlmModel,
|
173
|
-
request_options: typing.Optional[RequestOptions] = None
|
174
|
-
) -> StructuredParseResult:
|
175
|
-
"""
|
176
|
-
Parameters
|
177
|
-
----------
|
178
|
-
text_input : str
|
179
|
-
The text input to be parsed.
|
180
|
-
|
181
|
-
custom_type_dict : typing.Dict[str, typing.Any]
|
182
|
-
A dictionary of field names and their default values.
|
183
|
-
|
184
|
-
model : LlmModel
|
185
|
-
|
186
|
-
request_options : typing.Optional[RequestOptions]
|
187
|
-
Request-specific configuration.
|
188
|
-
|
189
|
-
Returns
|
190
|
-
-------
|
191
|
-
StructuredParseResult
|
192
|
-
Successful Response
|
193
|
-
|
194
|
-
Examples
|
195
|
-
--------
|
196
|
-
from athena import LlmModel
|
197
|
-
from athena.client import AsyncAthena
|
198
|
-
|
199
|
-
client = AsyncAthena(
|
200
|
-
api_key="YOUR_API_KEY",
|
201
|
-
)
|
202
|
-
await client.chain.structured_parse(
|
203
|
-
text_input='Athena is an AI-native analytics platform and artificial employee built to accelerate analytics workflows\n by offering enterprise teams co-pilot and auto-pilot modes. Athena learns your workflow as a co-pilot,\n allowing you to hand over controls to her for autonomous execution with confidence."\n\n Give me all of the modes Athena provides.',
|
204
|
-
custom_type_dict={},
|
205
|
-
model=LlmModel.GPT_4_TURBO,
|
206
|
-
)
|
207
|
-
"""
|
208
|
-
_response = await self._client_wrapper.httpx_client.request(
|
209
|
-
"api/v0/structured-parse",
|
210
|
-
method="POST",
|
211
|
-
json={"text_input": text_input, "custom_type_dict": custom_type_dict, "model": model},
|
212
|
-
request_options=request_options,
|
213
|
-
omit=OMIT,
|
214
|
-
)
|
215
|
-
if 200 <= _response.status_code < 300:
|
216
|
-
return pydantic_v1.parse_obj_as(StructuredParseResult, _response.json()) # type: ignore
|
217
|
-
if _response.status_code == 422:
|
218
|
-
raise UnprocessableEntityError(
|
219
|
-
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
220
|
-
)
|
221
|
-
try:
|
222
|
-
_response_json = _response.json()
|
223
|
-
except JSONDecodeError:
|
224
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
225
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
226
|
-
|
227
|
-
async def map_reduce_chain(
|
228
|
-
self,
|
229
|
-
*,
|
230
|
-
documents: typing.Sequence[Document],
|
231
|
-
model: LlmModel,
|
232
|
-
operator_prompt: str,
|
233
|
-
reducer_prompt: str,
|
234
|
-
input: str,
|
235
|
-
request_options: typing.Optional[RequestOptions] = None
|
236
|
-
) -> MapReduceChainOut:
|
237
|
-
"""
|
238
|
-
Parameters
|
239
|
-
----------
|
240
|
-
documents : typing.Sequence[Document]
|
241
|
-
|
242
|
-
model : LlmModel
|
243
|
-
|
244
|
-
operator_prompt : str
|
245
|
-
|
246
|
-
reducer_prompt : str
|
247
|
-
|
248
|
-
input : str
|
249
|
-
|
250
|
-
request_options : typing.Optional[RequestOptions]
|
251
|
-
Request-specific configuration.
|
252
|
-
|
253
|
-
Returns
|
254
|
-
-------
|
255
|
-
MapReduceChainOut
|
256
|
-
Successful Response
|
257
|
-
|
258
|
-
Examples
|
259
|
-
--------
|
260
|
-
from athena import Document, LlmModel
|
261
|
-
from athena.client import AsyncAthena
|
262
|
-
|
263
|
-
client = AsyncAthena(
|
264
|
-
api_key="YOUR_API_KEY",
|
265
|
-
)
|
266
|
-
await client.chain.map_reduce_chain(
|
267
|
-
documents=[
|
268
|
-
Document(
|
269
|
-
metadata={"key": "value"},
|
270
|
-
page_content="Athena is an AI-native analytics platform and artificial employee built to accelerate analytics workflows by offering enterprise teams co-pilot and auto-pilot modes. Athena learns your workflow as a co-pilot, allowing you to hand over controls to her for autonomous execution with confidence.",
|
271
|
-
)
|
272
|
-
],
|
273
|
-
model=LlmModel.MISTRAL_LARGE_0224,
|
274
|
-
operator_prompt="summarize the content",
|
275
|
-
reducer_prompt="Combine these summaries",
|
276
|
-
input="return a summary in a single sentence",
|
277
|
-
)
|
278
|
-
"""
|
279
|
-
_response = await self._client_wrapper.httpx_client.request(
|
280
|
-
"api/v0/tools/map-reduce",
|
281
|
-
method="POST",
|
282
|
-
json={
|
283
|
-
"documents": documents,
|
284
|
-
"model": model,
|
285
|
-
"operator_prompt": operator_prompt,
|
286
|
-
"reducer_prompt": reducer_prompt,
|
287
|
-
"input": input,
|
288
|
-
},
|
289
|
-
request_options=request_options,
|
290
|
-
omit=OMIT,
|
291
|
-
)
|
292
|
-
if 200 <= _response.status_code < 300:
|
293
|
-
return pydantic_v1.parse_obj_as(MapReduceChainOut, _response.json()) # type: ignore
|
294
|
-
if _response.status_code == 422:
|
295
|
-
raise UnprocessableEntityError(
|
296
|
-
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
297
|
-
)
|
298
|
-
try:
|
299
|
-
_response_json = _response.json()
|
300
|
-
except JSONDecodeError:
|
301
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
302
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
athena/dataset/__init__.py
DELETED
athena/dataset/client.py
DELETED
@@ -1,124 +0,0 @@
|
|
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.get_datasets_response import GetDatasetsResponse
|
12
|
-
from ..types.http_validation_error import HttpValidationError
|
13
|
-
|
14
|
-
|
15
|
-
class DatasetClient:
|
16
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
17
|
-
self._client_wrapper = client_wrapper
|
18
|
-
|
19
|
-
def get(
|
20
|
-
self,
|
21
|
-
*,
|
22
|
-
page: typing.Optional[int] = None,
|
23
|
-
page_size: typing.Optional[int] = None,
|
24
|
-
request_options: typing.Optional[RequestOptions] = None
|
25
|
-
) -> GetDatasetsResponse:
|
26
|
-
"""
|
27
|
-
Parameters
|
28
|
-
----------
|
29
|
-
page : typing.Optional[int]
|
30
|
-
Page number starting from 1
|
31
|
-
|
32
|
-
page_size : typing.Optional[int]
|
33
|
-
Number of items per page
|
34
|
-
|
35
|
-
request_options : typing.Optional[RequestOptions]
|
36
|
-
Request-specific configuration.
|
37
|
-
|
38
|
-
Returns
|
39
|
-
-------
|
40
|
-
GetDatasetsResponse
|
41
|
-
Successful Response
|
42
|
-
|
43
|
-
Examples
|
44
|
-
--------
|
45
|
-
from athena.client import Athena
|
46
|
-
|
47
|
-
client = Athena(
|
48
|
-
api_key="YOUR_API_KEY",
|
49
|
-
)
|
50
|
-
client.dataset.get()
|
51
|
-
"""
|
52
|
-
_response = self._client_wrapper.httpx_client.request(
|
53
|
-
"api/v0/datasets",
|
54
|
-
method="GET",
|
55
|
-
params={"page": page, "page_size": page_size},
|
56
|
-
request_options=request_options,
|
57
|
-
)
|
58
|
-
if 200 <= _response.status_code < 300:
|
59
|
-
return pydantic_v1.parse_obj_as(GetDatasetsResponse, _response.json()) # type: ignore
|
60
|
-
if _response.status_code == 422:
|
61
|
-
raise UnprocessableEntityError(
|
62
|
-
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
63
|
-
)
|
64
|
-
try:
|
65
|
-
_response_json = _response.json()
|
66
|
-
except JSONDecodeError:
|
67
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
68
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
69
|
-
|
70
|
-
|
71
|
-
class AsyncDatasetClient:
|
72
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
73
|
-
self._client_wrapper = client_wrapper
|
74
|
-
|
75
|
-
async def get(
|
76
|
-
self,
|
77
|
-
*,
|
78
|
-
page: typing.Optional[int] = None,
|
79
|
-
page_size: typing.Optional[int] = None,
|
80
|
-
request_options: typing.Optional[RequestOptions] = None
|
81
|
-
) -> GetDatasetsResponse:
|
82
|
-
"""
|
83
|
-
Parameters
|
84
|
-
----------
|
85
|
-
page : typing.Optional[int]
|
86
|
-
Page number starting from 1
|
87
|
-
|
88
|
-
page_size : typing.Optional[int]
|
89
|
-
Number of items per page
|
90
|
-
|
91
|
-
request_options : typing.Optional[RequestOptions]
|
92
|
-
Request-specific configuration.
|
93
|
-
|
94
|
-
Returns
|
95
|
-
-------
|
96
|
-
GetDatasetsResponse
|
97
|
-
Successful Response
|
98
|
-
|
99
|
-
Examples
|
100
|
-
--------
|
101
|
-
from athena.client import AsyncAthena
|
102
|
-
|
103
|
-
client = AsyncAthena(
|
104
|
-
api_key="YOUR_API_KEY",
|
105
|
-
)
|
106
|
-
await client.dataset.get()
|
107
|
-
"""
|
108
|
-
_response = await self._client_wrapper.httpx_client.request(
|
109
|
-
"api/v0/datasets",
|
110
|
-
method="GET",
|
111
|
-
params={"page": page, "page_size": page_size},
|
112
|
-
request_options=request_options,
|
113
|
-
)
|
114
|
-
if 200 <= _response.status_code < 300:
|
115
|
-
return pydantic_v1.parse_obj_as(GetDatasetsResponse, _response.json()) # type: ignore
|
116
|
-
if _response.status_code == 422:
|
117
|
-
raise UnprocessableEntityError(
|
118
|
-
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
119
|
-
)
|
120
|
-
try:
|
121
|
-
_response_json = _response.json()
|
122
|
-
except JSONDecodeError:
|
123
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
124
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
athena/message/__init__.py
DELETED