athena-intelligence 0.1.124__py3-none-any.whl → 0.1.126__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.
Files changed (58) hide show
  1. athena/__init__.py +3 -0
  2. athena/agents/client.py +88 -36
  3. athena/agents/drive/client.py +80 -32
  4. athena/agents/general/client.py +222 -91
  5. athena/agents/research/client.py +80 -32
  6. athena/agents/sql/client.py +80 -32
  7. athena/base_client.py +13 -11
  8. athena/client.py +191 -80
  9. athena/core/__init__.py +21 -4
  10. athena/core/client_wrapper.py +9 -10
  11. athena/core/file.py +37 -8
  12. athena/core/http_client.py +97 -41
  13. athena/core/jsonable_encoder.py +33 -31
  14. athena/core/pydantic_utilities.py +272 -4
  15. athena/core/query_encoder.py +38 -13
  16. athena/core/request_options.py +5 -2
  17. athena/core/serialization.py +272 -0
  18. athena/errors/internal_server_error.py +2 -3
  19. athena/errors/unauthorized_error.py +2 -3
  20. athena/errors/unprocessable_entity_error.py +2 -3
  21. athena/query/client.py +208 -58
  22. athena/tools/calendar/client.py +82 -30
  23. athena/tools/client.py +576 -184
  24. athena/tools/email/client.py +117 -43
  25. athena/tools/structured_data_extractor/client.py +118 -67
  26. athena/tools/tasks/client.py +41 -17
  27. athena/types/asset_node.py +14 -24
  28. athena/types/asset_not_found_error.py +11 -21
  29. athena/types/chunk.py +11 -21
  30. athena/types/chunk_content_item.py +21 -41
  31. athena/types/chunk_result.py +13 -23
  32. athena/types/custom_agent_response.py +12 -22
  33. athena/types/data_frame_request_out.py +11 -21
  34. athena/types/data_frame_unknown_format_error.py +11 -21
  35. athena/types/document_chunk.py +12 -22
  36. athena/types/drive_agent_response.py +12 -22
  37. athena/types/file_chunk_request_out.py +11 -21
  38. athena/types/file_too_large_error.py +11 -21
  39. athena/types/folder_response.py +11 -21
  40. athena/types/general_agent_config.py +11 -21
  41. athena/types/general_agent_config_enabled_tools_item.py +0 -1
  42. athena/types/general_agent_request.py +13 -23
  43. athena/types/general_agent_response.py +12 -22
  44. athena/types/image_url_content.py +11 -21
  45. athena/types/parent_folder_error.py +11 -21
  46. athena/types/prompt_message.py +12 -22
  47. athena/types/research_agent_response.py +12 -22
  48. athena/types/save_asset_request_out.py +11 -21
  49. athena/types/sql_agent_response.py +13 -23
  50. athena/types/structured_data_extractor_response.py +15 -25
  51. athena/types/text_content.py +11 -21
  52. athena/types/tool.py +1 -13
  53. athena/types/type.py +1 -21
  54. athena/version.py +0 -1
  55. {athena_intelligence-0.1.124.dist-info → athena_intelligence-0.1.126.dist-info}/METADATA +12 -4
  56. athena_intelligence-0.1.126.dist-info/RECORD +87 -0
  57. {athena_intelligence-0.1.124.dist-info → athena_intelligence-0.1.126.dist-info}/WHEEL +1 -1
  58. athena_intelligence-0.1.124.dist-info/RECORD +0 -86
@@ -1,14 +1,14 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  import typing
4
- from json.decoder import JSONDecodeError
5
-
6
- from ...core.api_error import ApiError
7
- from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
- from ...core.pydantic_utilities import pydantic_v1
4
+ from ...core.client_wrapper import SyncClientWrapper
9
5
  from ...core.request_options import RequestOptions
10
- from ...errors.unprocessable_entity_error import UnprocessableEntityError
11
6
  from ...types.sql_agent_response import SqlAgentResponse
7
+ from ...core.pydantic_utilities import parse_obj_as
8
+ from ...errors.unprocessable_entity_error import UnprocessableEntityError
9
+ from json.decoder import JSONDecodeError
10
+ from ...core.api_error import ApiError
11
+ from ...core.client_wrapper import AsyncClientWrapper
12
12
 
13
13
  # this is used as the default value for optional parameters
14
14
  OMIT = typing.cast(typing.Any, ...)
@@ -21,19 +21,19 @@ class SqlClient:
21
21
  def invoke(
22
22
  self,
23
23
  *,
24
- config: typing.Dict[str, typing.Any],
25
- messages: typing.Sequence[typing.Dict[str, typing.Any]],
26
- request_options: typing.Optional[RequestOptions] = None
24
+ config: typing.Dict[str, typing.Optional[typing.Any]],
25
+ messages: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
26
+ request_options: typing.Optional[RequestOptions] = None,
27
27
  ) -> SqlAgentResponse:
28
28
  """
29
29
  Coming soon! Generate, execute, and test SQL queries. Returns an asset ID for the query object.
30
30
 
31
31
  Parameters
32
32
  ----------
33
- config : typing.Dict[str, typing.Any]
33
+ config : typing.Dict[str, typing.Optional[typing.Any]]
34
34
  Configuration for the SQL agent including database connection details and query parameters
35
35
 
36
- messages : typing.Sequence[typing.Dict[str, typing.Any]]
36
+ messages : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
37
37
  The messages to send to the SQL agent
38
38
 
39
39
  request_options : typing.Optional[RequestOptions]
@@ -46,7 +46,7 @@ class SqlClient:
46
46
 
47
47
  Examples
48
48
  --------
49
- from athena.client import Athena
49
+ from athena import Athena
50
50
 
51
51
  client = Athena(
52
52
  api_key="YOUR_API_KEY",
@@ -59,15 +59,35 @@ class SqlClient:
59
59
  _response = self._client_wrapper.httpx_client.request(
60
60
  "api/v0/agents/sql/invoke",
61
61
  method="POST",
62
- json={"config": config, "messages": messages},
62
+ json={
63
+ "config": config,
64
+ "messages": messages,
65
+ },
66
+ headers={
67
+ "content-type": "application/json",
68
+ },
63
69
  request_options=request_options,
64
70
  omit=OMIT,
65
71
  )
66
- if 200 <= _response.status_code < 300:
67
- return pydantic_v1.parse_obj_as(SqlAgentResponse, _response.json()) # type: ignore
68
- if _response.status_code == 422:
69
- raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
70
72
  try:
73
+ if 200 <= _response.status_code < 300:
74
+ return typing.cast(
75
+ SqlAgentResponse,
76
+ parse_obj_as(
77
+ type_=SqlAgentResponse, # type: ignore
78
+ object_=_response.json(),
79
+ ),
80
+ )
81
+ if _response.status_code == 422:
82
+ raise UnprocessableEntityError(
83
+ typing.cast(
84
+ typing.Optional[typing.Any],
85
+ parse_obj_as(
86
+ type_=typing.Optional[typing.Any], # type: ignore
87
+ object_=_response.json(),
88
+ ),
89
+ )
90
+ )
71
91
  _response_json = _response.json()
72
92
  except JSONDecodeError:
73
93
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -81,19 +101,19 @@ class AsyncSqlClient:
81
101
  async def invoke(
82
102
  self,
83
103
  *,
84
- config: typing.Dict[str, typing.Any],
85
- messages: typing.Sequence[typing.Dict[str, typing.Any]],
86
- request_options: typing.Optional[RequestOptions] = None
104
+ config: typing.Dict[str, typing.Optional[typing.Any]],
105
+ messages: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
106
+ request_options: typing.Optional[RequestOptions] = None,
87
107
  ) -> SqlAgentResponse:
88
108
  """
89
109
  Coming soon! Generate, execute, and test SQL queries. Returns an asset ID for the query object.
90
110
 
91
111
  Parameters
92
112
  ----------
93
- config : typing.Dict[str, typing.Any]
113
+ config : typing.Dict[str, typing.Optional[typing.Any]]
94
114
  Configuration for the SQL agent including database connection details and query parameters
95
115
 
96
- messages : typing.Sequence[typing.Dict[str, typing.Any]]
116
+ messages : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
97
117
  The messages to send to the SQL agent
98
118
 
99
119
  request_options : typing.Optional[RequestOptions]
@@ -106,28 +126,56 @@ class AsyncSqlClient:
106
126
 
107
127
  Examples
108
128
  --------
109
- from athena.client import AsyncAthena
129
+ import asyncio
130
+
131
+ from athena import AsyncAthena
110
132
 
111
133
  client = AsyncAthena(
112
134
  api_key="YOUR_API_KEY",
113
135
  )
114
- await client.agents.sql.invoke(
115
- config={"key": "value"},
116
- messages=[{"key": "value"}],
117
- )
136
+
137
+
138
+ async def main() -> None:
139
+ await client.agents.sql.invoke(
140
+ config={"key": "value"},
141
+ messages=[{"key": "value"}],
142
+ )
143
+
144
+
145
+ asyncio.run(main())
118
146
  """
119
147
  _response = await self._client_wrapper.httpx_client.request(
120
148
  "api/v0/agents/sql/invoke",
121
149
  method="POST",
122
- json={"config": config, "messages": messages},
150
+ json={
151
+ "config": config,
152
+ "messages": messages,
153
+ },
154
+ headers={
155
+ "content-type": "application/json",
156
+ },
123
157
  request_options=request_options,
124
158
  omit=OMIT,
125
159
  )
126
- if 200 <= _response.status_code < 300:
127
- return pydantic_v1.parse_obj_as(SqlAgentResponse, _response.json()) # type: ignore
128
- if _response.status_code == 422:
129
- raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
130
160
  try:
161
+ if 200 <= _response.status_code < 300:
162
+ return typing.cast(
163
+ SqlAgentResponse,
164
+ parse_obj_as(
165
+ type_=SqlAgentResponse, # type: ignore
166
+ object_=_response.json(),
167
+ ),
168
+ )
169
+ if _response.status_code == 422:
170
+ raise UnprocessableEntityError(
171
+ typing.cast(
172
+ typing.Optional[typing.Any],
173
+ parse_obj_as(
174
+ type_=typing.Optional[typing.Any], # type: ignore
175
+ object_=_response.json(),
176
+ ),
177
+ )
178
+ )
131
179
  _response_json = _response.json()
132
180
  except JSONDecodeError:
133
181
  raise ApiError(status_code=_response.status_code, body=_response.text)
athena/base_client.py CHANGED
@@ -1,14 +1,16 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  import typing
4
-
5
- import httpx
6
-
7
- from .agents.client import AgentsClient, AsyncAgentsClient
8
- from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
4
  from .environment import AthenaEnvironment
10
- from .query.client import AsyncQueryClient, QueryClient
11
- from .tools.client import AsyncToolsClient, ToolsClient
5
+ import httpx
6
+ from .core.client_wrapper import SyncClientWrapper
7
+ from .agents.client import AgentsClient
8
+ from .query.client import QueryClient
9
+ from .tools.client import ToolsClient
10
+ from .core.client_wrapper import AsyncClientWrapper
11
+ from .agents.client import AsyncAgentsClient
12
+ from .query.client import AsyncQueryClient
13
+ from .tools.client import AsyncToolsClient
12
14
 
13
15
 
14
16
  class BaseAthena:
@@ -41,7 +43,7 @@ class BaseAthena:
41
43
 
42
44
  Examples
43
45
  --------
44
- from athena.client import Athena
46
+ from athena import Athena
45
47
 
46
48
  client = Athena(
47
49
  api_key="YOUR_API_KEY",
@@ -56,7 +58,7 @@ class BaseAthena:
56
58
  api_key: str,
57
59
  timeout: typing.Optional[float] = None,
58
60
  follow_redirects: typing.Optional[bool] = True,
59
- httpx_client: typing.Optional[httpx.Client] = None
61
+ httpx_client: typing.Optional[httpx.Client] = None,
60
62
  ):
61
63
  _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
62
64
  self._client_wrapper = SyncClientWrapper(
@@ -104,7 +106,7 @@ class AsyncBaseAthena:
104
106
 
105
107
  Examples
106
108
  --------
107
- from athena.client import AsyncAthena
109
+ from athena import AsyncAthena
108
110
 
109
111
  client = AsyncAthena(
110
112
  api_key="YOUR_API_KEY",
@@ -119,7 +121,7 @@ class AsyncBaseAthena:
119
121
  api_key: str,
120
122
  timeout: typing.Optional[float] = None,
121
123
  follow_redirects: typing.Optional[bool] = True,
122
- httpx_client: typing.Optional[httpx.AsyncClient] = None
124
+ httpx_client: typing.Optional[httpx.AsyncClient] = None,
123
125
  ):
124
126
  _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
125
127
  self._client_wrapper = AsyncClientWrapper(