athena-intelligence 0.1.39__tar.gz → 0.1.41__tar.gz
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_intelligence-0.1.39 → athena_intelligence-0.1.41}/PKG-INFO +1 -1
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/pyproject.toml +1 -1
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/__init__.py +17 -3
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/base_client.py +6 -0
- athena_intelligence-0.1.41/src/athena/chain/__init__.py +5 -0
- athena_intelligence-0.1.41/src/athena/chain/client.py +167 -0
- athena_intelligence-0.1.41/src/athena/chain/types/__init__.py +5 -0
- athena_intelligence-0.1.41/src/athena/chain/types/structured_parse_in_parsing_model.py +53 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/core/client_wrapper.py +1 -1
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/search/client.py +8 -117
- athena_intelligence-0.1.41/src/athena/tools/__init__.py +2 -0
- athena_intelligence-0.1.41/src/athena/tools/client.py +444 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/__init__.py +12 -2
- athena_intelligence-0.1.41/src/athena/types/document.py +34 -0
- athena_intelligence-0.1.39/src/athena/types/scrape_markdown_result.py → athena_intelligence-0.1.41/src/athena/types/excecute_tool_first_workflow_out.py +2 -2
- athena_intelligence-0.1.41/src/athena/types/firecrawl_scrape_url_data_reponse_dto.py +31 -0
- athena_intelligence-0.1.41/src/athena/types/firecrawl_scrape_url_metadata.py +32 -0
- athena_intelligence-0.1.41/src/athena/types/langchain_documents_request_out.py +29 -0
- athena_intelligence-0.1.41/src/athena/types/structured_parse_result.py +28 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/README.md +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/client.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/core/__init__.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/core/api_error.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/core/datetime_utils.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/core/file.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/core/http_client.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/core/jsonable_encoder.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/core/remove_none_from_dict.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/core/request_options.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/dataset/__init__.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/dataset/client.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/environment.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/errors/__init__.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/errors/unprocessable_entity_error.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/message/__init__.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/message/client.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/polling_message_client.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/py.typed +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/query/__init__.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/query/client.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/report/__init__.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/report/client.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/search/__init__.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/snippet/__init__.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/snippet/client.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/dataset.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/get_datasets_response.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/get_snippets_response.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/http_validation_error.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/message_out.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/message_out_dto.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/model.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/report.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/snippet.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/sql_results.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/status_enum.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/tools.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/url_result.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/validation_error.py +0 -0
- {athena_intelligence-0.1.39 → athena_intelligence-0.1.41}/src/athena/types/validation_error_loc_item.py +0 -0
@@ -2,49 +2,63 @@
|
|
2
2
|
|
3
3
|
from .types import (
|
4
4
|
Dataset,
|
5
|
+
Document,
|
6
|
+
ExcecuteToolFirstWorkflowOut,
|
7
|
+
FirecrawlScrapeUrlDataReponseDto,
|
8
|
+
FirecrawlScrapeUrlMetadata,
|
5
9
|
GetDatasetsResponse,
|
6
10
|
GetSnippetsResponse,
|
7
11
|
HttpValidationError,
|
12
|
+
LangchainDocumentsRequestOut,
|
8
13
|
MessageOut,
|
9
14
|
MessageOutDto,
|
10
15
|
Model,
|
11
16
|
Report,
|
12
|
-
ScrapeMarkdownResult,
|
13
17
|
Snippet,
|
14
18
|
SqlResults,
|
15
19
|
StatusEnum,
|
20
|
+
StructuredParseResult,
|
16
21
|
Tools,
|
17
22
|
UrlResult,
|
18
23
|
ValidationError,
|
19
24
|
ValidationErrorLocItem,
|
20
25
|
)
|
21
26
|
from .errors import UnprocessableEntityError
|
22
|
-
from . import dataset, message, query, report, search, snippet
|
27
|
+
from . import chain, dataset, message, query, report, search, snippet, tools
|
28
|
+
from .chain import StructuredParseInParsingModel
|
23
29
|
from .environment import AthenaEnvironment
|
24
30
|
|
25
31
|
__all__ = [
|
26
32
|
"AthenaEnvironment",
|
27
33
|
"Dataset",
|
34
|
+
"Document",
|
35
|
+
"ExcecuteToolFirstWorkflowOut",
|
36
|
+
"FirecrawlScrapeUrlDataReponseDto",
|
37
|
+
"FirecrawlScrapeUrlMetadata",
|
28
38
|
"GetDatasetsResponse",
|
29
39
|
"GetSnippetsResponse",
|
30
40
|
"HttpValidationError",
|
41
|
+
"LangchainDocumentsRequestOut",
|
31
42
|
"MessageOut",
|
32
43
|
"MessageOutDto",
|
33
44
|
"Model",
|
34
45
|
"Report",
|
35
|
-
"ScrapeMarkdownResult",
|
36
46
|
"Snippet",
|
37
47
|
"SqlResults",
|
38
48
|
"StatusEnum",
|
49
|
+
"StructuredParseInParsingModel",
|
50
|
+
"StructuredParseResult",
|
39
51
|
"Tools",
|
40
52
|
"UnprocessableEntityError",
|
41
53
|
"UrlResult",
|
42
54
|
"ValidationError",
|
43
55
|
"ValidationErrorLocItem",
|
56
|
+
"chain",
|
44
57
|
"dataset",
|
45
58
|
"message",
|
46
59
|
"query",
|
47
60
|
"report",
|
48
61
|
"search",
|
49
62
|
"snippet",
|
63
|
+
"tools",
|
50
64
|
]
|
@@ -4,6 +4,7 @@ import typing
|
|
4
4
|
|
5
5
|
import httpx
|
6
6
|
|
7
|
+
from .chain.client import AsyncChainClient, ChainClient
|
7
8
|
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
8
9
|
from .dataset.client import AsyncDatasetClient, DatasetClient
|
9
10
|
from .environment import AthenaEnvironment
|
@@ -12,6 +13,7 @@ from .query.client import AsyncQueryClient, QueryClient
|
|
12
13
|
from .report.client import AsyncReportClient, ReportClient
|
13
14
|
from .search.client import AsyncSearchClient, SearchClient
|
14
15
|
from .snippet.client import AsyncSnippetClient, SnippetClient
|
16
|
+
from .tools.client import AsyncToolsClient, ToolsClient
|
15
17
|
|
16
18
|
|
17
19
|
class BaseAthena:
|
@@ -58,6 +60,8 @@ class BaseAthena:
|
|
58
60
|
self.report = ReportClient(client_wrapper=self._client_wrapper)
|
59
61
|
self.query = QueryClient(client_wrapper=self._client_wrapper)
|
60
62
|
self.search = SearchClient(client_wrapper=self._client_wrapper)
|
63
|
+
self.chain = ChainClient(client_wrapper=self._client_wrapper)
|
64
|
+
self.tools = ToolsClient(client_wrapper=self._client_wrapper)
|
61
65
|
|
62
66
|
|
63
67
|
class AsyncBaseAthena:
|
@@ -104,6 +108,8 @@ class AsyncBaseAthena:
|
|
104
108
|
self.report = AsyncReportClient(client_wrapper=self._client_wrapper)
|
105
109
|
self.query = AsyncQueryClient(client_wrapper=self._client_wrapper)
|
106
110
|
self.search = AsyncSearchClient(client_wrapper=self._client_wrapper)
|
111
|
+
self.chain = AsyncChainClient(client_wrapper=self._client_wrapper)
|
112
|
+
self.tools = AsyncToolsClient(client_wrapper=self._client_wrapper)
|
107
113
|
|
108
114
|
|
109
115
|
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: AthenaEnvironment) -> str:
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
import urllib.parse
|
5
|
+
from json.decoder import JSONDecodeError
|
6
|
+
|
7
|
+
from ..core.api_error import ApiError
|
8
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
10
|
+
from ..core.remove_none_from_dict import remove_none_from_dict
|
11
|
+
from ..core.request_options import RequestOptions
|
12
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
13
|
+
from ..types.http_validation_error import HttpValidationError
|
14
|
+
from ..types.structured_parse_result import StructuredParseResult
|
15
|
+
from .types.structured_parse_in_parsing_model import StructuredParseInParsingModel
|
16
|
+
|
17
|
+
try:
|
18
|
+
import pydantic.v1 as pydantic # type: ignore
|
19
|
+
except ImportError:
|
20
|
+
import pydantic # type: ignore
|
21
|
+
|
22
|
+
# this is used as the default value for optional parameters
|
23
|
+
OMIT = typing.cast(typing.Any, ...)
|
24
|
+
|
25
|
+
|
26
|
+
class ChainClient:
|
27
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
28
|
+
self._client_wrapper = client_wrapper
|
29
|
+
|
30
|
+
def structured_parse(
|
31
|
+
self,
|
32
|
+
*,
|
33
|
+
text_input: str,
|
34
|
+
custom_type_dict: typing.Dict[str, typing.Any],
|
35
|
+
parsing_model: typing.Optional[StructuredParseInParsingModel] = OMIT,
|
36
|
+
request_options: typing.Optional[RequestOptions] = None,
|
37
|
+
) -> StructuredParseResult:
|
38
|
+
"""
|
39
|
+
Parameters:
|
40
|
+
- text_input: str. The text input to be parsed.
|
41
|
+
|
42
|
+
- custom_type_dict: typing.Dict[str, typing.Any]. A dictionary of field names and their default values.
|
43
|
+
|
44
|
+
- parsing_model: typing.Optional[StructuredParseInParsingModel]. The model to be used for parsing.
|
45
|
+
|
46
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
47
|
+
---
|
48
|
+
from athena import StructuredParseInParsingModel
|
49
|
+
from athena.client import Athena
|
50
|
+
|
51
|
+
client = Athena(api_key="YOUR_API_KEY", )
|
52
|
+
client.chain.structured_parse(text_input='Athena is an AI-native analytics platform and artificial employee built to accelerate analytics workflows
|
53
|
+
by offering enterprise teams co-pilot and auto-pilot modes. Athena learns your workflow as a co-pilot,
|
54
|
+
allowing you to hand over controls to her for autonomous execution with confidence."
|
55
|
+
|
56
|
+
Give me all of the modes Athena provides.', custom_type_dict={"modes": {}}, parsing_model=StructuredParseInParsingModel.GPT_4_TURBO, )
|
57
|
+
"""
|
58
|
+
_request: typing.Dict[str, typing.Any] = {"text_input": text_input, "custom_type_dict": custom_type_dict}
|
59
|
+
if parsing_model is not OMIT:
|
60
|
+
_request["parsing_model"] = parsing_model
|
61
|
+
_response = self._client_wrapper.httpx_client.request(
|
62
|
+
"POST",
|
63
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/structured-parse"),
|
64
|
+
params=jsonable_encoder(
|
65
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
66
|
+
),
|
67
|
+
json=jsonable_encoder(_request)
|
68
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
69
|
+
else {
|
70
|
+
**jsonable_encoder(_request),
|
71
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
72
|
+
},
|
73
|
+
headers=jsonable_encoder(
|
74
|
+
remove_none_from_dict(
|
75
|
+
{
|
76
|
+
**self._client_wrapper.get_headers(),
|
77
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
78
|
+
}
|
79
|
+
)
|
80
|
+
),
|
81
|
+
timeout=request_options.get("timeout_in_seconds")
|
82
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
83
|
+
else 60,
|
84
|
+
retries=0,
|
85
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
86
|
+
)
|
87
|
+
if 200 <= _response.status_code < 300:
|
88
|
+
return pydantic.parse_obj_as(StructuredParseResult, _response.json()) # type: ignore
|
89
|
+
if _response.status_code == 422:
|
90
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
91
|
+
try:
|
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)
|
96
|
+
|
97
|
+
|
98
|
+
class AsyncChainClient:
|
99
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
100
|
+
self._client_wrapper = client_wrapper
|
101
|
+
|
102
|
+
async def structured_parse(
|
103
|
+
self,
|
104
|
+
*,
|
105
|
+
text_input: str,
|
106
|
+
custom_type_dict: typing.Dict[str, typing.Any],
|
107
|
+
parsing_model: typing.Optional[StructuredParseInParsingModel] = OMIT,
|
108
|
+
request_options: typing.Optional[RequestOptions] = None,
|
109
|
+
) -> StructuredParseResult:
|
110
|
+
"""
|
111
|
+
Parameters:
|
112
|
+
- text_input: str. The text input to be parsed.
|
113
|
+
|
114
|
+
- custom_type_dict: typing.Dict[str, typing.Any]. A dictionary of field names and their default values.
|
115
|
+
|
116
|
+
- parsing_model: typing.Optional[StructuredParseInParsingModel]. The model to be used for parsing.
|
117
|
+
|
118
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
119
|
+
---
|
120
|
+
from athena import StructuredParseInParsingModel
|
121
|
+
from athena.client import AsyncAthena
|
122
|
+
|
123
|
+
client = AsyncAthena(api_key="YOUR_API_KEY", )
|
124
|
+
await client.chain.structured_parse(text_input='Athena is an AI-native analytics platform and artificial employee built to accelerate analytics workflows
|
125
|
+
by offering enterprise teams co-pilot and auto-pilot modes. Athena learns your workflow as a co-pilot,
|
126
|
+
allowing you to hand over controls to her for autonomous execution with confidence."
|
127
|
+
|
128
|
+
Give me all of the modes Athena provides.', custom_type_dict={"modes": {}}, parsing_model=StructuredParseInParsingModel.GPT_4_TURBO, )
|
129
|
+
"""
|
130
|
+
_request: typing.Dict[str, typing.Any] = {"text_input": text_input, "custom_type_dict": custom_type_dict}
|
131
|
+
if parsing_model is not OMIT:
|
132
|
+
_request["parsing_model"] = parsing_model
|
133
|
+
_response = await self._client_wrapper.httpx_client.request(
|
134
|
+
"POST",
|
135
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/structured-parse"),
|
136
|
+
params=jsonable_encoder(
|
137
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
138
|
+
),
|
139
|
+
json=jsonable_encoder(_request)
|
140
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
141
|
+
else {
|
142
|
+
**jsonable_encoder(_request),
|
143
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
144
|
+
},
|
145
|
+
headers=jsonable_encoder(
|
146
|
+
remove_none_from_dict(
|
147
|
+
{
|
148
|
+
**self._client_wrapper.get_headers(),
|
149
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
150
|
+
}
|
151
|
+
)
|
152
|
+
),
|
153
|
+
timeout=request_options.get("timeout_in_seconds")
|
154
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
155
|
+
else 60,
|
156
|
+
retries=0,
|
157
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
158
|
+
)
|
159
|
+
if 200 <= _response.status_code < 300:
|
160
|
+
return pydantic.parse_obj_as(StructuredParseResult, _response.json()) # type: ignore
|
161
|
+
if _response.status_code == 422:
|
162
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
163
|
+
try:
|
164
|
+
_response_json = _response.json()
|
165
|
+
except JSONDecodeError:
|
166
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
167
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import enum
|
4
|
+
import typing
|
5
|
+
|
6
|
+
T_Result = typing.TypeVar("T_Result")
|
7
|
+
|
8
|
+
|
9
|
+
class StructuredParseInParsingModel(str, enum.Enum):
|
10
|
+
"""
|
11
|
+
The model to be used for parsing.
|
12
|
+
"""
|
13
|
+
|
14
|
+
GPT_4_TURBO = "gpt-4-turbo"
|
15
|
+
GPT_4_TURBO_PREVIEW = "gpt-4-turbo-preview"
|
16
|
+
GPT_4 = "gpt-4"
|
17
|
+
GPT_35_TURBO = "gpt-3.5-turbo"
|
18
|
+
MIXTRAL_SMALL_8_X_7_B_0211 = "mixtral-small-8x7b-0211"
|
19
|
+
MISTRAL_LARGE_0224 = "mistral-large-0224"
|
20
|
+
CLAUDE_3_OPUS_20240229 = "claude-3-opus-20240229"
|
21
|
+
CLAUDE_3_SONNET_20240229 = "claude-3-sonnet-20240229"
|
22
|
+
CLAUDE_3_HAIKU_20240307 = "claude-3-haiku-20240307"
|
23
|
+
|
24
|
+
def visit(
|
25
|
+
self,
|
26
|
+
gpt_4_turbo: typing.Callable[[], T_Result],
|
27
|
+
gpt_4_turbo_preview: typing.Callable[[], T_Result],
|
28
|
+
gpt_4: typing.Callable[[], T_Result],
|
29
|
+
gpt_35_turbo: typing.Callable[[], T_Result],
|
30
|
+
mixtral_small_8_x_7_b_0211: typing.Callable[[], T_Result],
|
31
|
+
mistral_large_0224: typing.Callable[[], T_Result],
|
32
|
+
claude_3_opus_20240229: typing.Callable[[], T_Result],
|
33
|
+
claude_3_sonnet_20240229: typing.Callable[[], T_Result],
|
34
|
+
claude_3_haiku_20240307: typing.Callable[[], T_Result],
|
35
|
+
) -> T_Result:
|
36
|
+
if self is StructuredParseInParsingModel.GPT_4_TURBO:
|
37
|
+
return gpt_4_turbo()
|
38
|
+
if self is StructuredParseInParsingModel.GPT_4_TURBO_PREVIEW:
|
39
|
+
return gpt_4_turbo_preview()
|
40
|
+
if self is StructuredParseInParsingModel.GPT_4:
|
41
|
+
return gpt_4()
|
42
|
+
if self is StructuredParseInParsingModel.GPT_35_TURBO:
|
43
|
+
return gpt_35_turbo()
|
44
|
+
if self is StructuredParseInParsingModel.MIXTRAL_SMALL_8_X_7_B_0211:
|
45
|
+
return mixtral_small_8_x_7_b_0211()
|
46
|
+
if self is StructuredParseInParsingModel.MISTRAL_LARGE_0224:
|
47
|
+
return mistral_large_0224()
|
48
|
+
if self is StructuredParseInParsingModel.CLAUDE_3_OPUS_20240229:
|
49
|
+
return claude_3_opus_20240229()
|
50
|
+
if self is StructuredParseInParsingModel.CLAUDE_3_SONNET_20240229:
|
51
|
+
return claude_3_sonnet_20240229()
|
52
|
+
if self is StructuredParseInParsingModel.CLAUDE_3_HAIKU_20240307:
|
53
|
+
return claude_3_haiku_20240307()
|
@@ -16,7 +16,7 @@ class BaseClientWrapper:
|
|
16
16
|
headers: typing.Dict[str, str] = {
|
17
17
|
"X-Fern-Language": "Python",
|
18
18
|
"X-Fern-SDK-Name": "athena-intelligence",
|
19
|
-
"X-Fern-SDK-Version": "0.1.
|
19
|
+
"X-Fern-SDK-Version": "0.1.41",
|
20
20
|
}
|
21
21
|
headers["X-API-KEY"] = self.api_key
|
22
22
|
return headers
|
@@ -11,7 +11,6 @@ from ..core.remove_none_from_dict import remove_none_from_dict
|
|
11
11
|
from ..core.request_options import RequestOptions
|
12
12
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
13
13
|
from ..types.http_validation_error import HttpValidationError
|
14
|
-
from ..types.scrape_markdown_result import ScrapeMarkdownResult
|
15
14
|
from ..types.url_result import UrlResult
|
16
15
|
|
17
16
|
try:
|
@@ -60,9 +59,9 @@ class SearchClient:
|
|
60
59
|
api_key="YOUR_API_KEY",
|
61
60
|
)
|
62
61
|
client.search.get_urls(
|
63
|
-
query="
|
64
|
-
num_urls=
|
65
|
-
tbs="
|
62
|
+
query="Dogs",
|
63
|
+
num_urls=10,
|
64
|
+
tbs="qdr:m",
|
66
65
|
)
|
67
66
|
"""
|
68
67
|
_request: typing.Dict[str, typing.Any] = {"query": query, "num_urls": num_urls, "tbs": tbs}
|
@@ -74,7 +73,7 @@ class SearchClient:
|
|
74
73
|
_request["site"] = site
|
75
74
|
_response = self._client_wrapper.httpx_client.request(
|
76
75
|
"POST",
|
77
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/get-urls"),
|
76
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/search/get-urls"),
|
78
77
|
params=jsonable_encoder(
|
79
78
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
80
79
|
),
|
@@ -108,60 +107,6 @@ class SearchClient:
|
|
108
107
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
109
108
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
110
109
|
|
111
|
-
def get_markdown(
|
112
|
-
self, *, url: str, request_options: typing.Optional[RequestOptions] = None
|
113
|
-
) -> ScrapeMarkdownResult:
|
114
|
-
"""
|
115
|
-
Parameters:
|
116
|
-
- url: str.
|
117
|
-
|
118
|
-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
119
|
-
---
|
120
|
-
from athena.client import Athena
|
121
|
-
|
122
|
-
client = Athena(
|
123
|
-
api_key="YOUR_API_KEY",
|
124
|
-
)
|
125
|
-
client.search.get_markdown(
|
126
|
-
url="url",
|
127
|
-
)
|
128
|
-
"""
|
129
|
-
_response = self._client_wrapper.httpx_client.request(
|
130
|
-
"POST",
|
131
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/get-markdown"),
|
132
|
-
params=jsonable_encoder(
|
133
|
-
request_options.get("additional_query_parameters") if request_options is not None else None
|
134
|
-
),
|
135
|
-
json=jsonable_encoder({"url": url})
|
136
|
-
if request_options is None or request_options.get("additional_body_parameters") is None
|
137
|
-
else {
|
138
|
-
**jsonable_encoder({"url": url}),
|
139
|
-
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
140
|
-
},
|
141
|
-
headers=jsonable_encoder(
|
142
|
-
remove_none_from_dict(
|
143
|
-
{
|
144
|
-
**self._client_wrapper.get_headers(),
|
145
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
146
|
-
}
|
147
|
-
)
|
148
|
-
),
|
149
|
-
timeout=request_options.get("timeout_in_seconds")
|
150
|
-
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
151
|
-
else 60,
|
152
|
-
retries=0,
|
153
|
-
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
154
|
-
)
|
155
|
-
if 200 <= _response.status_code < 300:
|
156
|
-
return pydantic.parse_obj_as(ScrapeMarkdownResult, _response.json()) # type: ignore
|
157
|
-
if _response.status_code == 422:
|
158
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
159
|
-
try:
|
160
|
-
_response_json = _response.json()
|
161
|
-
except JSONDecodeError:
|
162
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
163
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
164
|
-
|
165
110
|
|
166
111
|
class AsyncSearchClient:
|
167
112
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
@@ -200,9 +145,9 @@ class AsyncSearchClient:
|
|
200
145
|
api_key="YOUR_API_KEY",
|
201
146
|
)
|
202
147
|
await client.search.get_urls(
|
203
|
-
query="
|
204
|
-
num_urls=
|
205
|
-
tbs="
|
148
|
+
query="Dogs",
|
149
|
+
num_urls=10,
|
150
|
+
tbs="qdr:m",
|
206
151
|
)
|
207
152
|
"""
|
208
153
|
_request: typing.Dict[str, typing.Any] = {"query": query, "num_urls": num_urls, "tbs": tbs}
|
@@ -214,7 +159,7 @@ class AsyncSearchClient:
|
|
214
159
|
_request["site"] = site
|
215
160
|
_response = await self._client_wrapper.httpx_client.request(
|
216
161
|
"POST",
|
217
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/get-urls"),
|
162
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/search/get-urls"),
|
218
163
|
params=jsonable_encoder(
|
219
164
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
220
165
|
),
|
@@ -247,57 +192,3 @@ class AsyncSearchClient:
|
|
247
192
|
except JSONDecodeError:
|
248
193
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
249
194
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
250
|
-
|
251
|
-
async def get_markdown(
|
252
|
-
self, *, url: str, request_options: typing.Optional[RequestOptions] = None
|
253
|
-
) -> ScrapeMarkdownResult:
|
254
|
-
"""
|
255
|
-
Parameters:
|
256
|
-
- url: str.
|
257
|
-
|
258
|
-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
259
|
-
---
|
260
|
-
from athena.client import AsyncAthena
|
261
|
-
|
262
|
-
client = AsyncAthena(
|
263
|
-
api_key="YOUR_API_KEY",
|
264
|
-
)
|
265
|
-
await client.search.get_markdown(
|
266
|
-
url="url",
|
267
|
-
)
|
268
|
-
"""
|
269
|
-
_response = await self._client_wrapper.httpx_client.request(
|
270
|
-
"POST",
|
271
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/get-markdown"),
|
272
|
-
params=jsonable_encoder(
|
273
|
-
request_options.get("additional_query_parameters") if request_options is not None else None
|
274
|
-
),
|
275
|
-
json=jsonable_encoder({"url": url})
|
276
|
-
if request_options is None or request_options.get("additional_body_parameters") is None
|
277
|
-
else {
|
278
|
-
**jsonable_encoder({"url": url}),
|
279
|
-
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
280
|
-
},
|
281
|
-
headers=jsonable_encoder(
|
282
|
-
remove_none_from_dict(
|
283
|
-
{
|
284
|
-
**self._client_wrapper.get_headers(),
|
285
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
286
|
-
}
|
287
|
-
)
|
288
|
-
),
|
289
|
-
timeout=request_options.get("timeout_in_seconds")
|
290
|
-
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
291
|
-
else 60,
|
292
|
-
retries=0,
|
293
|
-
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
294
|
-
)
|
295
|
-
if 200 <= _response.status_code < 300:
|
296
|
-
return pydantic.parse_obj_as(ScrapeMarkdownResult, _response.json()) # type: ignore
|
297
|
-
if _response.status_code == 422:
|
298
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
299
|
-
try:
|
300
|
-
_response_json = _response.json()
|
301
|
-
except JSONDecodeError:
|
302
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
303
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|