athena-intelligence 0.1.49__py3-none-any.whl → 0.1.51__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 CHANGED
@@ -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",
athena/chain/client.py CHANGED
@@ -11,9 +11,12 @@ from ..core.pydantic_utilities import pydantic_v1
11
11
  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
+ from ..types.document import Document
14
15
  from ..types.http_validation_error import HttpValidationError
15
16
  from ..types.llm_model import LlmModel
17
+ from ..types.map_reduce_chain_out import MapReduceChainOut
16
18
  from ..types.structured_parse_result import StructuredParseResult
19
+ from ..types.tool_models import ToolModels
17
20
 
18
21
  # this is used as the default value for optional parameters
19
22
  OMIT = typing.cast(typing.Any, ...)
@@ -50,7 +53,7 @@ class ChainClient:
50
53
  client.chain.structured_parse(
51
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.',
52
55
  custom_type_dict={"modes": {}},
53
- model=LlmModel.GPT_35_TURBO,
56
+ model=LlmModel.GPT_4_TURBO,
54
57
  )
55
58
  """
56
59
  _response = self._client_wrapper.httpx_client.request(
@@ -91,6 +94,102 @@ class ChainClient:
91
94
  raise ApiError(status_code=_response.status_code, body=_response.text)
92
95
  raise ApiError(status_code=_response.status_code, body=_response_json)
93
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
+
94
193
 
95
194
  class AsyncChainClient:
96
195
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -123,7 +222,7 @@ class AsyncChainClient:
123
222
  await client.chain.structured_parse(
124
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.',
125
224
  custom_type_dict={"modes": {}},
126
- model=LlmModel.GPT_35_TURBO,
225
+ model=LlmModel.GPT_4_TURBO,
127
226
  )
128
227
  """
129
228
  _response = await self._client_wrapper.httpx_client.request(
@@ -163,3 +262,99 @@ class AsyncChainClient:
163
262
  except JSONDecodeError:
164
263
  raise ApiError(status_code=_response.status_code, body=_response.text)
165
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
athena/tasks/client.py CHANGED
@@ -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",
athena/types/__init__.py CHANGED
@@ -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,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,11 +1,11 @@
1
- athena/__init__.py,sha256=EHglML-qUfPnwk5zsnJ79TrVz1wl_CqT-_JkrTqX6AQ,1547
1
+ athena/__init__.py,sha256=PC9w42UGxMaPyahJJmpdqFI2bHiO_UCwKzb3qDp-eNA,1595
2
2
  athena/base_client.py,sha256=aniFuLr3wzh9PChzWZrkKV3ivSjOnS58p9g11dMXzgI,6860
3
3
  athena/chain/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
4
- athena/chain/client.py,sha256=BPvzeoDzOyAgSWCAVWS35xQKBv39gVOfAhO7B1B7h34,8026
4
+ athena/chain/client.py,sha256=sG2nlODFv5RNTjJMyGvXGKx0-Q5yD4S3mug28N7o_gk,16236
5
5
  athena/client.py,sha256=8QypiDlbZ0C1YsJh6GzhylLVCZXDQc1MCJTURo2_vvI,3576
6
6
  athena/core/__init__.py,sha256=1pNSKkwyQvMl_F0wohBqmoQAITptg3zlvCwsoSSzy7c,853
7
7
  athena/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
8
- athena/core/client_wrapper.py,sha256=e5bqcaJcyraFOz98rl3FUz0SWdriGivXLYrNzL6Gqvk,1495
8
+ athena/core/client_wrapper.py,sha256=u8DHGNuIekgGXTxHUseMJdRdIbJZKAGKWBAD8jJ8m6o,1495
9
9
  athena/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
10
10
  athena/core/file.py,sha256=sy1RUGZ3aJYuw998bZytxxo6QdgKmlnlgBaMvwEKCGg,1480
11
11
  athena/core/http_client.py,sha256=5ok6hqgZDJhg57EHvMnr0BBaHdG50QxFPKaCZ9aVWTc,5059
@@ -31,10 +31,10 @@ athena/search/client.py,sha256=8ukNlqy1Wv-uci1tJ7uz-lhOF6OK7_kF31kNO1MGpok,7610
31
31
  athena/snippet/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
32
32
  athena/snippet/client.py,sha256=7wVWdr4Ox6e5dAyEZIxuP0FUO4GHYOHMjJzwHvkyhcU,6182
33
33
  athena/tasks/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
34
- athena/tasks/client.py,sha256=VtpBe-EzyOhjIOFwcN4Lx4cWZ7DZ4_Qj9Eyz43DBaUQ,8214
34
+ athena/tasks/client.py,sha256=v9URzz_gWK25J0StAOdutLAm653W_mu5LfBBDAD6rwg,8234
35
35
  athena/tools/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
36
36
  athena/tools/client.py,sha256=Dv_XRrhnkmaqfhs1oon31gJl0UvSjMQ3Sy5o7QqH1ac,20114
37
- athena/types/__init__.py,sha256=JZReH-Lqa3W6C8VcOToGaT-HqdII_SNLQp-VpzIK0oI,1722
37
+ athena/types/__init__.py,sha256=gGzhE-aTRP85ByuzgB_EeqOPVYW4GBciDc7fghsXbLo,1799
38
38
  athena/types/dataset.py,sha256=ShFYop4Pj-pscWrjWZQFboUmK5TDX3NzP0xNRZimpp8,994
39
39
  athena/types/document.py,sha256=evK_-wGk07kB8y5xyPMFCgqDbItuxCAawdUN20b6zFg,1061
40
40
  athena/types/excecute_tool_first_workflow_out.py,sha256=T4GxP3yzTY3XkumdpUdXbn8Tx_iNc1exed8N2SnwV2w,875
@@ -45,6 +45,7 @@ athena/types/get_snippets_response.py,sha256=pgwYqmddU5shKeVaE4RQSFN9SLsVAeQp3sq
45
45
  athena/types/http_validation_error.py,sha256=u4t-1U0DI0u3Zj_Oz7AmGmpL4sqBzoS_5nZHImWQbmM,953
46
46
  athena/types/langchain_documents_request_out.py,sha256=9XPPEMY6zB2m5f4u4LnO2dmveKtOpAkzxKvENEJYz2c,919
47
47
  athena/types/llm_model.py,sha256=b1W7CtiusS5Du3jLugdvpd7fUQ5GhcIU-2YxK4UAqvs,4101
48
+ athena/types/map_reduce_chain_out.py,sha256=6R-fuxHaww60dhUAuwrdZPp5lV-DyFZh9SGLCc6fp8E,950
48
49
  athena/types/message_out.py,sha256=HJZizmFH7crD3OHm0fdTy3189F2gv5qR8aaUbTTfWFI,845
49
50
  athena/types/message_out_dto.py,sha256=1G8srlYaIYmoYRstLKm97xZGxK87DK57CiO9hYnt3gQ,1031
50
51
  athena/types/model.py,sha256=73jxfZPxAtK0iFex4bluPRrfpF5sY3Y6VFa9iALykBw,2991
@@ -60,6 +61,6 @@ athena/types/url_result.py,sha256=lIgnQeyKy_UfFFPe7HMrrRzb-SK089RxcKcKN9Q3DNQ,87
60
61
  athena/types/validation_error.py,sha256=yqombbKLBSzTPFn6CJH_hbo7tpS68T3JvMdd7kBtO1g,972
61
62
  athena/types/validation_error_loc_item.py,sha256=LAtjCHIllWRBFXvAZ5QZpp7CPXjdtN9EB7HrLVo6EP0,128
62
63
  athena/version.py,sha256=8aYAOJtVLaJLpRp6mTiEIhnl8gXA7yE0aDtZ-3mKQ4k,87
63
- athena_intelligence-0.1.49.dist-info/METADATA,sha256=IA03tyg22B0NrD6XUNu_2kWv3TC1_owKwgQ1jBQiSKo,4738
64
- athena_intelligence-0.1.49.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
65
- athena_intelligence-0.1.49.dist-info/RECORD,,
64
+ athena_intelligence-0.1.51.dist-info/METADATA,sha256=Vc2wx4tcpWxrEJfTe-9dsuHdcGlq8tub_ilE_fLBdn8,4738
65
+ athena_intelligence-0.1.51.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
66
+ athena_intelligence-0.1.51.dist-info/RECORD,,