athena-intelligence 0.1.82__py3-none-any.whl → 0.1.84__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 (53) hide show
  1. athena/base_client.py +40 -18
  2. athena/chain/client.py +85 -36
  3. athena/client.py +91 -4
  4. athena/core/__init__.py +4 -1
  5. athena/core/client_wrapper.py +1 -1
  6. athena/core/pydantic_utilities.py +16 -0
  7. athena/core/query_encoder.py +33 -0
  8. athena/dataset/client.py +59 -32
  9. athena/message/client.py +77 -32
  10. athena/query/client.py +37 -14
  11. athena/report/client.py +37 -14
  12. athena/search/client.py +45 -22
  13. athena/snippet/client.py +93 -44
  14. athena/tools/client.py +357 -174
  15. athena/types/convert_pdf_to_sheet_out.py +7 -3
  16. athena/types/data_frame_parsing_error.py +7 -3
  17. athena/types/data_frame_request_out.py +7 -3
  18. athena/types/data_frame_unknown_format_error.py +7 -3
  19. athena/types/dataset.py +7 -3
  20. athena/types/document.py +7 -3
  21. athena/types/excecute_tool_first_workflow_out.py +7 -3
  22. athena/types/file_data_response.py +7 -3
  23. athena/types/file_fetch_error.py +7 -3
  24. athena/types/filter_model.py +7 -3
  25. athena/types/firecrawl_scrape_url_data_reponse_dto.py +7 -3
  26. athena/types/firecrawl_scrape_url_metadata.py +7 -3
  27. athena/types/get_datasets_response.py +7 -3
  28. athena/types/get_snippet_out.py +7 -3
  29. athena/types/get_snippets_response.py +7 -3
  30. athena/types/http_validation_error.py +7 -3
  31. athena/types/langchain_documents_request_out.py +7 -3
  32. athena/types/map_reduce_chain_out.py +7 -3
  33. athena/types/message_out.py +7 -3
  34. athena/types/message_out_dto.py +7 -3
  35. athena/types/publish_formats.py +7 -3
  36. athena/types/query_model.py +7 -3
  37. athena/types/report.py +7 -3
  38. athena/types/researcher_out.py +7 -3
  39. athena/types/semantic_query_out.py +7 -3
  40. athena/types/snippet.py +7 -3
  41. athena/types/sql_results.py +7 -3
  42. athena/types/structured_parse_result.py +7 -3
  43. athena/types/time_dimension_model.py +7 -3
  44. athena/types/upload_documents_out.py +7 -3
  45. athena/types/url_result.py +7 -3
  46. athena/types/validation_error.py +7 -3
  47. athena/types/workflow_status_out.py +7 -3
  48. athena/upload/client.py +37 -12
  49. athena/workflow/client.py +35 -12
  50. {athena_intelligence-0.1.82.dist-info → athena_intelligence-0.1.84.dist-info}/METADATA +12 -2
  51. athena_intelligence-0.1.84.dist-info/RECORD +91 -0
  52. athena_intelligence-0.1.82.dist-info/RECORD +0 -90
  53. {athena_intelligence-0.1.82.dist-info → athena_intelligence-0.1.84.dist-info}/WHEEL +0 -0
athena/base_client.py CHANGED
@@ -22,21 +22,32 @@ class BaseAthena:
22
22
  """
23
23
  Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
24
24
 
25
- Parameters:
26
- - base_url: typing.Optional[str]. The base url to use for requests from the client.
25
+ Parameters
26
+ ----------
27
+ base_url : typing.Optional[str]
28
+ The base url to use for requests from the client.
27
29
 
28
- - environment: AthenaEnvironment. The environment to use for requests from the client. from .environment import AthenaEnvironment
30
+ environment : AthenaEnvironment
31
+ The environment to use for requests from the client. from .environment import AthenaEnvironment
29
32
 
30
- Defaults to AthenaEnvironment.DEFAULT
31
33
 
32
- - api_key: str.
33
34
 
34
- - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
35
+ Defaults to AthenaEnvironment.DEFAULT
35
36
 
36
- - follow_redirects: typing.Optional[bool]. Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
37
37
 
38
- - httpx_client: typing.Optional[httpx.Client]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
39
- ---
38
+
39
+ api_key : str
40
+ timeout : typing.Optional[float]
41
+ The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
42
+
43
+ follow_redirects : typing.Optional[bool]
44
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
45
+
46
+ httpx_client : typing.Optional[httpx.Client]
47
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
48
+
49
+ Examples
50
+ --------
40
51
  from athena.client import Athena
41
52
 
42
53
  client = Athena(
@@ -81,21 +92,32 @@ class AsyncBaseAthena:
81
92
  """
82
93
  Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
83
94
 
84
- Parameters:
85
- - base_url: typing.Optional[str]. The base url to use for requests from the client.
95
+ Parameters
96
+ ----------
97
+ base_url : typing.Optional[str]
98
+ The base url to use for requests from the client.
99
+
100
+ environment : AthenaEnvironment
101
+ The environment to use for requests from the client. from .environment import AthenaEnvironment
102
+
103
+
104
+
105
+ Defaults to AthenaEnvironment.DEFAULT
86
106
 
87
- - environment: AthenaEnvironment. The environment to use for requests from the client. from .environment import AthenaEnvironment
88
107
 
89
- Defaults to AthenaEnvironment.DEFAULT
90
108
 
91
- - api_key: str.
109
+ api_key : str
110
+ timeout : typing.Optional[float]
111
+ The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
92
112
 
93
- - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
113
+ follow_redirects : typing.Optional[bool]
114
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
94
115
 
95
- - follow_redirects: typing.Optional[bool]. Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
116
+ httpx_client : typing.Optional[httpx.AsyncClient]
117
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
96
118
 
97
- - httpx_client: typing.Optional[httpx.AsyncClient]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
98
- ---
119
+ Examples
120
+ --------
99
121
  from athena.client import AsyncAthena
100
122
 
101
123
  client = AsyncAthena(
athena/chain/client.py CHANGED
@@ -8,6 +8,7 @@ from ..core.api_error import ApiError
8
8
  from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
9
  from ..core.jsonable_encoder import jsonable_encoder
10
10
  from ..core.pydantic_utilities import pydantic_v1
11
+ from ..core.query_encoder import encode_query
11
12
  from ..core.remove_none_from_dict import remove_none_from_dict
12
13
  from ..core.request_options import RequestOptions
13
14
  from ..errors.unprocessable_entity_error import UnprocessableEntityError
@@ -34,15 +35,26 @@ class ChainClient:
34
35
  request_options: typing.Optional[RequestOptions] = None,
35
36
  ) -> StructuredParseResult:
36
37
  """
37
- Parameters:
38
- - text_input: str. The text input to be parsed.
38
+ Parameters
39
+ ----------
40
+ text_input : str
41
+ The text input to be parsed.
39
42
 
40
- - custom_type_dict: typing.Dict[str, typing.Any]. A dictionary of field names and their default values.
43
+ custom_type_dict : typing.Dict[str, typing.Any]
44
+ A dictionary of field names and their default values.
41
45
 
42
- - model: LlmModel.
46
+ model : LlmModel
43
47
 
44
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
45
- ---
48
+ request_options : typing.Optional[RequestOptions]
49
+ Request-specific configuration.
50
+
51
+ Returns
52
+ -------
53
+ StructuredParseResult
54
+ Successful Response
55
+
56
+ Examples
57
+ --------
46
58
  from athena import LlmModel
47
59
  from athena.client import Athena
48
60
 
@@ -58,8 +70,10 @@ class ChainClient:
58
70
  _response = self._client_wrapper.httpx_client.request(
59
71
  method="POST",
60
72
  url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/structured-parse"),
61
- params=jsonable_encoder(
62
- request_options.get("additional_query_parameters") if request_options is not None else None
73
+ params=encode_query(
74
+ jsonable_encoder(
75
+ request_options.get("additional_query_parameters") if request_options is not None else None
76
+ )
63
77
  ),
64
78
  json=jsonable_encoder({"text_input": text_input, "custom_type_dict": custom_type_dict, "model": model})
65
79
  if request_options is None or request_options.get("additional_body_parameters") is None
@@ -104,19 +118,28 @@ class ChainClient:
104
118
  request_options: typing.Optional[RequestOptions] = None,
105
119
  ) -> MapReduceChainOut:
106
120
  """
107
- Parameters:
108
- - documents: typing.Sequence[Document].
121
+ Parameters
122
+ ----------
123
+ documents : typing.Sequence[Document]
109
124
 
110
- - model: LlmModel.
125
+ model : LlmModel
111
126
 
112
- - operator_prompt: str.
127
+ operator_prompt : str
113
128
 
114
- - reducer_prompt: str.
129
+ reducer_prompt : str
115
130
 
116
- - input: str.
131
+ input : str
117
132
 
118
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
119
- ---
133
+ request_options : typing.Optional[RequestOptions]
134
+ Request-specific configuration.
135
+
136
+ Returns
137
+ -------
138
+ MapReduceChainOut
139
+ Successful Response
140
+
141
+ Examples
142
+ --------
120
143
  from athena import Document, LlmModel
121
144
  from athena.client import Athena
122
145
 
@@ -139,8 +162,10 @@ class ChainClient:
139
162
  _response = self._client_wrapper.httpx_client.request(
140
163
  method="POST",
141
164
  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
165
+ params=encode_query(
166
+ jsonable_encoder(
167
+ request_options.get("additional_query_parameters") if request_options is not None else None
168
+ )
144
169
  ),
145
170
  json=jsonable_encoder(
146
171
  {
@@ -204,15 +229,26 @@ class AsyncChainClient:
204
229
  request_options: typing.Optional[RequestOptions] = None,
205
230
  ) -> StructuredParseResult:
206
231
  """
207
- Parameters:
208
- - text_input: str. The text input to be parsed.
232
+ Parameters
233
+ ----------
234
+ text_input : str
235
+ The text input to be parsed.
209
236
 
210
- - custom_type_dict: typing.Dict[str, typing.Any]. A dictionary of field names and their default values.
237
+ custom_type_dict : typing.Dict[str, typing.Any]
238
+ A dictionary of field names and their default values.
211
239
 
212
- - model: LlmModel.
240
+ model : LlmModel
213
241
 
214
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
215
- ---
242
+ request_options : typing.Optional[RequestOptions]
243
+ Request-specific configuration.
244
+
245
+ Returns
246
+ -------
247
+ StructuredParseResult
248
+ Successful Response
249
+
250
+ Examples
251
+ --------
216
252
  from athena import LlmModel
217
253
  from athena.client import AsyncAthena
218
254
 
@@ -228,8 +264,10 @@ class AsyncChainClient:
228
264
  _response = await self._client_wrapper.httpx_client.request(
229
265
  method="POST",
230
266
  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
267
+ params=encode_query(
268
+ jsonable_encoder(
269
+ request_options.get("additional_query_parameters") if request_options is not None else None
270
+ )
233
271
  ),
234
272
  json=jsonable_encoder({"text_input": text_input, "custom_type_dict": custom_type_dict, "model": model})
235
273
  if request_options is None or request_options.get("additional_body_parameters") is None
@@ -274,19 +312,28 @@ class AsyncChainClient:
274
312
  request_options: typing.Optional[RequestOptions] = None,
275
313
  ) -> MapReduceChainOut:
276
314
  """
277
- Parameters:
278
- - documents: typing.Sequence[Document].
315
+ Parameters
316
+ ----------
317
+ documents : typing.Sequence[Document]
279
318
 
280
- - model: LlmModel.
319
+ model : LlmModel
281
320
 
282
- - operator_prompt: str.
321
+ operator_prompt : str
283
322
 
284
- - reducer_prompt: str.
323
+ reducer_prompt : str
285
324
 
286
- - input: str.
325
+ input : str
287
326
 
288
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
289
- ---
327
+ request_options : typing.Optional[RequestOptions]
328
+ Request-specific configuration.
329
+
330
+ Returns
331
+ -------
332
+ MapReduceChainOut
333
+ Successful Response
334
+
335
+ Examples
336
+ --------
290
337
  from athena import Document, LlmModel
291
338
  from athena.client import AsyncAthena
292
339
 
@@ -309,8 +356,10 @@ class AsyncChainClient:
309
356
  _response = await self._client_wrapper.httpx_client.request(
310
357
  method="POST",
311
358
  url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/map-reduce"),
312
- params=jsonable_encoder(
313
- request_options.get("additional_query_parameters") if request_options is not None else None
359
+ params=encode_query(
360
+ jsonable_encoder(
361
+ request_options.get("additional_query_parameters") if request_options is not None else None
362
+ )
314
363
  ),
315
364
  json=jsonable_encoder(
316
365
  {
athena/client.py CHANGED
@@ -1,13 +1,65 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
1
+ import io
3
2
  import typing
3
+ import warnings
4
4
 
5
5
  import httpx
6
+ from typing_extensions import TypeVar, ParamSpec
6
7
 
7
8
  from .base_client import BaseAthena, AsyncBaseAthena
8
9
  from .environment import AthenaEnvironment
9
- from .polling_message_client import \
10
- MessagePollingClient, AsyncMessagePollingClient
10
+ from .polling_message_client import MessagePollingClient, AsyncMessagePollingClient
11
+ from .tools.client import AsyncToolsClient, ToolsClient
12
+ from .types.data_frame_request_out import DataFrameRequestOut
13
+
14
+ if typing.TYPE_CHECKING:
15
+ import pandas as pd
16
+
17
+
18
+ P = ParamSpec("P")
19
+ T = TypeVar("T")
20
+ U = TypeVar('U')
21
+
22
+
23
+ def _inherit_signature(f: typing.Callable[P, T]) -> typing.Callable[..., typing.Callable[P, U]]:
24
+ return lambda x: x
25
+
26
+
27
+ class WrappedToolsClient(ToolsClient):
28
+
29
+ def get_file(self, document_id: str) -> io.BytesIO:
30
+ file_bytes = b''.join(self.raw_data(document_id=document_id))
31
+ bytes_io = io.BytesIO(file_bytes)
32
+ return bytes_io
33
+
34
+ @_inherit_signature(ToolsClient.data_frame)
35
+ def data_frame(self, *, document_id: str, **kwargs) -> 'pd.DataFrame':
36
+ _check_pandas_installed()
37
+ model = super().data_frame(document_id=document_id, **kwargs)
38
+ return _read_json_frame(model)
39
+
40
+ def read_data_frame(self, document_id: str, *args, **kwargs) -> 'pd.DataFrame':
41
+ _check_pandas_installed()
42
+ file_bytes = self.get_file(document_id)
43
+ return _to_pandas_df(file_bytes, *args, **kwargs)
44
+
45
+
46
+ class WrappedAsyncToolsClient(AsyncToolsClient):
47
+
48
+ async def get_file(self, document_id: str) -> io.BytesIO:
49
+ file_bytes = b''.join([gen async for gen in self.raw_data(document_id=document_id)])
50
+ bytes_io = io.BytesIO(file_bytes)
51
+ return bytes_io
52
+
53
+ @_inherit_signature(ToolsClient.data_frame)
54
+ async def data_frame(self, *, document_id: str, **kwargs) -> 'pd.DataFrame':
55
+ _check_pandas_installed()
56
+ model = await super().data_frame(document_id=document_id, **kwargs)
57
+ return _read_json_frame(model)
58
+
59
+ async def read_data_frame(self, document_id: str, *args, **kwargs) -> 'pd.DataFrame':
60
+ _check_pandas_installed()
61
+ file_bytes = await self.get_file(document_id)
62
+ return _to_pandas_df(file_bytes, *args, **kwargs)
11
63
 
12
64
 
13
65
  class Athena(BaseAthena):
@@ -52,6 +104,7 @@ class Athena(BaseAthena):
52
104
  )
53
105
  self.message = MessagePollingClient(
54
106
  client_wrapper=self._client_wrapper)
107
+ self.tools = WrappedToolsClient(client_wrapper=self._client_wrapper)
55
108
 
56
109
 
57
110
  class AsyncAthena(AsyncBaseAthena):
@@ -96,4 +149,38 @@ class AsyncAthena(AsyncBaseAthena):
96
149
  )
97
150
  self.message = AsyncMessagePollingClient(
98
151
  client_wrapper=self._client_wrapper)
152
+ self.tools = WrappedAsyncToolsClient(client_wrapper=self._client_wrapper)
153
+
154
+
155
+ def _read_json_frame(model: DataFrameRequestOut) -> 'pd.DataFrame':
156
+ import pandas as pd
157
+
158
+ string_io = io.StringIO(model.json())
159
+
160
+ with warnings.catch_warnings():
161
+ # Filter warnings due to https://github.com/pandas-dev/pandas/issues/59511
162
+ warnings.simplefilter(action='ignore', category=FutureWarning)
163
+ return pd.read_json(string_io, orient='split')
164
+
165
+
166
+ def _check_pandas_installed():
167
+ import pandas
168
+ assert pandas
169
+
170
+
171
+ def _to_pandas_df(bytes_io: io.BytesIO, *args, **kwargs):
172
+ import pandas as pd
173
+ import magic
174
+
175
+ # ideally this would be read from response header, but fern SDK for Python hides this info from us
176
+ media_type = magic.from_buffer(bytes_io.read(2048), mime=True)
177
+ bytes_io.seek(0)
99
178
 
179
+ if media_type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
180
+ return pd.read_excel(bytes_io, *args, engine='openpyxl', **kwargs)
181
+ elif media_type == 'application/vnd.ms-excel':
182
+ return pd.read_excel(bytes_io, *args, **kwargs)
183
+ elif media_type == 'text/csv':
184
+ return pd.read_csv(bytes_io, *args, **kwargs)
185
+ else:
186
+ raise Exception("Unknown media type")
athena/core/__init__.py CHANGED
@@ -6,7 +6,8 @@ from .datetime_utils import serialize_datetime
6
6
  from .file import File, convert_file_dict_to_httpx_tuples
7
7
  from .http_client import AsyncHttpClient, HttpClient
8
8
  from .jsonable_encoder import jsonable_encoder
9
- from .pydantic_utilities import pydantic_v1
9
+ from .pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
10
+ from .query_encoder import encode_query
10
11
  from .remove_none_from_dict import remove_none_from_dict
11
12
  from .request_options import RequestOptions
12
13
 
@@ -20,6 +21,8 @@ __all__ = [
20
21
  "RequestOptions",
21
22
  "SyncClientWrapper",
22
23
  "convert_file_dict_to_httpx_tuples",
24
+ "deep_union_pydantic_dicts",
25
+ "encode_query",
23
26
  "jsonable_encoder",
24
27
  "pydantic_v1",
25
28
  "remove_none_from_dict",
@@ -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.82",
20
+ "X-Fern-SDK-Version": "0.1.84",
21
21
  }
22
22
  headers["X-API-KEY"] = self.api_key
23
23
  return headers
@@ -1,5 +1,7 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ import typing
4
+
3
5
  import pydantic
4
6
 
5
7
  IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.")
@@ -9,4 +11,18 @@ if IS_PYDANTIC_V2:
9
11
  else:
10
12
  import pydantic as pydantic_v1 # type: ignore # nopycln: import
11
13
 
14
+
15
+ def deep_union_pydantic_dicts(
16
+ source: typing.Dict[str, typing.Any], destination: typing.Dict[str, typing.Any]
17
+ ) -> typing.Dict[str, typing.Any]:
18
+ for key, value in source.items():
19
+ if isinstance(value, dict):
20
+ node = destination.setdefault(key, {})
21
+ deep_union_pydantic_dicts(value, node)
22
+ else:
23
+ destination[key] = value
24
+
25
+ return destination
26
+
27
+
12
28
  __all__ = ["pydantic_v1"]
@@ -0,0 +1,33 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from collections import ChainMap
4
+ from typing import Any, Dict, Optional
5
+
6
+ from .pydantic_utilities import pydantic_v1
7
+
8
+
9
+ # Flattens dicts to be of the form {"key[subkey][subkey2]": value} where value is not a dict
10
+ def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = None) -> Dict[str, Any]:
11
+ result = {}
12
+ for k, v in dict_flat.items():
13
+ key = f"{key_prefix}[{k}]" if key_prefix is not None else k
14
+ if isinstance(v, dict):
15
+ result.update(traverse_query_dict(v, key))
16
+ else:
17
+ result[key] = v
18
+ return result
19
+
20
+
21
+ def single_query_encoder(query_key: str, query_value: Any) -> Dict[str, Any]:
22
+ if isinstance(query_value, pydantic_v1.BaseModel) or isinstance(query_value, dict):
23
+ if isinstance(query_value, pydantic_v1.BaseModel):
24
+ obj_dict = query_value.dict(by_alias=True)
25
+ else:
26
+ obj_dict = query_value
27
+ return traverse_query_dict(obj_dict, query_key)
28
+
29
+ return {query_key: query_value}
30
+
31
+
32
+ def encode_query(query: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]:
33
+ return dict(ChainMap(*[single_query_encoder(k, v) for k, v in query.items()])) if query is not None else None
athena/dataset/client.py CHANGED
@@ -8,6 +8,7 @@ from ..core.api_error import ApiError
8
8
  from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
9
  from ..core.jsonable_encoder import jsonable_encoder
10
10
  from ..core.pydantic_utilities import pydantic_v1
11
+ from ..core.query_encoder import encode_query
11
12
  from ..core.remove_none_from_dict import remove_none_from_dict
12
13
  from ..core.request_options import RequestOptions
13
14
  from ..errors.unprocessable_entity_error import UnprocessableEntityError
@@ -27,13 +28,24 @@ class DatasetClient:
27
28
  request_options: typing.Optional[RequestOptions] = None,
28
29
  ) -> GetDatasetsResponse:
29
30
  """
30
- Parameters:
31
- - page: typing.Optional[int]. Page number starting from 1
31
+ Parameters
32
+ ----------
33
+ page : typing.Optional[int]
34
+ Page number starting from 1
32
35
 
33
- - page_size: typing.Optional[int]. Number of items per page
36
+ page_size : typing.Optional[int]
37
+ Number of items per page
34
38
 
35
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
36
- ---
39
+ request_options : typing.Optional[RequestOptions]
40
+ Request-specific configuration.
41
+
42
+ Returns
43
+ -------
44
+ GetDatasetsResponse
45
+ Successful Response
46
+
47
+ Examples
48
+ --------
37
49
  from athena.client import Athena
38
50
 
39
51
  client = Athena(
@@ -44,17 +56,19 @@ class DatasetClient:
44
56
  _response = self._client_wrapper.httpx_client.request(
45
57
  method="GET",
46
58
  url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/datasets"),
47
- params=jsonable_encoder(
48
- remove_none_from_dict(
49
- {
50
- "page": page,
51
- "page_size": page_size,
52
- **(
53
- request_options.get("additional_query_parameters", {})
54
- if request_options is not None
55
- else {}
56
- ),
57
- }
59
+ params=encode_query(
60
+ jsonable_encoder(
61
+ remove_none_from_dict(
62
+ {
63
+ "page": page,
64
+ "page_size": page_size,
65
+ **(
66
+ request_options.get("additional_query_parameters", {})
67
+ if request_options is not None
68
+ else {}
69
+ ),
70
+ }
71
+ )
58
72
  )
59
73
  ),
60
74
  headers=jsonable_encoder(
@@ -96,13 +110,24 @@ class AsyncDatasetClient:
96
110
  request_options: typing.Optional[RequestOptions] = None,
97
111
  ) -> GetDatasetsResponse:
98
112
  """
99
- Parameters:
100
- - page: typing.Optional[int]. Page number starting from 1
113
+ Parameters
114
+ ----------
115
+ page : typing.Optional[int]
116
+ Page number starting from 1
101
117
 
102
- - page_size: typing.Optional[int]. Number of items per page
118
+ page_size : typing.Optional[int]
119
+ Number of items per page
103
120
 
104
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
105
- ---
121
+ request_options : typing.Optional[RequestOptions]
122
+ Request-specific configuration.
123
+
124
+ Returns
125
+ -------
126
+ GetDatasetsResponse
127
+ Successful Response
128
+
129
+ Examples
130
+ --------
106
131
  from athena.client import AsyncAthena
107
132
 
108
133
  client = AsyncAthena(
@@ -113,17 +138,19 @@ class AsyncDatasetClient:
113
138
  _response = await self._client_wrapper.httpx_client.request(
114
139
  method="GET",
115
140
  url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/datasets"),
116
- params=jsonable_encoder(
117
- remove_none_from_dict(
118
- {
119
- "page": page,
120
- "page_size": page_size,
121
- **(
122
- request_options.get("additional_query_parameters", {})
123
- if request_options is not None
124
- else {}
125
- ),
126
- }
141
+ params=encode_query(
142
+ jsonable_encoder(
143
+ remove_none_from_dict(
144
+ {
145
+ "page": page,
146
+ "page_size": page_size,
147
+ **(
148
+ request_options.get("additional_query_parameters", {})
149
+ if request_options is not None
150
+ else {}
151
+ ),
152
+ }
153
+ )
127
154
  )
128
155
  ),
129
156
  headers=jsonable_encoder(