agenta 0.24.1__py3-none-any.whl → 0.24.2__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.

Potentially problematic release.


This version of agenta might be problematic. Click here for more details.

Files changed (131) hide show
  1. agenta/cli/variant_commands.py +15 -10
  2. agenta/client/Readme.md +72 -64
  3. agenta/client/api.py +1 -1
  4. agenta/client/backend/__init__.py +14 -9
  5. agenta/client/backend/apps/client.py +1669 -0
  6. agenta/client/backend/bases/client.py +190 -0
  7. agenta/client/backend/client.py +2102 -868
  8. agenta/client/backend/configs/client.py +598 -0
  9. agenta/client/backend/containers/client.py +638 -0
  10. agenta/client/backend/{resources/containers → containers}/types/container_templates_response.py +1 -2
  11. agenta/client/backend/core/__init__.py +29 -0
  12. agenta/client/backend/core/client_wrapper.py +42 -9
  13. agenta/client/backend/core/datetime_utils.py +1 -1
  14. agenta/client/backend/core/file.py +43 -0
  15. agenta/client/backend/core/http_client.py +553 -0
  16. agenta/client/backend/core/jsonable_encoder.py +33 -39
  17. agenta/client/backend/core/pydantic_utilities.py +212 -0
  18. agenta/client/backend/core/query_encoder.py +60 -0
  19. agenta/client/backend/core/remove_none_from_dict.py +2 -2
  20. agenta/client/backend/core/request_options.py +32 -0
  21. agenta/client/backend/core/serialization.py +179 -0
  22. agenta/client/backend/environments/client.py +190 -0
  23. agenta/client/backend/evaluations/client.py +1462 -0
  24. agenta/client/backend/evaluators/client.py +911 -0
  25. agenta/client/backend/observability/client.py +1271 -0
  26. agenta/client/backend/testsets/client.py +1132 -0
  27. agenta/client/backend/types/__init__.py +8 -6
  28. agenta/client/backend/types/aggregated_result.py +14 -29
  29. agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -2
  30. agenta/client/backend/types/app.py +13 -28
  31. agenta/client/backend/types/app_variant_response.py +21 -37
  32. agenta/client/backend/types/app_variant_revision.py +17 -32
  33. agenta/client/backend/types/base_output.py +13 -28
  34. agenta/client/backend/types/body_import_testset.py +16 -31
  35. agenta/client/backend/types/config_db.py +16 -31
  36. agenta/client/backend/types/correct_answer.py +22 -0
  37. agenta/client/backend/types/create_app_output.py +13 -28
  38. agenta/client/backend/types/create_span.py +33 -50
  39. agenta/client/backend/types/create_trace_response.py +16 -31
  40. agenta/client/backend/types/docker_env_vars.py +13 -28
  41. agenta/client/backend/types/environment_output.py +21 -36
  42. agenta/client/backend/types/environment_output_extended.py +21 -36
  43. agenta/client/backend/types/environment_revision.py +18 -33
  44. agenta/client/backend/types/error.py +16 -31
  45. agenta/client/backend/types/evaluation.py +20 -34
  46. agenta/client/backend/types/evaluation_scenario.py +18 -33
  47. agenta/client/backend/types/evaluation_scenario_input.py +16 -31
  48. agenta/client/backend/types/evaluation_scenario_output.py +18 -33
  49. agenta/client/backend/types/evaluation_scenario_result.py +14 -29
  50. agenta/client/backend/types/evaluation_scenario_score_update.py +13 -28
  51. agenta/client/backend/types/evaluation_status_enum.py +11 -33
  52. agenta/client/backend/types/evaluation_type.py +3 -21
  53. agenta/client/backend/types/evaluator.py +18 -32
  54. agenta/client/backend/types/evaluator_config.py +20 -33
  55. agenta/client/backend/types/get_config_response.py +16 -31
  56. agenta/client/backend/types/http_validation_error.py +14 -29
  57. agenta/client/backend/types/human_evaluation.py +17 -32
  58. agenta/client/backend/types/human_evaluation_scenario.py +21 -37
  59. agenta/client/backend/types/human_evaluation_scenario_input.py +13 -28
  60. agenta/client/backend/types/human_evaluation_scenario_output.py +13 -28
  61. agenta/client/backend/types/human_evaluation_scenario_update.py +26 -41
  62. agenta/client/backend/types/human_evaluation_update.py +14 -29
  63. agenta/client/backend/types/image.py +18 -33
  64. agenta/client/backend/types/invite_request.py +13 -28
  65. agenta/client/backend/types/list_api_keys_response.py +18 -33
  66. agenta/client/backend/types/llm_run_rate_limit.py +13 -28
  67. agenta/client/backend/types/llm_tokens.py +16 -31
  68. agenta/client/backend/types/lm_providers_enum.py +21 -0
  69. agenta/client/backend/types/new_human_evaluation.py +13 -28
  70. agenta/client/backend/types/new_testset.py +16 -31
  71. agenta/client/backend/types/organization.py +22 -36
  72. agenta/client/backend/types/organization_output.py +13 -28
  73. agenta/client/backend/types/outputs.py +5 -0
  74. agenta/client/backend/types/permission.py +36 -137
  75. agenta/client/backend/types/result.py +17 -32
  76. agenta/client/backend/types/simple_evaluation_output.py +13 -28
  77. agenta/client/backend/types/span.py +23 -38
  78. agenta/client/backend/types/span_detail.py +26 -40
  79. agenta/client/backend/types/span_status_code.py +1 -25
  80. agenta/client/backend/types/span_variant.py +16 -31
  81. agenta/client/backend/types/template.py +14 -29
  82. agenta/client/backend/types/template_image_info.py +21 -35
  83. agenta/client/backend/types/test_set_output_response.py +16 -32
  84. agenta/client/backend/types/test_set_simple_response.py +13 -28
  85. agenta/client/backend/types/trace_detail.py +26 -40
  86. agenta/client/backend/types/update_app_output.py +22 -0
  87. agenta/client/backend/types/uri.py +13 -28
  88. agenta/client/backend/types/validation_error.py +13 -28
  89. agenta/client/backend/types/variant_action.py +14 -29
  90. agenta/client/backend/types/variant_action_enum.py +1 -19
  91. agenta/client/backend/types/with_pagination.py +14 -30
  92. agenta/client/backend/types/workspace_member_response.py +14 -29
  93. agenta/client/backend/types/workspace_permission.py +18 -33
  94. agenta/client/backend/types/workspace_response.py +20 -35
  95. agenta/client/backend/types/workspace_role.py +11 -37
  96. agenta/client/backend/types/workspace_role_response.py +17 -32
  97. agenta/client/backend/variants/client.py +1447 -0
  98. agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +8 -0
  99. agenta/sdk/tracing/llm_tracing.py +10 -12
  100. {agenta-0.24.1.dist-info → agenta-0.24.2.dist-info}/METADATA +1 -1
  101. agenta-0.24.2.dist-info/RECORD +175 -0
  102. agenta/client/backend/resources/__init__.py +0 -31
  103. agenta/client/backend/resources/apps/client.py +0 -977
  104. agenta/client/backend/resources/bases/client.py +0 -127
  105. agenta/client/backend/resources/configs/client.py +0 -377
  106. agenta/client/backend/resources/containers/client.py +0 -383
  107. agenta/client/backend/resources/environments/client.py +0 -131
  108. agenta/client/backend/resources/evaluations/client.py +0 -1008
  109. agenta/client/backend/resources/evaluators/client.py +0 -594
  110. agenta/client/backend/resources/observability/client.py +0 -1187
  111. agenta/client/backend/resources/testsets/client.py +0 -689
  112. agenta/client/backend/resources/variants/client.py +0 -796
  113. agenta/client/backend/resources/variants/types/add_variant_from_base_and_config_response.py +0 -7
  114. agenta/client/backend/types/evaluation_webhook.py +0 -36
  115. agenta/client/backend/types/feedback.py +0 -40
  116. agenta/client/backend/types/span_kind.py +0 -49
  117. agenta-0.24.1.dist-info/RECORD +0 -169
  118. /agenta/client/backend/{resources/apps → apps}/__init__.py +0 -0
  119. /agenta/client/backend/{resources/bases → bases}/__init__.py +0 -0
  120. /agenta/client/backend/{resources/configs → configs}/__init__.py +0 -0
  121. /agenta/client/backend/{resources/containers → containers}/__init__.py +0 -0
  122. /agenta/client/backend/{resources/containers → containers}/types/__init__.py +0 -0
  123. /agenta/client/backend/{resources/environments → environments}/__init__.py +0 -0
  124. /agenta/client/backend/{resources/evaluations → evaluations}/__init__.py +0 -0
  125. /agenta/client/backend/{resources/evaluators → evaluators}/__init__.py +0 -0
  126. /agenta/client/backend/{resources/observability → observability}/__init__.py +0 -0
  127. /agenta/client/backend/{resources/testsets → testsets}/__init__.py +0 -0
  128. /agenta/client/backend/{resources/variants → variants}/__init__.py +0 -0
  129. /agenta/client/backend/{resources/variants → variants}/types/__init__.py +0 -0
  130. {agenta-0.24.1.dist-info → agenta-0.24.2.dist-info}/WHEEL +0 -0
  131. {agenta-0.24.1.dist-info → agenta-0.24.2.dist-info}/entry_points.txt +0 -0
@@ -1,39 +1,24 @@
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
3
+ from ..core.pydantic_utilities import UniversalBaseModel
7
4
  from .result import Result
8
-
9
- try:
10
- import pydantic.v1 as pydantic # type: ignore
11
- except ImportError:
12
- import pydantic # type: ignore
5
+ import typing
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import pydantic
13
8
 
14
9
 
15
- class EvaluationScenarioOutput(pydantic.BaseModel):
10
+ class EvaluationScenarioOutput(UniversalBaseModel):
16
11
  result: Result
17
- cost: typing.Optional[float]
18
- latency: typing.Optional[float]
19
-
20
- def json(self, **kwargs: typing.Any) -> str:
21
- kwargs_with_defaults: typing.Any = {
22
- "by_alias": True,
23
- "exclude_unset": True,
24
- **kwargs,
25
- }
26
- return super().json(**kwargs_with_defaults)
27
-
28
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
29
- kwargs_with_defaults: typing.Any = {
30
- "by_alias": True,
31
- "exclude_unset": True,
32
- **kwargs,
33
- }
34
- return super().dict(**kwargs_with_defaults)
35
-
36
- class Config:
37
- frozen = True
38
- smart_union = True
39
- json_encoders = {dt.datetime: serialize_datetime}
12
+ cost: typing.Optional[float] = None
13
+ latency: typing.Optional[float] = None
14
+
15
+ if IS_PYDANTIC_V2:
16
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
17
+ extra="allow", frozen=True
18
+ ) # type: ignore # Pydantic v2
19
+ else:
20
+
21
+ class Config:
22
+ frozen = True
23
+ smart_union = True
24
+ extra = pydantic.Extra.allow
@@ -1,38 +1,23 @@
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
3
+ from ..core.pydantic_utilities import UniversalBaseModel
7
4
  from .result import Result
8
-
9
- try:
10
- import pydantic.v1 as pydantic # type: ignore
11
- except ImportError:
12
- import pydantic # type: ignore
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import typing
7
+ import pydantic
13
8
 
14
9
 
15
- class EvaluationScenarioResult(pydantic.BaseModel):
10
+ class EvaluationScenarioResult(UniversalBaseModel):
16
11
  evaluator_config: str
17
12
  result: Result
18
13
 
19
- def json(self, **kwargs: typing.Any) -> str:
20
- kwargs_with_defaults: typing.Any = {
21
- "by_alias": True,
22
- "exclude_unset": True,
23
- **kwargs,
24
- }
25
- return super().json(**kwargs_with_defaults)
26
-
27
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
28
- kwargs_with_defaults: typing.Any = {
29
- "by_alias": True,
30
- "exclude_unset": True,
31
- **kwargs,
32
- }
33
- return super().dict(**kwargs_with_defaults)
14
+ if IS_PYDANTIC_V2:
15
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
16
+ extra="allow", frozen=True
17
+ ) # type: ignore # Pydantic v2
18
+ else:
34
19
 
35
- class Config:
36
- frozen = True
37
- smart_union = True
38
- json_encoders = {dt.datetime: serialize_datetime}
20
+ class Config:
21
+ frozen = True
22
+ smart_union = True
23
+ extra = pydantic.Extra.allow
@@ -1,36 +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
8
 
8
- try:
9
- import pydantic.v1 as pydantic # type: ignore
10
- except ImportError:
11
- import pydantic # type: ignore
12
-
13
-
14
- class EvaluationScenarioScoreUpdate(pydantic.BaseModel):
9
+ class EvaluationScenarioScoreUpdate(UniversalBaseModel):
15
10
  score: float
16
11
 
17
- def json(self, **kwargs: typing.Any) -> str:
18
- kwargs_with_defaults: typing.Any = {
19
- "by_alias": True,
20
- "exclude_unset": True,
21
- **kwargs,
22
- }
23
- return super().json(**kwargs_with_defaults)
24
-
25
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
26
- kwargs_with_defaults: typing.Any = {
27
- "by_alias": True,
28
- "exclude_unset": True,
29
- **kwargs,
30
- }
31
- return super().dict(**kwargs_with_defaults)
12
+ if IS_PYDANTIC_V2:
13
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
14
+ extra="allow", frozen=True
15
+ ) # type: ignore # Pydantic v2
16
+ else:
32
17
 
33
- class Config:
34
- frozen = True
35
- smart_union = True
36
- json_encoders = {dt.datetime: serialize_datetime}
18
+ class Config:
19
+ frozen = True
20
+ smart_union = True
21
+ extra = pydantic.Extra.allow
@@ -1,37 +1,15 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import enum
4
3
  import typing
5
4
 
6
- T_Result = typing.TypeVar("T_Result")
7
-
8
-
9
- class EvaluationStatusEnum(str, enum.Enum):
10
- """
11
- An enumeration.
12
- """
13
-
14
- EVALUATION_INITIALIZED = "EVALUATION_INITIALIZED"
15
- EVALUATION_STARTED = "EVALUATION_STARTED"
16
- EVALUATION_FINISHED = "EVALUATION_FINISHED"
17
- EVALUATION_FINISHED_WITH_ERRORS = "EVALUATION_FINISHED_WITH_ERRORS"
18
- EVALUATION_FAILED = "EVALUATION_FAILED"
19
-
20
- def visit(
21
- self,
22
- evaluation_initialized: typing.Callable[[], T_Result],
23
- evaluation_started: typing.Callable[[], T_Result],
24
- evaluation_finished: typing.Callable[[], T_Result],
25
- evaluation_finished_with_errors: typing.Callable[[], T_Result],
26
- evaluation_failed: typing.Callable[[], T_Result],
27
- ) -> T_Result:
28
- if self is EvaluationStatusEnum.EVALUATION_INITIALIZED:
29
- return evaluation_initialized()
30
- if self is EvaluationStatusEnum.EVALUATION_STARTED:
31
- return evaluation_started()
32
- if self is EvaluationStatusEnum.EVALUATION_FINISHED:
33
- return evaluation_finished()
34
- if self is EvaluationStatusEnum.EVALUATION_FINISHED_WITH_ERRORS:
35
- return evaluation_finished_with_errors()
36
- if self is EvaluationStatusEnum.EVALUATION_FAILED:
37
- return evaluation_failed()
5
+ EvaluationStatusEnum = typing.Union[
6
+ typing.Literal[
7
+ "EVALUATION_INITIALIZED",
8
+ "EVALUATION_STARTED",
9
+ "EVALUATION_FINISHED",
10
+ "EVALUATION_FINISHED_WITH_ERRORS",
11
+ "EVALUATION_FAILED",
12
+ "EVALUATION_AGGREGATION_FAILED",
13
+ ],
14
+ typing.Any,
15
+ ]
@@ -1,25 +1,7 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import enum
4
3
  import typing
5
4
 
6
- T_Result = typing.TypeVar("T_Result")
7
-
8
-
9
- class EvaluationType(str, enum.Enum):
10
- """
11
- An enumeration.
12
- """
13
-
14
- HUMAN_A_B_TESTING = "human_a_b_testing"
15
- SINGLE_MODEL_TEST = "single_model_test"
16
-
17
- def visit(
18
- self,
19
- human_a_b_testing: typing.Callable[[], T_Result],
20
- single_model_test: typing.Callable[[], T_Result],
21
- ) -> T_Result:
22
- if self is EvaluationType.HUMAN_A_B_TESTING:
23
- return human_a_b_testing()
24
- if self is EvaluationType.SINGLE_MODEL_TEST:
25
- return single_model_test()
5
+ EvaluationType = typing.Union[
6
+ typing.Literal["human_a_b_testing", "single_model_test"], typing.Any
7
+ ]
@@ -1,40 +1,26 @@
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
8
 
8
- try:
9
- import pydantic.v1 as pydantic # type: ignore
10
- except ImportError:
11
- import pydantic # type: ignore
12
-
13
-
14
- class Evaluator(pydantic.BaseModel):
9
+ class Evaluator(UniversalBaseModel):
15
10
  name: str
16
11
  key: str
17
12
  direct_use: bool
18
- settings_template: typing.Dict[str, typing.Any]
19
- description: typing.Optional[str]
20
-
21
- def json(self, **kwargs: typing.Any) -> str:
22
- kwargs_with_defaults: typing.Any = {
23
- "by_alias": True,
24
- "exclude_unset": True,
25
- **kwargs,
26
- }
27
- return super().json(**kwargs_with_defaults)
28
-
29
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
30
- kwargs_with_defaults: typing.Any = {
31
- "by_alias": True,
32
- "exclude_unset": True,
33
- **kwargs,
34
- }
35
- return super().dict(**kwargs_with_defaults)
36
-
37
- class Config:
38
- frozen = True
39
- smart_union = True
40
- json_encoders = {dt.datetime: serialize_datetime}
13
+ settings_template: typing.Dict[str, typing.Optional[typing.Any]]
14
+ description: typing.Optional[str] = None
15
+ oss: typing.Optional[bool] = None
16
+
17
+ if IS_PYDANTIC_V2:
18
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
19
+ extra="allow", frozen=True
20
+ ) # type: ignore # Pydantic v2
21
+ else:
22
+
23
+ class Config:
24
+ frozen = True
25
+ smart_union = True
26
+ extra = pydantic.Extra.allow
@@ -1,41 +1,28 @@
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
8
 
8
- try:
9
- import pydantic.v1 as pydantic # type: ignore
10
- except ImportError:
11
- import pydantic # type: ignore
12
-
13
-
14
- class EvaluatorConfig(pydantic.BaseModel):
9
+ class EvaluatorConfig(UniversalBaseModel):
15
10
  id: str
16
11
  name: str
17
12
  evaluator_key: str
18
- settings_values: typing.Optional[typing.Dict[str, typing.Any]]
19
- created_at: dt.datetime
20
- updated_at: dt.datetime
21
-
22
- def json(self, **kwargs: typing.Any) -> str:
23
- kwargs_with_defaults: typing.Any = {
24
- "by_alias": True,
25
- "exclude_unset": True,
26
- **kwargs,
27
- }
28
- return super().json(**kwargs_with_defaults)
29
-
30
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
31
- kwargs_with_defaults: typing.Any = {
32
- "by_alias": True,
33
- "exclude_unset": True,
34
- **kwargs,
35
- }
36
- return super().dict(**kwargs_with_defaults)
37
-
38
- class Config:
39
- frozen = True
40
- smart_union = True
41
- json_encoders = {dt.datetime: serialize_datetime}
13
+ settings_values: typing.Optional[
14
+ typing.Dict[str, typing.Optional[typing.Any]]
15
+ ] = None
16
+ created_at: str
17
+ updated_at: str
18
+
19
+ if IS_PYDANTIC_V2:
20
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
21
+ extra="allow", frozen=True
22
+ ) # type: ignore # Pydantic v2
23
+ else:
24
+
25
+ class Config:
26
+ frozen = True
27
+ smart_union = True
28
+ extra = pydantic.Extra.allow
@@ -1,38 +1,23 @@
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
8
 
8
- try:
9
- import pydantic.v1 as pydantic # type: ignore
10
- except ImportError:
11
- import pydantic # type: ignore
12
-
13
-
14
- class GetConfigResponse(pydantic.BaseModel):
9
+ class GetConfigResponse(UniversalBaseModel):
15
10
  config_name: str
16
11
  current_version: int
17
- parameters: typing.Dict[str, typing.Any]
18
-
19
- def json(self, **kwargs: typing.Any) -> str:
20
- kwargs_with_defaults: typing.Any = {
21
- "by_alias": True,
22
- "exclude_unset": True,
23
- **kwargs,
24
- }
25
- return super().json(**kwargs_with_defaults)
26
-
27
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
28
- kwargs_with_defaults: typing.Any = {
29
- "by_alias": True,
30
- "exclude_unset": True,
31
- **kwargs,
32
- }
33
- return super().dict(**kwargs_with_defaults)
34
-
35
- class Config:
36
- frozen = True
37
- smart_union = True
38
- json_encoders = {dt.datetime: serialize_datetime}
12
+ parameters: typing.Dict[str, typing.Optional[typing.Any]]
13
+
14
+ if IS_PYDANTIC_V2:
15
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
16
+ extra="allow", frozen=True
17
+ ) # type: ignore # Pydantic v2
18
+ else:
19
+
20
+ class Config:
21
+ frozen = True
22
+ smart_union = True
23
+ extra = pydantic.Extra.allow
@@ -1,37 +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
-
6
- from ..core.datetime_utils import serialize_datetime
7
5
  from .validation_error import ValidationError
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import pydantic
8
8
 
9
- try:
10
- import pydantic.v1 as pydantic # type: ignore
11
- except ImportError:
12
- import pydantic # type: ignore
13
-
14
-
15
- class HttpValidationError(pydantic.BaseModel):
16
- detail: typing.Optional[typing.List[ValidationError]]
17
9
 
18
- def json(self, **kwargs: typing.Any) -> str:
19
- kwargs_with_defaults: typing.Any = {
20
- "by_alias": True,
21
- "exclude_unset": True,
22
- **kwargs,
23
- }
24
- return super().json(**kwargs_with_defaults)
10
+ class HttpValidationError(UniversalBaseModel):
11
+ detail: typing.Optional[typing.List[ValidationError]] = None
25
12
 
26
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
27
- kwargs_with_defaults: typing.Any = {
28
- "by_alias": True,
29
- "exclude_unset": True,
30
- **kwargs,
31
- }
32
- return super().dict(**kwargs_with_defaults)
13
+ if IS_PYDANTIC_V2:
14
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
15
+ extra="allow", frozen=True
16
+ ) # type: ignore # Pydantic v2
17
+ else:
33
18
 
34
- class Config:
35
- frozen = True
36
- smart_union = True
37
- json_encoders = {dt.datetime: serialize_datetime}
19
+ class Config:
20
+ frozen = True
21
+ smart_union = True
22
+ extra = pydantic.Extra.allow
@@ -1,17 +1,12 @@
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
8
 
8
- try:
9
- import pydantic.v1 as pydantic # type: ignore
10
- except ImportError:
11
- import pydantic # type: ignore
12
-
13
-
14
- class HumanEvaluation(pydantic.BaseModel):
9
+ class HumanEvaluation(UniversalBaseModel):
15
10
  id: str
16
11
  app_id: str
17
12
  user_id: str
@@ -24,26 +19,16 @@ class HumanEvaluation(pydantic.BaseModel):
24
19
  testset_id: str
25
20
  testset_name: str
26
21
  status: str
27
- created_at: dt.datetime
28
- updated_at: dt.datetime
29
-
30
- def json(self, **kwargs: typing.Any) -> str:
31
- kwargs_with_defaults: typing.Any = {
32
- "by_alias": True,
33
- "exclude_unset": True,
34
- **kwargs,
35
- }
36
- return super().json(**kwargs_with_defaults)
37
-
38
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
39
- kwargs_with_defaults: typing.Any = {
40
- "by_alias": True,
41
- "exclude_unset": True,
42
- **kwargs,
43
- }
44
- return super().dict(**kwargs_with_defaults)
45
-
46
- class Config:
47
- frozen = True
48
- smart_union = True
49
- json_encoders = {dt.datetime: serialize_datetime}
22
+ created_at: str
23
+ updated_at: str
24
+
25
+ if IS_PYDANTIC_V2:
26
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
27
+ extra="allow", frozen=True
28
+ ) # type: ignore # Pydantic v2
29
+ else:
30
+
31
+ class Config:
32
+ frozen = True
33
+ smart_union = True
34
+ extra = pydantic.Extra.allow
@@ -1,48 +1,32 @@
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
5
  from .human_evaluation_scenario_input import HumanEvaluationScenarioInput
8
6
  from .human_evaluation_scenario_output import HumanEvaluationScenarioOutput
9
7
  from .score import Score
10
-
11
- try:
12
- import pydantic.v1 as pydantic # type: ignore
13
- except ImportError:
14
- import pydantic # type: ignore
8
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
9
+ import pydantic
15
10
 
16
11
 
17
- class HumanEvaluationScenario(pydantic.BaseModel):
18
- id: typing.Optional[str]
12
+ class HumanEvaluationScenario(UniversalBaseModel):
13
+ id: typing.Optional[str] = None
19
14
  evaluation_id: str
20
15
  inputs: typing.List[HumanEvaluationScenarioInput]
21
16
  outputs: typing.List[HumanEvaluationScenarioOutput]
22
- vote: typing.Optional[str]
23
- score: typing.Optional[Score]
24
- evaluation: typing.Optional[str]
25
- correct_answer: typing.Optional[str]
26
- is_pinned: typing.Optional[bool]
27
- note: typing.Optional[str]
28
-
29
- def json(self, **kwargs: typing.Any) -> str:
30
- kwargs_with_defaults: typing.Any = {
31
- "by_alias": True,
32
- "exclude_unset": True,
33
- **kwargs,
34
- }
35
- return super().json(**kwargs_with_defaults)
36
-
37
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
38
- kwargs_with_defaults: typing.Any = {
39
- "by_alias": True,
40
- "exclude_unset": True,
41
- **kwargs,
42
- }
43
- return super().dict(**kwargs_with_defaults)
44
-
45
- class Config:
46
- frozen = True
47
- smart_union = True
48
- json_encoders = {dt.datetime: serialize_datetime}
17
+ vote: typing.Optional[str] = None
18
+ score: typing.Optional[Score] = None
19
+ correct_answer: typing.Optional[str] = None
20
+ is_pinned: typing.Optional[bool] = None
21
+ note: typing.Optional[str] = None
22
+
23
+ if IS_PYDANTIC_V2:
24
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
25
+ extra="allow", frozen=True
26
+ ) # type: ignore # Pydantic v2
27
+ else:
28
+
29
+ class Config:
30
+ frozen = True
31
+ smart_union = True
32
+ extra = pydantic.Extra.allow
@@ -1,37 +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
+ 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
8
 
8
- try:
9
- import pydantic.v1 as pydantic # type: ignore
10
- except ImportError:
11
- import pydantic # type: ignore
12
-
13
-
14
- class HumanEvaluationScenarioInput(pydantic.BaseModel):
9
+ class HumanEvaluationScenarioInput(UniversalBaseModel):
15
10
  input_name: str
16
11
  input_value: str
17
12
 
18
- def json(self, **kwargs: typing.Any) -> str:
19
- kwargs_with_defaults: typing.Any = {
20
- "by_alias": True,
21
- "exclude_unset": True,
22
- **kwargs,
23
- }
24
- return super().json(**kwargs_with_defaults)
25
-
26
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
27
- kwargs_with_defaults: typing.Any = {
28
- "by_alias": True,
29
- "exclude_unset": True,
30
- **kwargs,
31
- }
32
- return super().dict(**kwargs_with_defaults)
13
+ if IS_PYDANTIC_V2:
14
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
15
+ extra="allow", frozen=True
16
+ ) # type: ignore # Pydantic v2
17
+ else:
33
18
 
34
- class Config:
35
- frozen = True
36
- smart_union = True
37
- json_encoders = {dt.datetime: serialize_datetime}
19
+ class Config:
20
+ frozen = True
21
+ smart_union = True
22
+ extra = pydantic.Extra.allow