athena-intelligence 0.1.13__py3-none-any.whl → 0.1.14__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/client.py CHANGED
@@ -6,7 +6,8 @@ import httpx
6
6
 
7
7
  from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
8
  from .environment import AthenaEnvironment
9
- from .message.client import AsyncMessageClient, MessageClient
9
+ from .polling_message_client import \
10
+ MessagePollingClient, AsyncMessagePollingClient
10
11
 
11
12
 
12
13
  class Athena:
@@ -47,7 +48,7 @@ class Athena:
47
48
  api_key=api_key,
48
49
  httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client,
49
50
  )
50
- self.message = MessageClient(client_wrapper=self._client_wrapper)
51
+ self.message = MessagePollingClient(client_wrapper=self._client_wrapper)
51
52
 
52
53
 
53
54
  class AsyncAthena:
@@ -88,7 +89,7 @@ class AsyncAthena:
88
89
  api_key=api_key,
89
90
  httpx_client=httpx.AsyncClient(timeout=timeout) if httpx_client is None else httpx_client,
90
91
  )
91
- self.message = AsyncMessageClient(client_wrapper=self._client_wrapper)
92
+ self.message = AsyncMessagePollingClient(client_wrapper=self._client_wrapper)
92
93
 
93
94
 
94
95
  def _get_base_url(*, base_url: typing.Optional[str] = None, environment: AthenaEnvironment) -> str:
@@ -97,4 +98,4 @@ def _get_base_url(*, base_url: typing.Optional[str] = None, environment: AthenaE
97
98
  elif environment is not None:
98
99
  return environment.value
99
100
  else:
100
- raise Exception("Please pass in either base_url or environment to construct the client")
101
+ raise Exception("Please pass in either base_url or environment to construct the client")
@@ -14,7 +14,7 @@ class BaseClientWrapper:
14
14
  headers: typing.Dict[str, str] = {
15
15
  "X-Fern-Language": "Python",
16
16
  "X-Fern-SDK-Name": "athena-intelligence",
17
- "X-Fern-SDK-Version": "0.1.13",
17
+ "X-Fern-SDK-Version": "0.1.14",
18
18
  }
19
19
  headers["X-API-KEY"] = self.api_key
20
20
  return headers
@@ -0,0 +1,128 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import time
4
+ import typing
5
+
6
+ from athena.types.message_out_dto import MessageOutDto
7
+
8
+ from .core import RequestOptions
9
+ from .message.client import AsyncMessageClient, MessageClient
10
+ from .types.model import Model
11
+ from .types.tools import Tools
12
+ from .types.status_enum import StatusEnum
13
+
14
+ # this is used as the default value for optional parameters
15
+ OMIT = typing.cast(typing.Any, ...)
16
+
17
+
18
+ class MessagePollingClient(MessageClient):
19
+
20
+ def submit( # type: ignore
21
+ self,
22
+ *,
23
+ content: str,
24
+ model: typing.Optional[Model] = OMIT,
25
+ tools: typing.Optional[typing.Sequence[Tools]] = OMIT,
26
+ conversation_id: typing.Optional[str] = OMIT,
27
+ conversation_name: typing.Optional[str] = OMIT,
28
+ poll_interval: int = 2,
29
+ request_options: typing.Optional[RequestOptions] = None,
30
+ ) -> MessageOutDto:
31
+ """
32
+ Parameters:
33
+ - content: str.
34
+
35
+ - model: typing.Optional[Model].
36
+
37
+ - tools: typing.Optional[typing.Sequence[Tools]].
38
+
39
+ - conversation_id: typing.Optional[str].
40
+
41
+ - conversation_name: typing.Optional[str].
42
+
43
+ - poll_interval: int. The polling interval in seconds.
44
+
45
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
46
+ ---
47
+ from athena import Model, Tools
48
+ from athena.client import Athena
49
+
50
+ client = Athena(
51
+ api_key="YOUR_API_KEY",
52
+ token="YOUR_TOKEN",
53
+ )
54
+ client.message.submit(
55
+ content="visit www.athenaintelligence.ai and summarize the website in one paragraph",
56
+ model=Model.GPT_4_TURBO_PREVIEW,
57
+ tools=[Tools.SEARCH, Tools.BROWSE],
58
+ )
59
+ """
60
+ response = super().submit(
61
+ content=content,
62
+ model=model,
63
+ tools=tools,
64
+ conversation_id=conversation_id,
65
+ conversation_name=conversation_name,
66
+ request_options=request_options)
67
+ message = self.get(id=response.id)
68
+ while message.status != StatusEnum.RESPONDED \
69
+ or message.status != StatusEnum.ERROR:
70
+ time.sleep(poll_interval)
71
+ message = self.get(id=message.id)
72
+ return message
73
+
74
+
75
+ class AsyncMessagePollingClient(AsyncMessageClient):
76
+
77
+ async def submit( # type: ignore
78
+ self,
79
+ *,
80
+ content: str,
81
+ model: typing.Optional[Model] = OMIT,
82
+ tools: typing.Optional[typing.Sequence[Tools]] = OMIT,
83
+ conversation_id: typing.Optional[str] = OMIT,
84
+ conversation_name: typing.Optional[str] = OMIT,
85
+ poll_interval: int = 2,
86
+ request_options: typing.Optional[RequestOptions] = None,
87
+ ) -> MessageOutDto:
88
+ """
89
+ Parameters:
90
+ - content: str.
91
+
92
+ - model: typing.Optional[Model].
93
+
94
+ - tools: typing.Optional[typing.Sequence[Tools]].
95
+
96
+ - conversation_id: typing.Optional[str].
97
+
98
+ - conversation_name: typing.Optional[str].
99
+
100
+ - poll_interval: int. The polling interval in seconds.
101
+
102
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
103
+ ---
104
+ from athena import Model, Tools
105
+ from athena.client import AsyncAthena
106
+
107
+ client = AsyncAthena(
108
+ api_key="YOUR_API_KEY"
109
+ )
110
+ client.message.submit(
111
+ content="visit www.athenaintelligence.ai and summarize the website in one paragraph",
112
+ model=Model.GPT_4_TURBO_PREVIEW,
113
+ tools=[Tools.SEARCH, Tools.BROWSE],
114
+ )
115
+ """
116
+ response = await super().submit(
117
+ content=content,
118
+ model=model,
119
+ tools=tools,
120
+ conversation_id=conversation_id,
121
+ conversation_name=conversation_name,
122
+ request_options=request_options)
123
+ message = await self.get(id=response.id)
124
+ while message.status != StatusEnum.RESPONDED \
125
+ or message.status != StatusEnum.ERROR:
126
+ time.sleep(poll_interval)
127
+ message = await self.get(id=message.id)
128
+ return message
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: athena-intelligence
3
- Version: 0.1.13
3
+ Version: 0.1.14
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,8 +1,8 @@
1
1
  athena/__init__.py,sha256=Prn1DsBOMu9g_ClmWZR6GIfi_3F-tZJ317hdudgLrQc,595
2
- athena/client.py,sha256=BcVF0FxjrXV27p24hcs1N4bxOpTcSQ8gsKyVX_O2bKE,3959
2
+ athena/client.py,sha256=nFVJkayT6k0-DeqX-Ef7eVB-VHLHEq6wsqaZHy5Pp48,4004
3
3
  athena/core/__init__.py,sha256=95onSWXymaL0iV-nBsuKNgjh1LbsymAkRkx7POn1nc0,696
4
4
  athena/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
5
- athena/core/client_wrapper.py,sha256=Ry6TGgXmEbAVLvqfry5Lejn_KxuzbXKhynoyrZgEqm8,1089
5
+ athena/core/client_wrapper.py,sha256=BvopfvFC4H0qyWgsGVywhx0fiJME0ucn-s_FantFg84,1089
6
6
  athena/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
7
7
  athena/core/file.py,sha256=sy1RUGZ3aJYuw998bZytxxo6QdgKmlnlgBaMvwEKCGg,1480
8
8
  athena/core/jsonable_encoder.py,sha256=MTYkDov2EryHgee4QM46uZiBOuOXK9KTHlBdBwU-CpU,3799
@@ -13,6 +13,7 @@ athena/errors/__init__.py,sha256=pbbVUFtB9LCocA1RMWMMF_RKjsy5YkOKX5BAuE49w6g,170
13
13
  athena/errors/unprocessable_entity_error.py,sha256=FvR7XPlV3Xx5nu8HNlmLhBRdk4so_gCHjYT5PyZe6sM,313
14
14
  athena/message/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
15
15
  athena/message/client.py,sha256=KUdDnXGBMxWsr9FQ_GjzJGprOBd1_rOwAuLY7QJNjJQ,11741
16
+ athena/polling_message_client.py,sha256=cWkF7nacXRtEj_r3Nud_Qq3XVAFbHoqK1EYJwbXiNRU,4159
16
17
  athena/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
18
  athena/types/__init__.py,sha256=tcRJeTt7Xlrribx1EwOB3mKiUsHUKFP0vojjIWYHE74,571
18
19
  athena/types/http_validation_error.py,sha256=Fcv_CTMMrLvCeTHjF0n5xf5tskMDgt-J6H9gp654eQw,973
@@ -23,6 +24,6 @@ athena/types/status_enum.py,sha256=0UZbhdAx215GHC-U53RS98mYHtn1N3On4VBe4j02Qtc,6
23
24
  athena/types/tools.py,sha256=Vfb-D9CYcPZH6MBATNODgfXjFyBpCs4qbkqpCMl7eBM,1277
24
25
  athena/types/validation_error.py,sha256=2JhGNJouo8QpfrMBoT_JCwYSn1nFN2Nnq0p9uPLDH-U,992
25
26
  athena/types/validation_error_loc_item.py,sha256=LAtjCHIllWRBFXvAZ5QZpp7CPXjdtN9EB7HrLVo6EP0,128
26
- athena_intelligence-0.1.13.dist-info/METADATA,sha256=L89SxGPQX_7X6bQG-HJbUU4Udr8wX5wK7EqR3W_zXDU,2258
27
- athena_intelligence-0.1.13.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
28
- athena_intelligence-0.1.13.dist-info/RECORD,,
27
+ athena_intelligence-0.1.14.dist-info/METADATA,sha256=iVwFlweS0hfqBwpONRN_07dA-sFMHClxhHLWoHDht84,2258
28
+ athena_intelligence-0.1.14.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
29
+ athena_intelligence-0.1.14.dist-info/RECORD,,