athena-intelligence 0.1.44__py3-none-any.whl → 0.1.49__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 +8 -3
- athena/base_client.py +27 -6
- athena/chain/__init__.py +0 -3
- athena/chain/client.py +42 -44
- athena/core/__init__.py +2 -0
- athena/core/client_wrapper.py +14 -6
- athena/core/http_client.py +8 -3
- athena/core/jsonable_encoder.py +7 -11
- athena/core/pydantic_utilities.py +12 -0
- athena/dataset/client.py +15 -15
- athena/message/client.py +33 -25
- athena/query/client.py +15 -15
- athena/report/client.py +15 -15
- athena/search/client.py +15 -15
- athena/snippet/client.py +15 -15
- athena/tasks/__init__.py +2 -0
- athena/tasks/client.py +191 -0
- athena/tools/client.py +47 -35
- athena/types/__init__.py +4 -0
- athena/types/dataset.py +3 -6
- athena/types/document.py +3 -6
- athena/types/excecute_tool_first_workflow_out.py +3 -6
- athena/types/firecrawl_scrape_url_data_reponse_dto.py +3 -6
- athena/types/firecrawl_scrape_url_metadata.py +5 -7
- athena/types/get_datasets_response.py +3 -6
- athena/types/get_snippets_response.py +3 -6
- athena/types/http_validation_error.py +3 -6
- athena/types/langchain_documents_request_out.py +3 -6
- athena/types/llm_model.py +93 -0
- athena/types/message_out.py +3 -6
- athena/types/message_out_dto.py +3 -6
- athena/types/model.py +8 -4
- athena/types/plan_execute_out.py +32 -0
- athena/types/report.py +3 -6
- athena/types/snippet.py +3 -6
- athena/types/sql_results.py +3 -6
- athena/types/structured_parse_result.py +3 -6
- athena/types/url_result.py +3 -6
- athena/types/validation_error.py +3 -6
- athena/version.py +4 -0
- {athena_intelligence-0.1.44.dist-info → athena_intelligence-0.1.49.dist-info}/METADATA +1 -1
- athena_intelligence-0.1.49.dist-info/RECORD +65 -0
- athena/chain/types/__init__.py +0 -5
- athena/chain/types/structured_parse_in_parsing_model.py +0 -53
- athena_intelligence-0.1.44.dist-info/RECORD +0 -61
- {athena_intelligence-0.1.44.dist-info → athena_intelligence-0.1.49.dist-info}/WHEEL +0 -0
athena/message/client.py
CHANGED
@@ -7,6 +7,7 @@ from json.decoder import JSONDecodeError
|
|
7
7
|
from ..core.api_error import ApiError
|
8
8
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
9
|
from ..core.jsonable_encoder import jsonable_encoder
|
10
|
+
from ..core.pydantic_utilities import pydantic_v1
|
10
11
|
from ..core.remove_none_from_dict import remove_none_from_dict
|
11
12
|
from ..core.request_options import RequestOptions
|
12
13
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
@@ -16,11 +17,6 @@ from ..types.message_out_dto import MessageOutDto
|
|
16
17
|
from ..types.model import Model
|
17
18
|
from ..types.tools import Tools
|
18
19
|
|
19
|
-
try:
|
20
|
-
import pydantic.v1 as pydantic # type: ignore
|
21
|
-
except ImportError:
|
22
|
-
import pydantic # type: ignore
|
23
|
-
|
24
20
|
# this is used as the default value for optional parameters
|
25
21
|
OMIT = typing.cast(typing.Any, ...)
|
26
22
|
|
@@ -75,8 +71,8 @@ class MessageClient:
|
|
75
71
|
if conversation_name is not OMIT:
|
76
72
|
_request["conversation_name"] = conversation_name
|
77
73
|
_response = self._client_wrapper.httpx_client.request(
|
78
|
-
"POST",
|
79
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/message"),
|
74
|
+
method="POST",
|
75
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/message"),
|
80
76
|
params=jsonable_encoder(
|
81
77
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
82
78
|
),
|
@@ -96,14 +92,16 @@ class MessageClient:
|
|
96
92
|
),
|
97
93
|
timeout=request_options.get("timeout_in_seconds")
|
98
94
|
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
99
|
-
else
|
95
|
+
else self._client_wrapper.get_timeout(),
|
100
96
|
retries=0,
|
101
97
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
102
98
|
)
|
103
99
|
if 200 <= _response.status_code < 300:
|
104
|
-
return
|
100
|
+
return pydantic_v1.parse_obj_as(MessageOut, _response.json()) # type: ignore
|
105
101
|
if _response.status_code == 422:
|
106
|
-
raise UnprocessableEntityError(
|
102
|
+
raise UnprocessableEntityError(
|
103
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
104
|
+
)
|
107
105
|
try:
|
108
106
|
_response_json = _response.json()
|
109
107
|
except JSONDecodeError:
|
@@ -127,8 +125,10 @@ class MessageClient:
|
|
127
125
|
)
|
128
126
|
"""
|
129
127
|
_response = self._client_wrapper.httpx_client.request(
|
130
|
-
"GET",
|
131
|
-
urllib.parse.urljoin(
|
128
|
+
method="GET",
|
129
|
+
url=urllib.parse.urljoin(
|
130
|
+
f"{self._client_wrapper.get_base_url()}/", f"api/v0/message/{jsonable_encoder(id)}"
|
131
|
+
),
|
132
132
|
params=jsonable_encoder(
|
133
133
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
134
134
|
),
|
@@ -142,14 +142,16 @@ class MessageClient:
|
|
142
142
|
),
|
143
143
|
timeout=request_options.get("timeout_in_seconds")
|
144
144
|
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
145
|
-
else
|
145
|
+
else self._client_wrapper.get_timeout(),
|
146
146
|
retries=0,
|
147
147
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
148
148
|
)
|
149
149
|
if 200 <= _response.status_code < 300:
|
150
|
-
return
|
150
|
+
return pydantic_v1.parse_obj_as(MessageOutDto, _response.json()) # type: ignore
|
151
151
|
if _response.status_code == 422:
|
152
|
-
raise UnprocessableEntityError(
|
152
|
+
raise UnprocessableEntityError(
|
153
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
154
|
+
)
|
153
155
|
try:
|
154
156
|
_response_json = _response.json()
|
155
157
|
except JSONDecodeError:
|
@@ -207,8 +209,8 @@ class AsyncMessageClient:
|
|
207
209
|
if conversation_name is not OMIT:
|
208
210
|
_request["conversation_name"] = conversation_name
|
209
211
|
_response = await self._client_wrapper.httpx_client.request(
|
210
|
-
"POST",
|
211
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/message"),
|
212
|
+
method="POST",
|
213
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/message"),
|
212
214
|
params=jsonable_encoder(
|
213
215
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
214
216
|
),
|
@@ -228,14 +230,16 @@ class AsyncMessageClient:
|
|
228
230
|
),
|
229
231
|
timeout=request_options.get("timeout_in_seconds")
|
230
232
|
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
231
|
-
else
|
233
|
+
else self._client_wrapper.get_timeout(),
|
232
234
|
retries=0,
|
233
235
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
234
236
|
)
|
235
237
|
if 200 <= _response.status_code < 300:
|
236
|
-
return
|
238
|
+
return pydantic_v1.parse_obj_as(MessageOut, _response.json()) # type: ignore
|
237
239
|
if _response.status_code == 422:
|
238
|
-
raise UnprocessableEntityError(
|
240
|
+
raise UnprocessableEntityError(
|
241
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
242
|
+
)
|
239
243
|
try:
|
240
244
|
_response_json = _response.json()
|
241
245
|
except JSONDecodeError:
|
@@ -259,8 +263,10 @@ class AsyncMessageClient:
|
|
259
263
|
)
|
260
264
|
"""
|
261
265
|
_response = await self._client_wrapper.httpx_client.request(
|
262
|
-
"GET",
|
263
|
-
urllib.parse.urljoin(
|
266
|
+
method="GET",
|
267
|
+
url=urllib.parse.urljoin(
|
268
|
+
f"{self._client_wrapper.get_base_url()}/", f"api/v0/message/{jsonable_encoder(id)}"
|
269
|
+
),
|
264
270
|
params=jsonable_encoder(
|
265
271
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
266
272
|
),
|
@@ -274,14 +280,16 @@ class AsyncMessageClient:
|
|
274
280
|
),
|
275
281
|
timeout=request_options.get("timeout_in_seconds")
|
276
282
|
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
277
|
-
else
|
283
|
+
else self._client_wrapper.get_timeout(),
|
278
284
|
retries=0,
|
279
285
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
280
286
|
)
|
281
287
|
if 200 <= _response.status_code < 300:
|
282
|
-
return
|
288
|
+
return pydantic_v1.parse_obj_as(MessageOutDto, _response.json()) # type: ignore
|
283
289
|
if _response.status_code == 422:
|
284
|
-
raise UnprocessableEntityError(
|
290
|
+
raise UnprocessableEntityError(
|
291
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
292
|
+
)
|
285
293
|
try:
|
286
294
|
_response_json = _response.json()
|
287
295
|
except JSONDecodeError:
|
athena/query/client.py
CHANGED
@@ -7,17 +7,13 @@ from json.decoder import JSONDecodeError
|
|
7
7
|
from ..core.api_error import ApiError
|
8
8
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
9
|
from ..core.jsonable_encoder import jsonable_encoder
|
10
|
+
from ..core.pydantic_utilities import pydantic_v1
|
10
11
|
from ..core.remove_none_from_dict import remove_none_from_dict
|
11
12
|
from ..core.request_options import RequestOptions
|
12
13
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
13
14
|
from ..types.http_validation_error import HttpValidationError
|
14
15
|
from ..types.sql_results import SqlResults
|
15
16
|
|
16
|
-
try:
|
17
|
-
import pydantic.v1 as pydantic # type: ignore
|
18
|
-
except ImportError:
|
19
|
-
import pydantic # type: ignore
|
20
|
-
|
21
17
|
# this is used as the default value for optional parameters
|
22
18
|
OMIT = typing.cast(typing.Any, ...)
|
23
19
|
|
@@ -48,8 +44,8 @@ class QueryClient:
|
|
48
44
|
)
|
49
45
|
"""
|
50
46
|
_response = self._client_wrapper.httpx_client.request(
|
51
|
-
"POST",
|
52
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/execute-sql"),
|
47
|
+
method="POST",
|
48
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/execute-sql"),
|
53
49
|
params=jsonable_encoder(
|
54
50
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
55
51
|
),
|
@@ -69,14 +65,16 @@ class QueryClient:
|
|
69
65
|
),
|
70
66
|
timeout=request_options.get("timeout_in_seconds")
|
71
67
|
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
72
|
-
else
|
68
|
+
else self._client_wrapper.get_timeout(),
|
73
69
|
retries=0,
|
74
70
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
75
71
|
)
|
76
72
|
if 200 <= _response.status_code < 300:
|
77
|
-
return
|
73
|
+
return pydantic_v1.parse_obj_as(SqlResults, _response.json()) # type: ignore
|
78
74
|
if _response.status_code == 422:
|
79
|
-
raise UnprocessableEntityError(
|
75
|
+
raise UnprocessableEntityError(
|
76
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
77
|
+
)
|
80
78
|
try:
|
81
79
|
_response_json = _response.json()
|
82
80
|
except JSONDecodeError:
|
@@ -110,8 +108,8 @@ class AsyncQueryClient:
|
|
110
108
|
)
|
111
109
|
"""
|
112
110
|
_response = await self._client_wrapper.httpx_client.request(
|
113
|
-
"POST",
|
114
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/execute-sql"),
|
111
|
+
method="POST",
|
112
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/execute-sql"),
|
115
113
|
params=jsonable_encoder(
|
116
114
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
117
115
|
),
|
@@ -131,14 +129,16 @@ class AsyncQueryClient:
|
|
131
129
|
),
|
132
130
|
timeout=request_options.get("timeout_in_seconds")
|
133
131
|
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
134
|
-
else
|
132
|
+
else self._client_wrapper.get_timeout(),
|
135
133
|
retries=0,
|
136
134
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
137
135
|
)
|
138
136
|
if 200 <= _response.status_code < 300:
|
139
|
-
return
|
137
|
+
return pydantic_v1.parse_obj_as(SqlResults, _response.json()) # type: ignore
|
140
138
|
if _response.status_code == 422:
|
141
|
-
raise UnprocessableEntityError(
|
139
|
+
raise UnprocessableEntityError(
|
140
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
141
|
+
)
|
142
142
|
try:
|
143
143
|
_response_json = _response.json()
|
144
144
|
except JSONDecodeError:
|
athena/report/client.py
CHANGED
@@ -7,17 +7,13 @@ from json.decoder import JSONDecodeError
|
|
7
7
|
from ..core.api_error import ApiError
|
8
8
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
9
|
from ..core.jsonable_encoder import jsonable_encoder
|
10
|
+
from ..core.pydantic_utilities import pydantic_v1
|
10
11
|
from ..core.remove_none_from_dict import remove_none_from_dict
|
11
12
|
from ..core.request_options import RequestOptions
|
12
13
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
13
14
|
from ..types.http_validation_error import HttpValidationError
|
14
15
|
from ..types.report import Report
|
15
16
|
|
16
|
-
try:
|
17
|
-
import pydantic.v1 as pydantic # type: ignore
|
18
|
-
except ImportError:
|
19
|
-
import pydantic # type: ignore
|
20
|
-
|
21
17
|
# this is used as the default value for optional parameters
|
22
18
|
OMIT = typing.cast(typing.Any, ...)
|
23
19
|
|
@@ -54,8 +50,8 @@ class ReportClient:
|
|
54
50
|
if workspace_access is not OMIT:
|
55
51
|
_request["workspace_access"] = workspace_access
|
56
52
|
_response = self._client_wrapper.httpx_client.request(
|
57
|
-
"POST",
|
58
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/report"),
|
53
|
+
method="POST",
|
54
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/report"),
|
59
55
|
params=jsonable_encoder(
|
60
56
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
61
57
|
),
|
@@ -75,14 +71,16 @@ class ReportClient:
|
|
75
71
|
),
|
76
72
|
timeout=request_options.get("timeout_in_seconds")
|
77
73
|
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
78
|
-
else
|
74
|
+
else self._client_wrapper.get_timeout(),
|
79
75
|
retries=0,
|
80
76
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
81
77
|
)
|
82
78
|
if 200 <= _response.status_code < 300:
|
83
|
-
return
|
79
|
+
return pydantic_v1.parse_obj_as(Report, _response.json()) # type: ignore
|
84
80
|
if _response.status_code == 422:
|
85
|
-
raise UnprocessableEntityError(
|
81
|
+
raise UnprocessableEntityError(
|
82
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
83
|
+
)
|
86
84
|
try:
|
87
85
|
_response_json = _response.json()
|
88
86
|
except JSONDecodeError:
|
@@ -122,8 +120,8 @@ class AsyncReportClient:
|
|
122
120
|
if workspace_access is not OMIT:
|
123
121
|
_request["workspace_access"] = workspace_access
|
124
122
|
_response = await self._client_wrapper.httpx_client.request(
|
125
|
-
"POST",
|
126
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/report"),
|
123
|
+
method="POST",
|
124
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/report"),
|
127
125
|
params=jsonable_encoder(
|
128
126
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
129
127
|
),
|
@@ -143,14 +141,16 @@ class AsyncReportClient:
|
|
143
141
|
),
|
144
142
|
timeout=request_options.get("timeout_in_seconds")
|
145
143
|
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
146
|
-
else
|
144
|
+
else self._client_wrapper.get_timeout(),
|
147
145
|
retries=0,
|
148
146
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
149
147
|
)
|
150
148
|
if 200 <= _response.status_code < 300:
|
151
|
-
return
|
149
|
+
return pydantic_v1.parse_obj_as(Report, _response.json()) # type: ignore
|
152
150
|
if _response.status_code == 422:
|
153
|
-
raise UnprocessableEntityError(
|
151
|
+
raise UnprocessableEntityError(
|
152
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
153
|
+
)
|
154
154
|
try:
|
155
155
|
_response_json = _response.json()
|
156
156
|
except JSONDecodeError:
|
athena/search/client.py
CHANGED
@@ -7,17 +7,13 @@ from json.decoder import JSONDecodeError
|
|
7
7
|
from ..core.api_error import ApiError
|
8
8
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
9
|
from ..core.jsonable_encoder import jsonable_encoder
|
10
|
+
from ..core.pydantic_utilities import pydantic_v1
|
10
11
|
from ..core.remove_none_from_dict import remove_none_from_dict
|
11
12
|
from ..core.request_options import RequestOptions
|
12
13
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
13
14
|
from ..types.http_validation_error import HttpValidationError
|
14
15
|
from ..types.url_result import UrlResult
|
15
16
|
|
16
|
-
try:
|
17
|
-
import pydantic.v1 as pydantic # type: ignore
|
18
|
-
except ImportError:
|
19
|
-
import pydantic # type: ignore
|
20
|
-
|
21
17
|
# this is used as the default value for optional parameters
|
22
18
|
OMIT = typing.cast(typing.Any, ...)
|
23
19
|
|
@@ -72,8 +68,8 @@ class SearchClient:
|
|
72
68
|
if site is not OMIT:
|
73
69
|
_request["site"] = site
|
74
70
|
_response = self._client_wrapper.httpx_client.request(
|
75
|
-
"POST",
|
76
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/search/get-urls"),
|
71
|
+
method="POST",
|
72
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/search/get-urls"),
|
77
73
|
params=jsonable_encoder(
|
78
74
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
79
75
|
),
|
@@ -93,14 +89,16 @@ class SearchClient:
|
|
93
89
|
),
|
94
90
|
timeout=request_options.get("timeout_in_seconds")
|
95
91
|
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
96
|
-
else
|
92
|
+
else self._client_wrapper.get_timeout(),
|
97
93
|
retries=0,
|
98
94
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
99
95
|
)
|
100
96
|
if 200 <= _response.status_code < 300:
|
101
|
-
return
|
97
|
+
return pydantic_v1.parse_obj_as(UrlResult, _response.json()) # type: ignore
|
102
98
|
if _response.status_code == 422:
|
103
|
-
raise UnprocessableEntityError(
|
99
|
+
raise UnprocessableEntityError(
|
100
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
101
|
+
)
|
104
102
|
try:
|
105
103
|
_response_json = _response.json()
|
106
104
|
except JSONDecodeError:
|
@@ -158,8 +156,8 @@ class AsyncSearchClient:
|
|
158
156
|
if site is not OMIT:
|
159
157
|
_request["site"] = site
|
160
158
|
_response = await self._client_wrapper.httpx_client.request(
|
161
|
-
"POST",
|
162
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/search/get-urls"),
|
159
|
+
method="POST",
|
160
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/search/get-urls"),
|
163
161
|
params=jsonable_encoder(
|
164
162
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
165
163
|
),
|
@@ -179,14 +177,16 @@ class AsyncSearchClient:
|
|
179
177
|
),
|
180
178
|
timeout=request_options.get("timeout_in_seconds")
|
181
179
|
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
182
|
-
else
|
180
|
+
else self._client_wrapper.get_timeout(),
|
183
181
|
retries=0,
|
184
182
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
185
183
|
)
|
186
184
|
if 200 <= _response.status_code < 300:
|
187
|
-
return
|
185
|
+
return pydantic_v1.parse_obj_as(UrlResult, _response.json()) # type: ignore
|
188
186
|
if _response.status_code == 422:
|
189
|
-
raise UnprocessableEntityError(
|
187
|
+
raise UnprocessableEntityError(
|
188
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
189
|
+
)
|
190
190
|
try:
|
191
191
|
_response_json = _response.json()
|
192
192
|
except JSONDecodeError:
|
athena/snippet/client.py
CHANGED
@@ -7,17 +7,13 @@ from json.decoder import JSONDecodeError
|
|
7
7
|
from ..core.api_error import ApiError
|
8
8
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
9
|
from ..core.jsonable_encoder import jsonable_encoder
|
10
|
+
from ..core.pydantic_utilities import pydantic_v1
|
10
11
|
from ..core.remove_none_from_dict import remove_none_from_dict
|
11
12
|
from ..core.request_options import RequestOptions
|
12
13
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
13
14
|
from ..types.get_snippets_response import GetSnippetsResponse
|
14
15
|
from ..types.http_validation_error import HttpValidationError
|
15
16
|
|
16
|
-
try:
|
17
|
-
import pydantic.v1 as pydantic # type: ignore
|
18
|
-
except ImportError:
|
19
|
-
import pydantic # type: ignore
|
20
|
-
|
21
17
|
|
22
18
|
class SnippetClient:
|
23
19
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
@@ -46,8 +42,8 @@ class SnippetClient:
|
|
46
42
|
client.snippet.get()
|
47
43
|
"""
|
48
44
|
_response = self._client_wrapper.httpx_client.request(
|
49
|
-
"GET",
|
50
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/snippets"),
|
45
|
+
method="GET",
|
46
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/snippets"),
|
51
47
|
params=jsonable_encoder(
|
52
48
|
remove_none_from_dict(
|
53
49
|
{
|
@@ -71,14 +67,16 @@ class SnippetClient:
|
|
71
67
|
),
|
72
68
|
timeout=request_options.get("timeout_in_seconds")
|
73
69
|
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
74
|
-
else
|
70
|
+
else self._client_wrapper.get_timeout(),
|
75
71
|
retries=0,
|
76
72
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
77
73
|
)
|
78
74
|
if 200 <= _response.status_code < 300:
|
79
|
-
return
|
75
|
+
return pydantic_v1.parse_obj_as(GetSnippetsResponse, _response.json()) # type: ignore
|
80
76
|
if _response.status_code == 422:
|
81
|
-
raise UnprocessableEntityError(
|
77
|
+
raise UnprocessableEntityError(
|
78
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
79
|
+
)
|
82
80
|
try:
|
83
81
|
_response_json = _response.json()
|
84
82
|
except JSONDecodeError:
|
@@ -113,8 +111,8 @@ class AsyncSnippetClient:
|
|
113
111
|
await client.snippet.get()
|
114
112
|
"""
|
115
113
|
_response = await self._client_wrapper.httpx_client.request(
|
116
|
-
"GET",
|
117
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/snippets"),
|
114
|
+
method="GET",
|
115
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/snippets"),
|
118
116
|
params=jsonable_encoder(
|
119
117
|
remove_none_from_dict(
|
120
118
|
{
|
@@ -138,14 +136,16 @@ class AsyncSnippetClient:
|
|
138
136
|
),
|
139
137
|
timeout=request_options.get("timeout_in_seconds")
|
140
138
|
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
141
|
-
else
|
139
|
+
else self._client_wrapper.get_timeout(),
|
142
140
|
retries=0,
|
143
141
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
144
142
|
)
|
145
143
|
if 200 <= _response.status_code < 300:
|
146
|
-
return
|
144
|
+
return pydantic_v1.parse_obj_as(GetSnippetsResponse, _response.json()) # type: ignore
|
147
145
|
if _response.status_code == 422:
|
148
|
-
raise UnprocessableEntityError(
|
146
|
+
raise UnprocessableEntityError(
|
147
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
148
|
+
)
|
149
149
|
try:
|
150
150
|
_response_json = _response.json()
|
151
151
|
except JSONDecodeError:
|
athena/tasks/__init__.py
ADDED
athena/tasks/client.py
ADDED
@@ -0,0 +1,191 @@
|
|
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.pydantic_utilities import pydantic_v1
|
11
|
+
from ..core.remove_none_from_dict import remove_none_from_dict
|
12
|
+
from ..core.request_options import RequestOptions
|
13
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
14
|
+
from ..types.http_validation_error import HttpValidationError
|
15
|
+
from ..types.llm_model import LlmModel
|
16
|
+
from ..types.plan_execute_out import PlanExecuteOut
|
17
|
+
|
18
|
+
# this is used as the default value for optional parameters
|
19
|
+
OMIT = typing.cast(typing.Any, ...)
|
20
|
+
|
21
|
+
|
22
|
+
class TasksClient:
|
23
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
24
|
+
self._client_wrapper = client_wrapper
|
25
|
+
|
26
|
+
def planned_task(
|
27
|
+
self,
|
28
|
+
*,
|
29
|
+
model: LlmModel,
|
30
|
+
instructions: str,
|
31
|
+
input_data: str,
|
32
|
+
output_format: str,
|
33
|
+
request_options: typing.Optional[RequestOptions] = None,
|
34
|
+
) -> PlanExecuteOut:
|
35
|
+
"""
|
36
|
+
Parameters:
|
37
|
+
- model: LlmModel.
|
38
|
+
|
39
|
+
- instructions: str.
|
40
|
+
|
41
|
+
- input_data: str.
|
42
|
+
|
43
|
+
- output_format: str.
|
44
|
+
|
45
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
46
|
+
---
|
47
|
+
from athena import LlmModel
|
48
|
+
from athena.client import Athena
|
49
|
+
|
50
|
+
client = Athena(
|
51
|
+
api_key="YOUR_API_KEY",
|
52
|
+
)
|
53
|
+
client.tasks.planned_task(
|
54
|
+
model=LlmModel.MISTRAL_LARGE_0224,
|
55
|
+
instructions="summarize the content",
|
56
|
+
input_data="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.",
|
57
|
+
output_format="return a summary in a single sentence",
|
58
|
+
)
|
59
|
+
"""
|
60
|
+
_response = self._client_wrapper.httpx_client.request(
|
61
|
+
method="POST",
|
62
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tasks/planned-task"),
|
63
|
+
params=jsonable_encoder(
|
64
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
65
|
+
),
|
66
|
+
json=jsonable_encoder(
|
67
|
+
{"model": model, "instructions": instructions, "input_data": input_data, "output_format": output_format}
|
68
|
+
)
|
69
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
70
|
+
else {
|
71
|
+
**jsonable_encoder(
|
72
|
+
{
|
73
|
+
"model": model,
|
74
|
+
"instructions": instructions,
|
75
|
+
"input_data": input_data,
|
76
|
+
"output_format": output_format,
|
77
|
+
}
|
78
|
+
),
|
79
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
80
|
+
},
|
81
|
+
headers=jsonable_encoder(
|
82
|
+
remove_none_from_dict(
|
83
|
+
{
|
84
|
+
**self._client_wrapper.get_headers(),
|
85
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
86
|
+
}
|
87
|
+
)
|
88
|
+
),
|
89
|
+
timeout=request_options.get("timeout_in_seconds")
|
90
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
91
|
+
else self._client_wrapper.get_timeout(),
|
92
|
+
retries=0,
|
93
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
94
|
+
)
|
95
|
+
if 200 <= _response.status_code < 300:
|
96
|
+
return pydantic_v1.parse_obj_as(PlanExecuteOut, _response.json()) # type: ignore
|
97
|
+
if _response.status_code == 422:
|
98
|
+
raise UnprocessableEntityError(
|
99
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
100
|
+
)
|
101
|
+
try:
|
102
|
+
_response_json = _response.json()
|
103
|
+
except JSONDecodeError:
|
104
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
105
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
106
|
+
|
107
|
+
|
108
|
+
class AsyncTasksClient:
|
109
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
110
|
+
self._client_wrapper = client_wrapper
|
111
|
+
|
112
|
+
async def planned_task(
|
113
|
+
self,
|
114
|
+
*,
|
115
|
+
model: LlmModel,
|
116
|
+
instructions: str,
|
117
|
+
input_data: str,
|
118
|
+
output_format: str,
|
119
|
+
request_options: typing.Optional[RequestOptions] = None,
|
120
|
+
) -> PlanExecuteOut:
|
121
|
+
"""
|
122
|
+
Parameters:
|
123
|
+
- model: LlmModel.
|
124
|
+
|
125
|
+
- instructions: str.
|
126
|
+
|
127
|
+
- input_data: str.
|
128
|
+
|
129
|
+
- output_format: str.
|
130
|
+
|
131
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
132
|
+
---
|
133
|
+
from athena import LlmModel
|
134
|
+
from athena.client import AsyncAthena
|
135
|
+
|
136
|
+
client = AsyncAthena(
|
137
|
+
api_key="YOUR_API_KEY",
|
138
|
+
)
|
139
|
+
await client.tasks.planned_task(
|
140
|
+
model=LlmModel.MISTRAL_LARGE_0224,
|
141
|
+
instructions="summarize the content",
|
142
|
+
input_data="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.",
|
143
|
+
output_format="return a summary in a single sentence",
|
144
|
+
)
|
145
|
+
"""
|
146
|
+
_response = await self._client_wrapper.httpx_client.request(
|
147
|
+
method="POST",
|
148
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tasks/planned-task"),
|
149
|
+
params=jsonable_encoder(
|
150
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
151
|
+
),
|
152
|
+
json=jsonable_encoder(
|
153
|
+
{"model": model, "instructions": instructions, "input_data": input_data, "output_format": output_format}
|
154
|
+
)
|
155
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
156
|
+
else {
|
157
|
+
**jsonable_encoder(
|
158
|
+
{
|
159
|
+
"model": model,
|
160
|
+
"instructions": instructions,
|
161
|
+
"input_data": input_data,
|
162
|
+
"output_format": output_format,
|
163
|
+
}
|
164
|
+
),
|
165
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
166
|
+
},
|
167
|
+
headers=jsonable_encoder(
|
168
|
+
remove_none_from_dict(
|
169
|
+
{
|
170
|
+
**self._client_wrapper.get_headers(),
|
171
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
172
|
+
}
|
173
|
+
)
|
174
|
+
),
|
175
|
+
timeout=request_options.get("timeout_in_seconds")
|
176
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
177
|
+
else self._client_wrapper.get_timeout(),
|
178
|
+
retries=0,
|
179
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
180
|
+
)
|
181
|
+
if 200 <= _response.status_code < 300:
|
182
|
+
return pydantic_v1.parse_obj_as(PlanExecuteOut, _response.json()) # type: ignore
|
183
|
+
if _response.status_code == 422:
|
184
|
+
raise UnprocessableEntityError(
|
185
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
186
|
+
)
|
187
|
+
try:
|
188
|
+
_response_json = _response.json()
|
189
|
+
except JSONDecodeError:
|
190
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
191
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|