athena-intelligence 0.1.13__tar.gz → 0.1.14__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 (29) hide show
  1. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/PKG-INFO +1 -1
  2. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/pyproject.toml +1 -1
  3. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/client.py +5 -4
  4. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/core/client_wrapper.py +1 -1
  5. athena_intelligence-0.1.14/src/athena/polling_message_client.py +128 -0
  6. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/README.md +0 -0
  7. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/__init__.py +0 -0
  8. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/core/__init__.py +0 -0
  9. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/core/api_error.py +0 -0
  10. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/core/datetime_utils.py +0 -0
  11. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/core/file.py +0 -0
  12. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/core/jsonable_encoder.py +0 -0
  13. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/core/remove_none_from_dict.py +0 -0
  14. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/core/request_options.py +0 -0
  15. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/environment.py +0 -0
  16. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/errors/__init__.py +0 -0
  17. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/errors/unprocessable_entity_error.py +0 -0
  18. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/message/__init__.py +0 -0
  19. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/message/client.py +0 -0
  20. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/py.typed +0 -0
  21. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/types/__init__.py +0 -0
  22. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/types/http_validation_error.py +0 -0
  23. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/types/message_out.py +0 -0
  24. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/types/message_out_dto.py +0 -0
  25. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/types/model.py +0 -0
  26. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/types/status_enum.py +0 -0
  27. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/types/tools.py +0 -0
  28. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/types/validation_error.py +0 -0
  29. {athena_intelligence-0.1.13 → athena_intelligence-0.1.14}/src/athena/types/validation_error_loc_item.py +0 -0
@@ -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,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "athena-intelligence"
3
- version = "0.1.13"
3
+ version = "0.1.14"
4
4
  description = ""
5
5
  readme = "README.md"
6
6
  authors = []
@@ -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