athena-intelligence 0.1.60__tar.gz → 0.1.62__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 (68) hide show
  1. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/PKG-INFO +1 -1
  2. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/pyproject.toml +1 -1
  3. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/__init__.py +8 -1
  4. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/base_client.py +3 -0
  5. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/core/client_wrapper.py +1 -1
  6. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/tools/client.py +143 -0
  7. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/__init__.py +6 -0
  8. athena_intelligence-0.1.62/src/athena/types/file_data_response.py +32 -0
  9. athena_intelligence-0.1.62/src/athena/types/researcher_out.py +25 -0
  10. athena_intelligence-0.1.62/src/athena/types/upload_documents_out.py +27 -0
  11. athena_intelligence-0.1.62/src/athena/upload/__init__.py +2 -0
  12. athena_intelligence-0.1.62/src/athena/upload/client.py +139 -0
  13. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/README.md +0 -0
  14. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/chain/__init__.py +0 -0
  15. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/chain/client.py +0 -0
  16. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/client.py +0 -0
  17. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/core/__init__.py +0 -0
  18. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/core/api_error.py +0 -0
  19. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/core/datetime_utils.py +0 -0
  20. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/core/file.py +0 -0
  21. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/core/http_client.py +0 -0
  22. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/core/jsonable_encoder.py +0 -0
  23. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/core/pydantic_utilities.py +0 -0
  24. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/core/remove_none_from_dict.py +0 -0
  25. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/core/request_options.py +0 -0
  26. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/dataset/__init__.py +0 -0
  27. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/dataset/client.py +0 -0
  28. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/environment.py +0 -0
  29. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/errors/__init__.py +0 -0
  30. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/errors/unprocessable_entity_error.py +0 -0
  31. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/message/__init__.py +0 -0
  32. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/message/client.py +0 -0
  33. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/polling_message_client.py +0 -0
  34. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/py.typed +0 -0
  35. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/query/__init__.py +0 -0
  36. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/query/client.py +0 -0
  37. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/report/__init__.py +0 -0
  38. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/report/client.py +0 -0
  39. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/search/__init__.py +0 -0
  40. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/search/client.py +0 -0
  41. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/snippet/__init__.py +0 -0
  42. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/snippet/client.py +0 -0
  43. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/tools/__init__.py +0 -0
  44. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/dataset.py +0 -0
  45. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/document.py +0 -0
  46. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/excecute_tool_first_workflow_out.py +0 -0
  47. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/firecrawl_scrape_url_data_reponse_dto.py +0 -0
  48. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/firecrawl_scrape_url_metadata.py +0 -0
  49. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/get_datasets_response.py +0 -0
  50. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/get_snippet_out.py +0 -0
  51. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/get_snippets_response.py +0 -0
  52. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/http_validation_error.py +0 -0
  53. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/langchain_documents_request_out.py +0 -0
  54. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/llm_model.py +0 -0
  55. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/map_reduce_chain_out.py +0 -0
  56. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/message_out.py +0 -0
  57. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/message_out_dto.py +0 -0
  58. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/model.py +0 -0
  59. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/report.py +0 -0
  60. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/snippet.py +0 -0
  61. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/sql_results.py +0 -0
  62. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/status_enum.py +0 -0
  63. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/structured_parse_result.py +0 -0
  64. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/tools.py +0 -0
  65. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/url_result.py +0 -0
  66. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/validation_error.py +0 -0
  67. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/types/validation_error_loc_item.py +0 -0
  68. {athena_intelligence-0.1.60 → athena_intelligence-0.1.62}/src/athena/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: athena-intelligence
3
- Version: 0.1.60
3
+ Version: 0.1.62
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.60"
3
+ version = "0.1.62"
4
4
  description = ""
5
5
  readme = "README.md"
6
6
  authors = []
@@ -4,6 +4,7 @@ from .types import (
4
4
  Dataset,
5
5
  Document,
6
6
  ExcecuteToolFirstWorkflowOut,
7
+ FileDataResponse,
7
8
  FirecrawlScrapeUrlDataReponseDto,
8
9
  FirecrawlScrapeUrlMetadata,
9
10
  GetDatasetsResponse,
@@ -17,17 +18,19 @@ from .types import (
17
18
  MessageOutDto,
18
19
  Model,
19
20
  Report,
21
+ ResearcherOut,
20
22
  Snippet,
21
23
  SqlResults,
22
24
  StatusEnum,
23
25
  StructuredParseResult,
24
26
  Tools,
27
+ UploadDocumentsOut,
25
28
  UrlResult,
26
29
  ValidationError,
27
30
  ValidationErrorLocItem,
28
31
  )
29
32
  from .errors import UnprocessableEntityError
30
- from . import chain, dataset, message, query, report, search, snippet, tools
33
+ from . import chain, dataset, message, query, report, search, snippet, tools, upload
31
34
  from .environment import AthenaEnvironment
32
35
  from .version import __version__
33
36
 
@@ -36,6 +39,7 @@ __all__ = [
36
39
  "Dataset",
37
40
  "Document",
38
41
  "ExcecuteToolFirstWorkflowOut",
42
+ "FileDataResponse",
39
43
  "FirecrawlScrapeUrlDataReponseDto",
40
44
  "FirecrawlScrapeUrlMetadata",
41
45
  "GetDatasetsResponse",
@@ -49,12 +53,14 @@ __all__ = [
49
53
  "MessageOutDto",
50
54
  "Model",
51
55
  "Report",
56
+ "ResearcherOut",
52
57
  "Snippet",
53
58
  "SqlResults",
54
59
  "StatusEnum",
55
60
  "StructuredParseResult",
56
61
  "Tools",
57
62
  "UnprocessableEntityError",
63
+ "UploadDocumentsOut",
58
64
  "UrlResult",
59
65
  "ValidationError",
60
66
  "ValidationErrorLocItem",
@@ -67,4 +73,5 @@ __all__ = [
67
73
  "search",
68
74
  "snippet",
69
75
  "tools",
76
+ "upload",
70
77
  ]
@@ -14,6 +14,7 @@ from .report.client import AsyncReportClient, ReportClient
14
14
  from .search.client import AsyncSearchClient, SearchClient
15
15
  from .snippet.client import AsyncSnippetClient, SnippetClient
16
16
  from .tools.client import AsyncToolsClient, ToolsClient
17
+ from .upload.client import AsyncUploadClient, UploadClient
17
18
 
18
19
 
19
20
  class BaseAthena:
@@ -71,6 +72,7 @@ class BaseAthena:
71
72
  self.search = SearchClient(client_wrapper=self._client_wrapper)
72
73
  self.chain = ChainClient(client_wrapper=self._client_wrapper)
73
74
  self.tools = ToolsClient(client_wrapper=self._client_wrapper)
75
+ self.upload = UploadClient(client_wrapper=self._client_wrapper)
74
76
 
75
77
 
76
78
  class AsyncBaseAthena:
@@ -128,6 +130,7 @@ class AsyncBaseAthena:
128
130
  self.search = AsyncSearchClient(client_wrapper=self._client_wrapper)
129
131
  self.chain = AsyncChainClient(client_wrapper=self._client_wrapper)
130
132
  self.tools = AsyncToolsClient(client_wrapper=self._client_wrapper)
133
+ self.upload = AsyncUploadClient(client_wrapper=self._client_wrapper)
131
134
 
132
135
 
133
136
  def _get_base_url(*, base_url: typing.Optional[str] = None, environment: AthenaEnvironment) -> str:
@@ -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.60",
20
+ "X-Fern-SDK-Version": "0.1.62",
21
21
  }
22
22
  headers["X-API-KEY"] = self.api_key
23
23
  return headers
@@ -16,6 +16,7 @@ from ..types.firecrawl_scrape_url_data_reponse_dto import FirecrawlScrapeUrlData
16
16
  from ..types.http_validation_error import HttpValidationError
17
17
  from ..types.langchain_documents_request_out import LangchainDocumentsRequestOut
18
18
  from ..types.llm_model import LlmModel
19
+ from ..types.researcher_out import ResearcherOut
19
20
 
20
21
  # this is used as the default value for optional parameters
21
22
  OMIT = typing.cast(typing.Any, ...)
@@ -241,6 +242,77 @@ class ToolsClient:
241
242
  raise ApiError(status_code=_response.status_code, body=_response.text)
242
243
  raise ApiError(status_code=_response.status_code, body=_response_json)
243
244
 
245
+ def researcher(
246
+ self,
247
+ *,
248
+ query: str,
249
+ max_sections: int,
250
+ guidelines: typing.Sequence[str],
251
+ request_options: typing.Optional[RequestOptions] = None,
252
+ ) -> ResearcherOut:
253
+ """
254
+ Parameters:
255
+ - query: str.
256
+
257
+ - max_sections: int.
258
+
259
+ - guidelines: typing.Sequence[str].
260
+
261
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
262
+ ---
263
+ from athena.client import Athena
264
+
265
+ client = Athena(
266
+ api_key="YOUR_API_KEY",
267
+ )
268
+ client.tools.researcher(
269
+ query="Write a report about the company Athena Intelligence.",
270
+ max_sections=10,
271
+ guidelines=[
272
+ "The report MUST be written in APA format",
273
+ "Each sub section MUST include supporting sources using hyperlinks. If none exist, erase the sub section or rewrite it to be a part of the previous section",
274
+ "The report MUST be written in english",
275
+ ],
276
+ )
277
+ """
278
+ _response = self._client_wrapper.httpx_client.request(
279
+ method="POST",
280
+ url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/researcher"),
281
+ params=jsonable_encoder(
282
+ request_options.get("additional_query_parameters") if request_options is not None else None
283
+ ),
284
+ json=jsonable_encoder({"query": query, "max_sections": max_sections, "guidelines": guidelines})
285
+ if request_options is None or request_options.get("additional_body_parameters") is None
286
+ else {
287
+ **jsonable_encoder({"query": query, "max_sections": max_sections, "guidelines": guidelines}),
288
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
289
+ },
290
+ headers=jsonable_encoder(
291
+ remove_none_from_dict(
292
+ {
293
+ **self._client_wrapper.get_headers(),
294
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
295
+ }
296
+ )
297
+ ),
298
+ timeout=request_options.get("timeout_in_seconds")
299
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
300
+ else self._client_wrapper.get_timeout(),
301
+ retries=0,
302
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
303
+ )
304
+ if 200 <= _response.status_code < 300:
305
+ return pydantic_v1.parse_obj_as(ResearcherOut, _response.json()) # type: ignore
306
+ if _response.status_code == 422:
307
+ raise UnprocessableEntityError(
308
+ pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
309
+ )
310
+ try:
311
+ _response_json = _response.json()
312
+ except JSONDecodeError:
313
+ raise ApiError(status_code=_response.status_code, body=_response.text)
314
+ raise ApiError(status_code=_response.status_code, body=_response_json)
315
+
244
316
 
245
317
  class AsyncToolsClient:
246
318
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -461,3 +533,74 @@ class AsyncToolsClient:
461
533
  except JSONDecodeError:
462
534
  raise ApiError(status_code=_response.status_code, body=_response.text)
463
535
  raise ApiError(status_code=_response.status_code, body=_response_json)
536
+
537
+ async def researcher(
538
+ self,
539
+ *,
540
+ query: str,
541
+ max_sections: int,
542
+ guidelines: typing.Sequence[str],
543
+ request_options: typing.Optional[RequestOptions] = None,
544
+ ) -> ResearcherOut:
545
+ """
546
+ Parameters:
547
+ - query: str.
548
+
549
+ - max_sections: int.
550
+
551
+ - guidelines: typing.Sequence[str].
552
+
553
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
554
+ ---
555
+ from athena.client import AsyncAthena
556
+
557
+ client = AsyncAthena(
558
+ api_key="YOUR_API_KEY",
559
+ )
560
+ await client.tools.researcher(
561
+ query="Write a report about the company Athena Intelligence.",
562
+ max_sections=10,
563
+ guidelines=[
564
+ "The report MUST be written in APA format",
565
+ "Each sub section MUST include supporting sources using hyperlinks. If none exist, erase the sub section or rewrite it to be a part of the previous section",
566
+ "The report MUST be written in english",
567
+ ],
568
+ )
569
+ """
570
+ _response = await self._client_wrapper.httpx_client.request(
571
+ method="POST",
572
+ url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/researcher"),
573
+ params=jsonable_encoder(
574
+ request_options.get("additional_query_parameters") if request_options is not None else None
575
+ ),
576
+ json=jsonable_encoder({"query": query, "max_sections": max_sections, "guidelines": guidelines})
577
+ if request_options is None or request_options.get("additional_body_parameters") is None
578
+ else {
579
+ **jsonable_encoder({"query": query, "max_sections": max_sections, "guidelines": guidelines}),
580
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
581
+ },
582
+ headers=jsonable_encoder(
583
+ remove_none_from_dict(
584
+ {
585
+ **self._client_wrapper.get_headers(),
586
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
587
+ }
588
+ )
589
+ ),
590
+ timeout=request_options.get("timeout_in_seconds")
591
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
592
+ else self._client_wrapper.get_timeout(),
593
+ retries=0,
594
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
595
+ )
596
+ if 200 <= _response.status_code < 300:
597
+ return pydantic_v1.parse_obj_as(ResearcherOut, _response.json()) # type: ignore
598
+ if _response.status_code == 422:
599
+ raise UnprocessableEntityError(
600
+ pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
601
+ )
602
+ try:
603
+ _response_json = _response.json()
604
+ except JSONDecodeError:
605
+ raise ApiError(status_code=_response.status_code, body=_response.text)
606
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -3,6 +3,7 @@
3
3
  from .dataset import Dataset
4
4
  from .document import Document
5
5
  from .excecute_tool_first_workflow_out import ExcecuteToolFirstWorkflowOut
6
+ from .file_data_response import FileDataResponse
6
7
  from .firecrawl_scrape_url_data_reponse_dto import FirecrawlScrapeUrlDataReponseDto
7
8
  from .firecrawl_scrape_url_metadata import FirecrawlScrapeUrlMetadata
8
9
  from .get_datasets_response import GetDatasetsResponse
@@ -16,11 +17,13 @@ from .message_out import MessageOut
16
17
  from .message_out_dto import MessageOutDto
17
18
  from .model import Model
18
19
  from .report import Report
20
+ from .researcher_out import ResearcherOut
19
21
  from .snippet import Snippet
20
22
  from .sql_results import SqlResults
21
23
  from .status_enum import StatusEnum
22
24
  from .structured_parse_result import StructuredParseResult
23
25
  from .tools import Tools
26
+ from .upload_documents_out import UploadDocumentsOut
24
27
  from .url_result import UrlResult
25
28
  from .validation_error import ValidationError
26
29
  from .validation_error_loc_item import ValidationErrorLocItem
@@ -29,6 +32,7 @@ __all__ = [
29
32
  "Dataset",
30
33
  "Document",
31
34
  "ExcecuteToolFirstWorkflowOut",
35
+ "FileDataResponse",
32
36
  "FirecrawlScrapeUrlDataReponseDto",
33
37
  "FirecrawlScrapeUrlMetadata",
34
38
  "GetDatasetsResponse",
@@ -42,11 +46,13 @@ __all__ = [
42
46
  "MessageOutDto",
43
47
  "Model",
44
48
  "Report",
49
+ "ResearcherOut",
45
50
  "Snippet",
46
51
  "SqlResults",
47
52
  "StatusEnum",
48
53
  "StructuredParseResult",
49
54
  "Tools",
55
+ "UploadDocumentsOut",
50
56
  "UrlResult",
51
57
  "ValidationError",
52
58
  "ValidationErrorLocItem",
@@ -0,0 +1,32 @@
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
+
9
+
10
+ class FileDataResponse(pydantic_v1.BaseModel):
11
+ file: typing.Optional[str] = None
12
+ size: typing.Optional[int] = None
13
+ filename: typing.Optional[str] = None
14
+ content_type: typing.Optional[str] = None
15
+ status: typing.Optional[bool] = None
16
+ error: typing.Optional[str] = None
17
+ message: typing.Optional[str] = None
18
+ athena_doc_id: typing.Optional[str] = None
19
+
20
+ def json(self, **kwargs: typing.Any) -> str:
21
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
22
+ return super().json(**kwargs_with_defaults)
23
+
24
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
25
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
26
+ return super().dict(**kwargs_with_defaults)
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ extra = pydantic_v1.Extra.allow
32
+ json_encoders = {dt.datetime: serialize_datetime}
@@ -0,0 +1,25 @@
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
+
9
+
10
+ class ResearcherOut(pydantic_v1.BaseModel):
11
+ response: typing.Dict[str, typing.Any]
12
+
13
+ def json(self, **kwargs: typing.Any) -> str:
14
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
15
+ return super().json(**kwargs_with_defaults)
16
+
17
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
18
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
19
+ return super().dict(**kwargs_with_defaults)
20
+
21
+ class Config:
22
+ frozen = True
23
+ smart_union = True
24
+ extra = pydantic_v1.Extra.allow
25
+ json_encoders = {dt.datetime: serialize_datetime}
@@ -0,0 +1,27 @@
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 .file_data_response import FileDataResponse
9
+
10
+
11
+ class UploadDocumentsOut(pydantic_v1.BaseModel):
12
+ success: bool
13
+ uploaded_documents: typing.Optional[typing.List[FileDataResponse]] = None
14
+
15
+ def json(self, **kwargs: typing.Any) -> str:
16
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
17
+ return super().json(**kwargs_with_defaults)
18
+
19
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
20
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
21
+ return super().dict(**kwargs_with_defaults)
22
+
23
+ class Config:
24
+ frozen = True
25
+ smart_union = True
26
+ extra = pydantic_v1.Extra.allow
27
+ json_encoders = {dt.datetime: serialize_datetime}
@@ -0,0 +1,2 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
@@ -0,0 +1,139 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ import urllib.parse
5
+ from json.decoder import JSONDecodeError
6
+
7
+ from .. import core
8
+ from ..core.api_error import ApiError
9
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
10
+ from ..core.jsonable_encoder import jsonable_encoder
11
+ from ..core.pydantic_utilities import pydantic_v1
12
+ from ..core.remove_none_from_dict import remove_none_from_dict
13
+ from ..core.request_options import RequestOptions
14
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
15
+ from ..types.http_validation_error import HttpValidationError
16
+ from ..types.upload_documents_out import UploadDocumentsOut
17
+
18
+ # this is used as the default value for optional parameters
19
+ OMIT = typing.cast(typing.Any, ...)
20
+
21
+
22
+ class UploadClient:
23
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
24
+ self._client_wrapper = client_wrapper
25
+
26
+ def upload_documents(
27
+ self, *, files: typing.List[core.File], request_options: typing.Optional[RequestOptions] = None
28
+ ) -> UploadDocumentsOut:
29
+ """
30
+ Parameters:
31
+ - files: typing.List[core.File]. See core.File for more documentation
32
+
33
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
34
+ ---
35
+ from athena.client import Athena
36
+
37
+ client = Athena(
38
+ api_key="YOUR_API_KEY",
39
+ )
40
+ client.upload.upload_documents()
41
+ """
42
+ _response = self._client_wrapper.httpx_client.request(
43
+ method="POST",
44
+ url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/upload"),
45
+ params=jsonable_encoder(
46
+ request_options.get("additional_query_parameters") if request_options is not None else None
47
+ ),
48
+ data=jsonable_encoder(remove_none_from_dict({}))
49
+ if request_options is None or request_options.get("additional_body_parameters") is None
50
+ else {
51
+ **jsonable_encoder(remove_none_from_dict({})),
52
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
53
+ },
54
+ files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"files": files})),
55
+ headers=jsonable_encoder(
56
+ remove_none_from_dict(
57
+ {
58
+ **self._client_wrapper.get_headers(),
59
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
60
+ }
61
+ )
62
+ ),
63
+ timeout=request_options.get("timeout_in_seconds")
64
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
65
+ else self._client_wrapper.get_timeout(),
66
+ retries=0,
67
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
68
+ )
69
+ if 200 <= _response.status_code < 300:
70
+ return pydantic_v1.parse_obj_as(UploadDocumentsOut, _response.json()) # type: ignore
71
+ if _response.status_code == 422:
72
+ raise UnprocessableEntityError(
73
+ pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
74
+ )
75
+ try:
76
+ _response_json = _response.json()
77
+ except JSONDecodeError:
78
+ raise ApiError(status_code=_response.status_code, body=_response.text)
79
+ raise ApiError(status_code=_response.status_code, body=_response_json)
80
+
81
+
82
+ class AsyncUploadClient:
83
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
84
+ self._client_wrapper = client_wrapper
85
+
86
+ async def upload_documents(
87
+ self, *, files: typing.List[core.File], request_options: typing.Optional[RequestOptions] = None
88
+ ) -> UploadDocumentsOut:
89
+ """
90
+ Parameters:
91
+ - files: typing.List[core.File]. See core.File for more documentation
92
+
93
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
94
+ ---
95
+ from athena.client import AsyncAthena
96
+
97
+ client = AsyncAthena(
98
+ api_key="YOUR_API_KEY",
99
+ )
100
+ await client.upload.upload_documents()
101
+ """
102
+ _response = await self._client_wrapper.httpx_client.request(
103
+ method="POST",
104
+ url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/upload"),
105
+ params=jsonable_encoder(
106
+ request_options.get("additional_query_parameters") if request_options is not None else None
107
+ ),
108
+ data=jsonable_encoder(remove_none_from_dict({}))
109
+ if request_options is None or request_options.get("additional_body_parameters") is None
110
+ else {
111
+ **jsonable_encoder(remove_none_from_dict({})),
112
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
113
+ },
114
+ files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"files": files})),
115
+ headers=jsonable_encoder(
116
+ remove_none_from_dict(
117
+ {
118
+ **self._client_wrapper.get_headers(),
119
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
120
+ }
121
+ )
122
+ ),
123
+ timeout=request_options.get("timeout_in_seconds")
124
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
125
+ else self._client_wrapper.get_timeout(),
126
+ retries=0,
127
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
128
+ )
129
+ if 200 <= _response.status_code < 300:
130
+ return pydantic_v1.parse_obj_as(UploadDocumentsOut, _response.json()) # type: ignore
131
+ if _response.status_code == 422:
132
+ raise UnprocessableEntityError(
133
+ pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
134
+ )
135
+ try:
136
+ _response_json = _response.json()
137
+ except JSONDecodeError:
138
+ raise ApiError(status_code=_response.status_code, body=_response.text)
139
+ raise ApiError(status_code=_response.status_code, body=_response_json)