athena-intelligence 0.1.125__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 +161 -61
  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.125.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.125.dist-info → athena_intelligence-0.1.126.dist-info}/WHEEL +1 -1
  58. athena_intelligence-0.1.125.dist-info/RECORD +0 -86
@@ -1,19 +1,19 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ from ...core.client_wrapper import SyncClientWrapper
3
4
  import typing
5
+ from ...core.request_options import RequestOptions
6
+ from ...core.pydantic_utilities import parse_obj_as
4
7
  from json.decoder import JSONDecodeError
5
-
6
8
  from ...core.api_error import ApiError
7
- from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
- from ...core.pydantic_utilities import pydantic_v1
9
- from ...core.request_options import RequestOptions
9
+ from ...core.client_wrapper import AsyncClientWrapper
10
10
 
11
11
 
12
12
  class TasksClient:
13
13
  def __init__(self, *, client_wrapper: SyncClientWrapper):
14
14
  self._client_wrapper = client_wrapper
15
15
 
16
- def run_task(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
16
+ def run_task(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Optional[typing.Any]:
17
17
  """
18
18
  Coming soon! Run a [task](https://resources.athenaintel.com/docs/task-studio/home).
19
19
 
@@ -24,12 +24,12 @@ class TasksClient:
24
24
 
25
25
  Returns
26
26
  -------
27
- typing.Any
27
+ typing.Optional[typing.Any]
28
28
  Successful Response
29
29
 
30
30
  Examples
31
31
  --------
32
- from athena.client import Athena
32
+ from athena import Athena
33
33
 
34
34
  client = Athena(
35
35
  api_key="YOUR_API_KEY",
@@ -37,11 +37,19 @@ class TasksClient:
37
37
  client.tools.tasks.run_task()
38
38
  """
39
39
  _response = self._client_wrapper.httpx_client.request(
40
- "api/v0/tools/tasks/run", method="POST", request_options=request_options
40
+ "api/v0/tools/tasks/run",
41
+ method="POST",
42
+ request_options=request_options,
41
43
  )
42
- if 200 <= _response.status_code < 300:
43
- return pydantic_v1.parse_obj_as(typing.Any, _response.json()) # type: ignore
44
44
  try:
45
+ if 200 <= _response.status_code < 300:
46
+ return typing.cast(
47
+ typing.Optional[typing.Any],
48
+ parse_obj_as(
49
+ type_=typing.Optional[typing.Any], # type: ignore
50
+ object_=_response.json(),
51
+ ),
52
+ )
45
53
  _response_json = _response.json()
46
54
  except JSONDecodeError:
47
55
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -52,7 +60,7 @@ class AsyncTasksClient:
52
60
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
53
61
  self._client_wrapper = client_wrapper
54
62
 
55
- async def run_task(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
63
+ async def run_task(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Optional[typing.Any]:
56
64
  """
57
65
  Coming soon! Run a [task](https://resources.athenaintel.com/docs/task-studio/home).
58
66
 
@@ -63,24 +71,40 @@ class AsyncTasksClient:
63
71
 
64
72
  Returns
65
73
  -------
66
- typing.Any
74
+ typing.Optional[typing.Any]
67
75
  Successful Response
68
76
 
69
77
  Examples
70
78
  --------
71
- from athena.client import AsyncAthena
79
+ import asyncio
80
+
81
+ from athena import AsyncAthena
72
82
 
73
83
  client = AsyncAthena(
74
84
  api_key="YOUR_API_KEY",
75
85
  )
76
- await client.tools.tasks.run_task()
86
+
87
+
88
+ async def main() -> None:
89
+ await client.tools.tasks.run_task()
90
+
91
+
92
+ asyncio.run(main())
77
93
  """
78
94
  _response = await self._client_wrapper.httpx_client.request(
79
- "api/v0/tools/tasks/run", method="POST", request_options=request_options
95
+ "api/v0/tools/tasks/run",
96
+ method="POST",
97
+ request_options=request_options,
80
98
  )
81
- if 200 <= _response.status_code < 300:
82
- return pydantic_v1.parse_obj_as(typing.Any, _response.json()) # type: ignore
83
99
  try:
100
+ if 200 <= _response.status_code < 300:
101
+ return typing.cast(
102
+ typing.Optional[typing.Any],
103
+ parse_obj_as(
104
+ type_=typing.Optional[typing.Any], # type: ignore
105
+ object_=_response.json(),
106
+ ),
107
+ )
84
108
  _response_json = _response.json()
85
109
  except JSONDecodeError:
86
110
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1,42 +1,32 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  from __future__ import annotations
4
-
5
- import datetime as dt
4
+ from ..core.pydantic_utilities import UniversalBaseModel
6
5
  import typing
7
-
8
- from ..core.datetime_utils import serialize_datetime
9
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import pydantic
8
+ from ..core.pydantic_utilities import update_forward_refs
10
9
 
11
10
 
12
- class AssetNode(pydantic_v1.BaseModel):
11
+ class AssetNode(UniversalBaseModel):
13
12
  """
14
13
  Model representing a node in the folder tree.
15
14
  """
16
15
 
17
- children: typing.Optional[typing.Dict[str, typing.Optional[AssetNode]]] = None
16
+ children: typing.Optional[typing.Dict[str, typing.Optional["AssetNode"]]] = None
18
17
  id: str
19
18
  media_type: str
20
19
  name: str
21
20
  type: str
22
21
 
23
- def json(self, **kwargs: typing.Any) -> str:
24
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
25
- return super().json(**kwargs_with_defaults)
26
-
27
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
28
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
29
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
30
-
31
- return deep_union_pydantic_dicts(
32
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
33
- )
22
+ if IS_PYDANTIC_V2:
23
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
24
+ else:
34
25
 
35
- class Config:
36
- frozen = True
37
- smart_union = True
38
- extra = pydantic_v1.Extra.allow
39
- json_encoders = {dt.datetime: serialize_datetime}
26
+ class Config:
27
+ frozen = True
28
+ smart_union = True
29
+ extra = pydantic.Extra.allow
40
30
 
41
31
 
42
- AssetNode.update_forward_refs()
32
+ update_forward_refs(AssetNode)
@@ -1,29 +1,19 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
4
5
  import typing
6
+ import pydantic
5
7
 
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
8
 
9
-
10
- class AssetNotFoundError(pydantic_v1.BaseModel):
9
+ class AssetNotFoundError(UniversalBaseModel):
11
10
  message: str
12
11
 
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_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
19
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
20
-
21
- return deep_union_pydantic_dicts(
22
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
23
- )
12
+ if IS_PYDANTIC_V2:
13
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
14
+ else:
24
15
 
25
- class Config:
26
- frozen = True
27
- smart_union = True
28
- extra = pydantic_v1.Extra.allow
29
- json_encoders = {dt.datetime: serialize_datetime}
16
+ class Config:
17
+ frozen = True
18
+ smart_union = True
19
+ extra = pydantic.Extra.allow
athena/types/chunk.py CHANGED
@@ -1,14 +1,13 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
4
  import typing
5
-
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
5
  from .chunk_content_item import ChunkContentItem
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import pydantic
9
8
 
10
9
 
11
- class Chunk(pydantic_v1.BaseModel):
10
+ class Chunk(UniversalBaseModel):
12
11
  """
13
12
  A chunk of content to extract data from.
14
13
  """
@@ -17,20 +16,11 @@ class Chunk(pydantic_v1.BaseModel):
17
16
  content: typing.List[ChunkContentItem]
18
17
  metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
19
18
 
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_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
26
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
27
-
28
- return deep_union_pydantic_dicts(
29
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
30
- )
19
+ if IS_PYDANTIC_V2:
20
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
21
+ else:
31
22
 
32
- class Config:
33
- frozen = True
34
- smart_union = True
35
- extra = pydantic_v1.Extra.allow
36
- json_encoders = {dt.datetime: serialize_datetime}
23
+ class Config:
24
+ frozen = True
25
+ smart_union = True
26
+ extra = pydantic.Extra.allow
@@ -1,58 +1,38 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  from __future__ import annotations
4
-
5
- import datetime as dt
4
+ from ..core.pydantic_utilities import UniversalBaseModel
6
5
  import typing
7
-
8
- from ..core.datetime_utils import serialize_datetime
9
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import pydantic
10
8
 
11
9
 
12
- class ChunkContentItem_Text(pydantic_v1.BaseModel):
13
- text: str
10
+ class ChunkContentItem_Text(UniversalBaseModel):
14
11
  type: typing.Literal["text"] = "text"
12
+ text: str
15
13
 
16
- def json(self, **kwargs: typing.Any) -> str:
17
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
18
- return super().json(**kwargs_with_defaults)
19
-
20
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
21
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
22
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
23
-
24
- return deep_union_pydantic_dicts(
25
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
26
- )
14
+ if IS_PYDANTIC_V2:
15
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
16
+ else:
27
17
 
28
- class Config:
29
- frozen = True
30
- smart_union = True
31
- extra = pydantic_v1.Extra.allow
32
- json_encoders = {dt.datetime: serialize_datetime}
18
+ class Config:
19
+ frozen = True
20
+ smart_union = True
21
+ extra = pydantic.Extra.allow
33
22
 
34
23
 
35
- class ChunkContentItem_ImageUrl(pydantic_v1.BaseModel):
36
- image_url: typing.Dict[str, str]
24
+ class ChunkContentItem_ImageUrl(UniversalBaseModel):
37
25
  type: typing.Literal["image_url"] = "image_url"
26
+ image_url: typing.Dict[str, str]
38
27
 
39
- def json(self, **kwargs: typing.Any) -> str:
40
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
41
- return super().json(**kwargs_with_defaults)
42
-
43
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
44
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
45
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
46
-
47
- return deep_union_pydantic_dicts(
48
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
49
- )
28
+ if IS_PYDANTIC_V2:
29
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
30
+ else:
50
31
 
51
- class Config:
52
- frozen = True
53
- smart_union = True
54
- extra = pydantic_v1.Extra.allow
55
- json_encoders = {dt.datetime: serialize_datetime}
32
+ class Config:
33
+ frozen = True
34
+ smart_union = True
35
+ extra = pydantic.Extra.allow
56
36
 
57
37
 
58
38
  ChunkContentItem = typing.Union[ChunkContentItem_Text, ChunkContentItem_ImageUrl]
@@ -1,35 +1,25 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
4
- import typing
5
-
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
3
+ from ..core.pydantic_utilities import UniversalBaseModel
8
4
  from .chunk_result_chunk_id import ChunkResultChunkId
5
+ import typing
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import pydantic
9
8
 
10
9
 
11
- class ChunkResult(pydantic_v1.BaseModel):
10
+ class ChunkResult(UniversalBaseModel):
12
11
  """
13
12
  The result of a chunk extraction.
14
13
  """
15
14
 
16
15
  chunk_id: ChunkResultChunkId
17
- chunk_result: typing.Optional[typing.Dict[str, typing.Any]] = None
18
-
19
- def json(self, **kwargs: typing.Any) -> str:
20
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
21
- return super().json(**kwargs_with_defaults)
22
-
23
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
24
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
25
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
16
+ chunk_result: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
26
17
 
27
- return deep_union_pydantic_dicts(
28
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
29
- )
18
+ if IS_PYDANTIC_V2:
19
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
20
+ else:
30
21
 
31
- class Config:
32
- frozen = True
33
- smart_union = True
34
- extra = pydantic_v1.Extra.allow
35
- json_encoders = {dt.datetime: serialize_datetime}
22
+ class Config:
23
+ frozen = True
24
+ smart_union = True
25
+ extra = pydantic.Extra.allow
@@ -1,32 +1,22 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
4
  import typing
5
+ import pydantic
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
5
7
 
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
8
 
9
-
10
- class CustomAgentResponse(pydantic_v1.BaseModel):
11
- result: typing.Dict[str, typing.Any] = pydantic_v1.Field()
9
+ class CustomAgentResponse(UniversalBaseModel):
10
+ result: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field()
12
11
  """
13
12
  The agent's response. Format depends on the specific agent implementation.
14
13
  """
15
14
 
16
- def json(self, **kwargs: typing.Any) -> str:
17
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
18
- return super().json(**kwargs_with_defaults)
19
-
20
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
21
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
22
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
23
-
24
- return deep_union_pydantic_dicts(
25
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
26
- )
15
+ if IS_PYDANTIC_V2:
16
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
17
+ else:
27
18
 
28
- class Config:
29
- frozen = True
30
- smart_union = True
31
- extra = pydantic_v1.Extra.allow
32
- json_encoders = {dt.datetime: serialize_datetime}
19
+ class Config:
20
+ frozen = True
21
+ smart_union = True
22
+ extra = pydantic.Extra.allow
@@ -1,16 +1,15 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
4
  import typing
5
-
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
5
  from .data_frame_request_out_columns_item import DataFrameRequestOutColumnsItem
9
6
  from .data_frame_request_out_data_item_item import DataFrameRequestOutDataItemItem
10
7
  from .data_frame_request_out_index_item import DataFrameRequestOutIndexItem
8
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
9
+ import pydantic
11
10
 
12
11
 
13
- class DataFrameRequestOut(pydantic_v1.BaseModel):
12
+ class DataFrameRequestOut(UniversalBaseModel):
14
13
  """
15
14
  Response model with JSON dataframe representation.
16
15
  """
@@ -19,20 +18,11 @@ class DataFrameRequestOut(pydantic_v1.BaseModel):
19
18
  data: typing.List[typing.List[typing.Optional[DataFrameRequestOutDataItemItem]]]
20
19
  index: typing.Optional[typing.List[typing.Optional[DataFrameRequestOutIndexItem]]] = None
21
20
 
22
- def json(self, **kwargs: typing.Any) -> str:
23
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
24
- return super().json(**kwargs_with_defaults)
25
-
26
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
27
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
28
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
29
-
30
- return deep_union_pydantic_dicts(
31
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
32
- )
21
+ if IS_PYDANTIC_V2:
22
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
23
+ else:
33
24
 
34
- class Config:
35
- frozen = True
36
- smart_union = True
37
- extra = pydantic_v1.Extra.allow
38
- json_encoders = {dt.datetime: serialize_datetime}
25
+ class Config:
26
+ frozen = True
27
+ smart_union = True
28
+ extra = pydantic.Extra.allow
@@ -1,31 +1,21 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
4
5
  import typing
6
+ import pydantic
5
7
 
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
8
 
9
-
10
- class DataFrameUnknownFormatError(pydantic_v1.BaseModel):
9
+ class DataFrameUnknownFormatError(UniversalBaseModel):
11
10
  asset_id: str
12
11
  media_type: str
13
12
  message: str
14
13
 
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_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
21
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
22
-
23
- return deep_union_pydantic_dicts(
24
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
25
- )
14
+ if IS_PYDANTIC_V2:
15
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
16
+ else:
26
17
 
27
- class Config:
28
- frozen = True
29
- smart_union = True
30
- extra = pydantic_v1.Extra.allow
31
- json_encoders = {dt.datetime: serialize_datetime}
18
+ class Config:
19
+ frozen = True
20
+ smart_union = True
21
+ extra = pydantic.Extra.allow
@@ -1,34 +1,24 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
4
  import typing
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import pydantic
5
7
 
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
8
 
9
-
10
- class DocumentChunk(pydantic_v1.BaseModel):
9
+ class DocumentChunk(UniversalBaseModel):
11
10
  """
12
11
  A document chunk.
13
12
  """
14
13
 
15
- metadata: typing.Optional[typing.Dict[str, typing.Any]] = None
14
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
16
15
  page_content: str
17
16
 
18
- def json(self, **kwargs: typing.Any) -> str:
19
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
20
- return super().json(**kwargs_with_defaults)
21
-
22
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
23
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
24
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
25
-
26
- return deep_union_pydantic_dicts(
27
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
28
- )
17
+ if IS_PYDANTIC_V2:
18
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
19
+ else:
29
20
 
30
- class Config:
31
- frozen = True
32
- smart_union = True
33
- extra = pydantic_v1.Extra.allow
34
- json_encoders = {dt.datetime: serialize_datetime}
21
+ class Config:
22
+ frozen = True
23
+ smart_union = True
24
+ extra = pydantic.Extra.allow
@@ -1,32 +1,22 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
4
  import typing
5
+ import pydantic
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
5
7
 
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
8
 
9
-
10
- class DriveAgentResponse(pydantic_v1.BaseModel):
11
- result: typing.Dict[str, typing.Any] = pydantic_v1.Field()
9
+ class DriveAgentResponse(UniversalBaseModel):
10
+ result: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field()
12
11
  """
13
12
  Results of the drive operation
14
13
  """
15
14
 
16
- def json(self, **kwargs: typing.Any) -> str:
17
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
18
- return super().json(**kwargs_with_defaults)
19
-
20
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
21
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
22
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
23
-
24
- return deep_union_pydantic_dicts(
25
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
26
- )
15
+ if IS_PYDANTIC_V2:
16
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
17
+ else:
27
18
 
28
- class Config:
29
- frozen = True
30
- smart_union = True
31
- extra = pydantic_v1.Extra.allow
32
- json_encoders = {dt.datetime: serialize_datetime}
19
+ class Config:
20
+ frozen = True
21
+ smart_union = True
22
+ extra = pydantic.Extra.allow