athena-intelligence 0.1.49__tar.gz → 0.1.51__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.
Files changed (67) hide show
  1. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/PKG-INFO +1 -1
  2. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/pyproject.toml +1 -1
  3. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/__init__.py +2 -0
  4. athena_intelligence-0.1.51/src/athena/chain/client.py +360 -0
  5. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/core/client_wrapper.py +1 -1
  6. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/tasks/client.py +9 -9
  7. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/__init__.py +2 -0
  8. athena_intelligence-0.1.51/src/athena/types/map_reduce_chain_out.py +28 -0
  9. athena_intelligence-0.1.49/src/athena/chain/client.py +0 -165
  10. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/README.md +0 -0
  11. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/base_client.py +0 -0
  12. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/chain/__init__.py +0 -0
  13. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/client.py +0 -0
  14. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/core/__init__.py +0 -0
  15. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/core/api_error.py +0 -0
  16. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/core/datetime_utils.py +0 -0
  17. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/core/file.py +0 -0
  18. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/core/http_client.py +0 -0
  19. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/core/jsonable_encoder.py +0 -0
  20. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/core/pydantic_utilities.py +0 -0
  21. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/core/remove_none_from_dict.py +0 -0
  22. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/core/request_options.py +0 -0
  23. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/dataset/__init__.py +0 -0
  24. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/dataset/client.py +0 -0
  25. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/environment.py +0 -0
  26. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/errors/__init__.py +0 -0
  27. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/errors/unprocessable_entity_error.py +0 -0
  28. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/message/__init__.py +0 -0
  29. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/message/client.py +0 -0
  30. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/polling_message_client.py +0 -0
  31. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/py.typed +0 -0
  32. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/query/__init__.py +0 -0
  33. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/query/client.py +0 -0
  34. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/report/__init__.py +0 -0
  35. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/report/client.py +0 -0
  36. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/search/__init__.py +0 -0
  37. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/search/client.py +0 -0
  38. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/snippet/__init__.py +0 -0
  39. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/snippet/client.py +0 -0
  40. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/tasks/__init__.py +0 -0
  41. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/tools/__init__.py +0 -0
  42. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/tools/client.py +0 -0
  43. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/dataset.py +0 -0
  44. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/document.py +0 -0
  45. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/excecute_tool_first_workflow_out.py +0 -0
  46. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/firecrawl_scrape_url_data_reponse_dto.py +0 -0
  47. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/firecrawl_scrape_url_metadata.py +0 -0
  48. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/get_datasets_response.py +0 -0
  49. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/get_snippets_response.py +0 -0
  50. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/http_validation_error.py +0 -0
  51. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/langchain_documents_request_out.py +0 -0
  52. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/llm_model.py +0 -0
  53. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/message_out.py +0 -0
  54. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/message_out_dto.py +0 -0
  55. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/model.py +0 -0
  56. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/plan_execute_out.py +0 -0
  57. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/report.py +0 -0
  58. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/snippet.py +0 -0
  59. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/sql_results.py +0 -0
  60. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/status_enum.py +0 -0
  61. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/structured_parse_result.py +0 -0
  62. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/tool_models.py +0 -0
  63. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/tools.py +0 -0
  64. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/url_result.py +0 -0
  65. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/validation_error.py +0 -0
  66. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/types/validation_error_loc_item.py +0 -0
  67. {athena_intelligence-0.1.49 → athena_intelligence-0.1.51}/src/athena/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: athena-intelligence
3
- Version: 0.1.49
3
+ Version: 0.1.51
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "athena-intelligence"
3
- version = "0.1.49"
3
+ version = "0.1.51"
4
4
  description = ""
5
5
  readme = "README.md"
6
6
  authors = []
@@ -11,6 +11,7 @@ from .types import (
11
11
  HttpValidationError,
12
12
  LangchainDocumentsRequestOut,
13
13
  LlmModel,
14
+ MapReduceChainOut,
14
15
  MessageOut,
15
16
  MessageOutDto,
16
17
  Model,
@@ -43,6 +44,7 @@ __all__ = [
43
44
  "HttpValidationError",
44
45
  "LangchainDocumentsRequestOut",
45
46
  "LlmModel",
47
+ "MapReduceChainOut",
46
48
  "MessageOut",
47
49
  "MessageOutDto",
48
50
  "Model",
@@ -0,0 +1,360 @@
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.document import Document
15
+ from ..types.http_validation_error import HttpValidationError
16
+ from ..types.llm_model import LlmModel
17
+ from ..types.map_reduce_chain_out import MapReduceChainOut
18
+ from ..types.structured_parse_result import StructuredParseResult
19
+ from ..types.tool_models import ToolModels
20
+
21
+ # this is used as the default value for optional parameters
22
+ OMIT = typing.cast(typing.Any, ...)
23
+
24
+
25
+ class ChainClient:
26
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
27
+ self._client_wrapper = client_wrapper
28
+
29
+ def structured_parse(
30
+ self,
31
+ *,
32
+ text_input: str,
33
+ custom_type_dict: typing.Dict[str, typing.Any],
34
+ model: LlmModel,
35
+ request_options: typing.Optional[RequestOptions] = None,
36
+ ) -> StructuredParseResult:
37
+ """
38
+ Parameters:
39
+ - text_input: str. The text input to be parsed.
40
+
41
+ - custom_type_dict: typing.Dict[str, typing.Any]. A dictionary of field names and their default values.
42
+
43
+ - model: LlmModel.
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.chain.structured_parse(
54
+ 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.',
55
+ custom_type_dict={"modes": {}},
56
+ model=LlmModel.GPT_4_TURBO,
57
+ )
58
+ """
59
+ _response = self._client_wrapper.httpx_client.request(
60
+ method="POST",
61
+ url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/structured-parse"),
62
+ params=jsonable_encoder(
63
+ request_options.get("additional_query_parameters") if request_options is not None else None
64
+ ),
65
+ json=jsonable_encoder({"text_input": text_input, "custom_type_dict": custom_type_dict, "model": model})
66
+ if request_options is None or request_options.get("additional_body_parameters") is None
67
+ else {
68
+ **jsonable_encoder({"text_input": text_input, "custom_type_dict": custom_type_dict, "model": model}),
69
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
70
+ },
71
+ headers=jsonable_encoder(
72
+ remove_none_from_dict(
73
+ {
74
+ **self._client_wrapper.get_headers(),
75
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
76
+ }
77
+ )
78
+ ),
79
+ timeout=request_options.get("timeout_in_seconds")
80
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
81
+ else self._client_wrapper.get_timeout(),
82
+ retries=0,
83
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
84
+ )
85
+ if 200 <= _response.status_code < 300:
86
+ return pydantic_v1.parse_obj_as(StructuredParseResult, _response.json()) # type: ignore
87
+ if _response.status_code == 422:
88
+ raise UnprocessableEntityError(
89
+ pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
90
+ )
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
+ def map_reduce_chain(
98
+ self,
99
+ *,
100
+ documents: typing.Sequence[Document],
101
+ model: ToolModels,
102
+ operator_prompt: str,
103
+ reducer_prompt: str,
104
+ input: str,
105
+ request_options: typing.Optional[RequestOptions] = None,
106
+ ) -> MapReduceChainOut:
107
+ """
108
+ Parameters:
109
+ - documents: typing.Sequence[Document].
110
+
111
+ - model: ToolModels.
112
+
113
+ - operator_prompt: str.
114
+
115
+ - reducer_prompt: str.
116
+
117
+ - input: str.
118
+
119
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
120
+ ---
121
+ from athena import Document, ToolModels
122
+ from athena.client import Athena
123
+
124
+ client = Athena(
125
+ api_key="YOUR_API_KEY",
126
+ )
127
+ client.chain.map_reduce_chain(
128
+ documents=[
129
+ Document(
130
+ 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.",
131
+ )
132
+ ],
133
+ model=ToolModels.MISTRAL_LARGE_0224,
134
+ operator_prompt="summarize the content",
135
+ reducer_prompt="Combine these summaries",
136
+ input="return a summary in a single sentence",
137
+ )
138
+ """
139
+ _response = self._client_wrapper.httpx_client.request(
140
+ method="POST",
141
+ url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/map-reduce"),
142
+ params=jsonable_encoder(
143
+ request_options.get("additional_query_parameters") if request_options is not None else None
144
+ ),
145
+ json=jsonable_encoder(
146
+ {
147
+ "documents": documents,
148
+ "model": model,
149
+ "operator_prompt": operator_prompt,
150
+ "reducer_prompt": reducer_prompt,
151
+ "input": input,
152
+ }
153
+ )
154
+ if request_options is None or request_options.get("additional_body_parameters") is None
155
+ else {
156
+ **jsonable_encoder(
157
+ {
158
+ "documents": documents,
159
+ "model": model,
160
+ "operator_prompt": operator_prompt,
161
+ "reducer_prompt": reducer_prompt,
162
+ "input": input,
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(MapReduceChainOut, _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)
192
+
193
+
194
+ class AsyncChainClient:
195
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
196
+ self._client_wrapper = client_wrapper
197
+
198
+ async def structured_parse(
199
+ self,
200
+ *,
201
+ text_input: str,
202
+ custom_type_dict: typing.Dict[str, typing.Any],
203
+ model: LlmModel,
204
+ request_options: typing.Optional[RequestOptions] = None,
205
+ ) -> StructuredParseResult:
206
+ """
207
+ Parameters:
208
+ - text_input: str. The text input to be parsed.
209
+
210
+ - custom_type_dict: typing.Dict[str, typing.Any]. A dictionary of field names and their default values.
211
+
212
+ - model: LlmModel.
213
+
214
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
215
+ ---
216
+ from athena import LlmModel
217
+ from athena.client import AsyncAthena
218
+
219
+ client = AsyncAthena(
220
+ api_key="YOUR_API_KEY",
221
+ )
222
+ await client.chain.structured_parse(
223
+ 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.',
224
+ custom_type_dict={"modes": {}},
225
+ model=LlmModel.GPT_4_TURBO,
226
+ )
227
+ """
228
+ _response = await self._client_wrapper.httpx_client.request(
229
+ method="POST",
230
+ url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/structured-parse"),
231
+ params=jsonable_encoder(
232
+ request_options.get("additional_query_parameters") if request_options is not None else None
233
+ ),
234
+ json=jsonable_encoder({"text_input": text_input, "custom_type_dict": custom_type_dict, "model": model})
235
+ if request_options is None or request_options.get("additional_body_parameters") is None
236
+ else {
237
+ **jsonable_encoder({"text_input": text_input, "custom_type_dict": custom_type_dict, "model": model}),
238
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
239
+ },
240
+ headers=jsonable_encoder(
241
+ remove_none_from_dict(
242
+ {
243
+ **self._client_wrapper.get_headers(),
244
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
245
+ }
246
+ )
247
+ ),
248
+ timeout=request_options.get("timeout_in_seconds")
249
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
250
+ else self._client_wrapper.get_timeout(),
251
+ retries=0,
252
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
253
+ )
254
+ if 200 <= _response.status_code < 300:
255
+ return pydantic_v1.parse_obj_as(StructuredParseResult, _response.json()) # type: ignore
256
+ if _response.status_code == 422:
257
+ raise UnprocessableEntityError(
258
+ pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
259
+ )
260
+ try:
261
+ _response_json = _response.json()
262
+ except JSONDecodeError:
263
+ raise ApiError(status_code=_response.status_code, body=_response.text)
264
+ raise ApiError(status_code=_response.status_code, body=_response_json)
265
+
266
+ async def map_reduce_chain(
267
+ self,
268
+ *,
269
+ documents: typing.Sequence[Document],
270
+ model: ToolModels,
271
+ operator_prompt: str,
272
+ reducer_prompt: str,
273
+ input: str,
274
+ request_options: typing.Optional[RequestOptions] = None,
275
+ ) -> MapReduceChainOut:
276
+ """
277
+ Parameters:
278
+ - documents: typing.Sequence[Document].
279
+
280
+ - model: ToolModels.
281
+
282
+ - operator_prompt: str.
283
+
284
+ - reducer_prompt: str.
285
+
286
+ - input: str.
287
+
288
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
289
+ ---
290
+ from athena import Document, ToolModels
291
+ from athena.client import AsyncAthena
292
+
293
+ client = AsyncAthena(
294
+ api_key="YOUR_API_KEY",
295
+ )
296
+ await client.chain.map_reduce_chain(
297
+ documents=[
298
+ Document(
299
+ 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.",
300
+ )
301
+ ],
302
+ model=ToolModels.MISTRAL_LARGE_0224,
303
+ operator_prompt="summarize the content",
304
+ reducer_prompt="Combine these summaries",
305
+ input="return a summary in a single sentence",
306
+ )
307
+ """
308
+ _response = await self._client_wrapper.httpx_client.request(
309
+ method="POST",
310
+ url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/map-reduce"),
311
+ params=jsonable_encoder(
312
+ request_options.get("additional_query_parameters") if request_options is not None else None
313
+ ),
314
+ json=jsonable_encoder(
315
+ {
316
+ "documents": documents,
317
+ "model": model,
318
+ "operator_prompt": operator_prompt,
319
+ "reducer_prompt": reducer_prompt,
320
+ "input": input,
321
+ }
322
+ )
323
+ if request_options is None or request_options.get("additional_body_parameters") is None
324
+ else {
325
+ **jsonable_encoder(
326
+ {
327
+ "documents": documents,
328
+ "model": model,
329
+ "operator_prompt": operator_prompt,
330
+ "reducer_prompt": reducer_prompt,
331
+ "input": input,
332
+ }
333
+ ),
334
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
335
+ },
336
+ headers=jsonable_encoder(
337
+ remove_none_from_dict(
338
+ {
339
+ **self._client_wrapper.get_headers(),
340
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
341
+ }
342
+ )
343
+ ),
344
+ timeout=request_options.get("timeout_in_seconds")
345
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
346
+ else self._client_wrapper.get_timeout(),
347
+ retries=0,
348
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
349
+ )
350
+ if 200 <= _response.status_code < 300:
351
+ return pydantic_v1.parse_obj_as(MapReduceChainOut, _response.json()) # type: ignore
352
+ if _response.status_code == 422:
353
+ raise UnprocessableEntityError(
354
+ pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
355
+ )
356
+ try:
357
+ _response_json = _response.json()
358
+ except JSONDecodeError:
359
+ raise ApiError(status_code=_response.status_code, body=_response.text)
360
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -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.49",
20
+ "X-Fern-SDK-Version": "0.1.51",
21
21
  }
22
22
  headers["X-API-KEY"] = self.api_key
23
23
  return headers
@@ -12,8 +12,8 @@ from ..core.remove_none_from_dict import remove_none_from_dict
12
12
  from ..core.request_options import RequestOptions
13
13
  from ..errors.unprocessable_entity_error import UnprocessableEntityError
14
14
  from ..types.http_validation_error import HttpValidationError
15
- from ..types.llm_model import LlmModel
16
15
  from ..types.plan_execute_out import PlanExecuteOut
16
+ from ..types.tool_models import ToolModels
17
17
 
18
18
  # this is used as the default value for optional parameters
19
19
  OMIT = typing.cast(typing.Any, ...)
@@ -26,7 +26,7 @@ class TasksClient:
26
26
  def planned_task(
27
27
  self,
28
28
  *,
29
- model: LlmModel,
29
+ model: ToolModels,
30
30
  instructions: str,
31
31
  input_data: str,
32
32
  output_format: str,
@@ -34,7 +34,7 @@ class TasksClient:
34
34
  ) -> PlanExecuteOut:
35
35
  """
36
36
  Parameters:
37
- - model: LlmModel.
37
+ - model: ToolModels.
38
38
 
39
39
  - instructions: str.
40
40
 
@@ -44,14 +44,14 @@ class TasksClient:
44
44
 
45
45
  - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
46
46
  ---
47
- from athena import LlmModel
47
+ from athena import ToolModels
48
48
  from athena.client import Athena
49
49
 
50
50
  client = Athena(
51
51
  api_key="YOUR_API_KEY",
52
52
  )
53
53
  client.tasks.planned_task(
54
- model=LlmModel.MISTRAL_LARGE_0224,
54
+ model=ToolModels.MISTRAL_LARGE_0224,
55
55
  instructions="summarize the content",
56
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
57
  output_format="return a summary in a single sentence",
@@ -112,7 +112,7 @@ class AsyncTasksClient:
112
112
  async def planned_task(
113
113
  self,
114
114
  *,
115
- model: LlmModel,
115
+ model: ToolModels,
116
116
  instructions: str,
117
117
  input_data: str,
118
118
  output_format: str,
@@ -120,7 +120,7 @@ class AsyncTasksClient:
120
120
  ) -> PlanExecuteOut:
121
121
  """
122
122
  Parameters:
123
- - model: LlmModel.
123
+ - model: ToolModels.
124
124
 
125
125
  - instructions: str.
126
126
 
@@ -130,14 +130,14 @@ class AsyncTasksClient:
130
130
 
131
131
  - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
132
132
  ---
133
- from athena import LlmModel
133
+ from athena import ToolModels
134
134
  from athena.client import AsyncAthena
135
135
 
136
136
  client = AsyncAthena(
137
137
  api_key="YOUR_API_KEY",
138
138
  )
139
139
  await client.tasks.planned_task(
140
- model=LlmModel.MISTRAL_LARGE_0224,
140
+ model=ToolModels.MISTRAL_LARGE_0224,
141
141
  instructions="summarize the content",
142
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
143
  output_format="return a summary in a single sentence",
@@ -10,6 +10,7 @@ from .get_snippets_response import GetSnippetsResponse
10
10
  from .http_validation_error import HttpValidationError
11
11
  from .langchain_documents_request_out import LangchainDocumentsRequestOut
12
12
  from .llm_model import LlmModel
13
+ from .map_reduce_chain_out import MapReduceChainOut
13
14
  from .message_out import MessageOut
14
15
  from .message_out_dto import MessageOutDto
15
16
  from .model import Model
@@ -36,6 +37,7 @@ __all__ = [
36
37
  "HttpValidationError",
37
38
  "LangchainDocumentsRequestOut",
38
39
  "LlmModel",
40
+ "MapReduceChainOut",
39
41
  "MessageOut",
40
42
  "MessageOutDto",
41
43
  "Model",
@@ -0,0 +1,28 @@
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 pydantic_v1
8
+ from .document import Document
9
+
10
+
11
+ class MapReduceChainOut(pydantic_v1.BaseModel):
12
+ input: str
13
+ input_documents: typing.List[Document]
14
+ output_text: str
15
+
16
+ def json(self, **kwargs: typing.Any) -> str:
17
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
18
+ return super().json(**kwargs_with_defaults)
19
+
20
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
21
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
22
+ return super().dict(**kwargs_with_defaults)
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic_v1.Extra.allow
28
+ json_encoders = {dt.datetime: serialize_datetime}
@@ -1,165 +0,0 @@
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.structured_parse_result import StructuredParseResult
17
-
18
- # this is used as the default value for optional parameters
19
- OMIT = typing.cast(typing.Any, ...)
20
-
21
-
22
- class ChainClient:
23
- def __init__(self, *, client_wrapper: SyncClientWrapper):
24
- self._client_wrapper = client_wrapper
25
-
26
- def structured_parse(
27
- self,
28
- *,
29
- text_input: str,
30
- custom_type_dict: typing.Dict[str, typing.Any],
31
- model: LlmModel,
32
- request_options: typing.Optional[RequestOptions] = None,
33
- ) -> StructuredParseResult:
34
- """
35
- Parameters:
36
- - text_input: str. The text input to be parsed.
37
-
38
- - custom_type_dict: typing.Dict[str, typing.Any]. A dictionary of field names and their default values.
39
-
40
- - model: LlmModel.
41
-
42
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
43
- ---
44
- from athena import LlmModel
45
- from athena.client import Athena
46
-
47
- client = Athena(
48
- api_key="YOUR_API_KEY",
49
- )
50
- client.chain.structured_parse(
51
- 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.',
52
- custom_type_dict={"modes": {}},
53
- model=LlmModel.GPT_35_TURBO,
54
- )
55
- """
56
- _response = self._client_wrapper.httpx_client.request(
57
- method="POST",
58
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/structured-parse"),
59
- params=jsonable_encoder(
60
- request_options.get("additional_query_parameters") if request_options is not None else None
61
- ),
62
- json=jsonable_encoder({"text_input": text_input, "custom_type_dict": custom_type_dict, "model": model})
63
- if request_options is None or request_options.get("additional_body_parameters") is None
64
- else {
65
- **jsonable_encoder({"text_input": text_input, "custom_type_dict": custom_type_dict, "model": model}),
66
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
67
- },
68
- headers=jsonable_encoder(
69
- remove_none_from_dict(
70
- {
71
- **self._client_wrapper.get_headers(),
72
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
73
- }
74
- )
75
- ),
76
- timeout=request_options.get("timeout_in_seconds")
77
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
78
- else self._client_wrapper.get_timeout(),
79
- retries=0,
80
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
81
- )
82
- if 200 <= _response.status_code < 300:
83
- return pydantic_v1.parse_obj_as(StructuredParseResult, _response.json()) # type: ignore
84
- if _response.status_code == 422:
85
- raise UnprocessableEntityError(
86
- pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
87
- )
88
- try:
89
- _response_json = _response.json()
90
- except JSONDecodeError:
91
- raise ApiError(status_code=_response.status_code, body=_response.text)
92
- raise ApiError(status_code=_response.status_code, body=_response_json)
93
-
94
-
95
- class AsyncChainClient:
96
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
97
- self._client_wrapper = client_wrapper
98
-
99
- async def structured_parse(
100
- self,
101
- *,
102
- text_input: str,
103
- custom_type_dict: typing.Dict[str, typing.Any],
104
- model: LlmModel,
105
- request_options: typing.Optional[RequestOptions] = None,
106
- ) -> StructuredParseResult:
107
- """
108
- Parameters:
109
- - text_input: str. The text input to be parsed.
110
-
111
- - custom_type_dict: typing.Dict[str, typing.Any]. A dictionary of field names and their default values.
112
-
113
- - model: LlmModel.
114
-
115
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
116
- ---
117
- from athena import LlmModel
118
- from athena.client import AsyncAthena
119
-
120
- client = AsyncAthena(
121
- api_key="YOUR_API_KEY",
122
- )
123
- await client.chain.structured_parse(
124
- 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.',
125
- custom_type_dict={"modes": {}},
126
- model=LlmModel.GPT_35_TURBO,
127
- )
128
- """
129
- _response = await self._client_wrapper.httpx_client.request(
130
- method="POST",
131
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/structured-parse"),
132
- params=jsonable_encoder(
133
- request_options.get("additional_query_parameters") if request_options is not None else None
134
- ),
135
- json=jsonable_encoder({"text_input": text_input, "custom_type_dict": custom_type_dict, "model": model})
136
- if request_options is None or request_options.get("additional_body_parameters") is None
137
- else {
138
- **jsonable_encoder({"text_input": text_input, "custom_type_dict": custom_type_dict, "model": model}),
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 self._client_wrapper.get_timeout(),
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_v1.parse_obj_as(StructuredParseResult, _response.json()) # type: ignore
157
- if _response.status_code == 422:
158
- raise UnprocessableEntityError(
159
- pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
160
- )
161
- try:
162
- _response_json = _response.json()
163
- except JSONDecodeError:
164
- raise ApiError(status_code=_response.status_code, body=_response.text)
165
- raise ApiError(status_code=_response.status_code, body=_response_json)