agenta 0.12.2__py3-none-any.whl → 0.32.0a1__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 (244) hide show
  1. agenta/__init__.py +64 -7
  2. agenta/cli/helper.py +7 -3
  3. agenta/cli/main.py +15 -50
  4. agenta/cli/variant_commands.py +50 -29
  5. agenta/client/Readme.md +72 -64
  6. agenta/client/api.py +2 -2
  7. agenta/client/backend/__init__.py +193 -22
  8. agenta/client/backend/access_control/__init__.py +1 -0
  9. agenta/client/backend/access_control/client.py +167 -0
  10. agenta/client/backend/apps/__init__.py +1 -0
  11. agenta/client/backend/apps/client.py +1691 -0
  12. agenta/client/backend/bases/__init__.py +1 -0
  13. agenta/client/backend/bases/client.py +190 -0
  14. agenta/client/backend/client.py +2508 -5712
  15. agenta/client/backend/configs/__init__.py +1 -0
  16. agenta/client/backend/configs/client.py +604 -0
  17. agenta/client/backend/containers/__init__.py +5 -0
  18. agenta/client/backend/containers/client.py +648 -0
  19. agenta/client/backend/containers/types/__init__.py +5 -0
  20. agenta/client/backend/{types → containers/types}/container_templates_response.py +1 -2
  21. agenta/client/backend/core/__init__.py +30 -0
  22. agenta/client/backend/core/client_wrapper.py +42 -9
  23. agenta/client/backend/core/file.py +70 -0
  24. agenta/client/backend/core/http_client.py +575 -0
  25. agenta/client/backend/core/jsonable_encoder.py +33 -39
  26. agenta/client/backend/core/pydantic_utilities.py +325 -0
  27. agenta/client/backend/core/query_encoder.py +60 -0
  28. agenta/client/backend/core/remove_none_from_dict.py +2 -2
  29. agenta/client/backend/core/request_options.py +35 -0
  30. agenta/client/backend/core/serialization.py +276 -0
  31. agenta/client/backend/environments/__init__.py +1 -0
  32. agenta/client/backend/environments/client.py +196 -0
  33. agenta/client/backend/evaluations/__init__.py +1 -0
  34. agenta/client/backend/evaluations/client.py +1469 -0
  35. agenta/client/backend/evaluators/__init__.py +1 -0
  36. agenta/client/backend/evaluators/client.py +1283 -0
  37. agenta/client/backend/observability/__init__.py +1 -0
  38. agenta/client/backend/observability/client.py +1286 -0
  39. agenta/client/backend/observability_v_1/__init__.py +5 -0
  40. agenta/client/backend/observability_v_1/client.py +763 -0
  41. agenta/client/backend/observability_v_1/types/__init__.py +7 -0
  42. agenta/client/backend/observability_v_1/types/format.py +5 -0
  43. agenta/client/backend/observability_v_1/types/query_analytics_response.py +7 -0
  44. agenta/client/backend/observability_v_1/types/query_traces_response.py +11 -0
  45. agenta/client/backend/scopes/__init__.py +1 -0
  46. agenta/client/backend/scopes/client.py +114 -0
  47. agenta/client/backend/testsets/__init__.py +1 -0
  48. agenta/client/backend/testsets/client.py +1284 -0
  49. agenta/client/backend/types/__init__.py +154 -26
  50. agenta/client/backend/types/agenta_node_dto.py +48 -0
  51. agenta/client/backend/types/agenta_node_dto_nodes_value.py +6 -0
  52. agenta/client/backend/types/agenta_nodes_response.py +30 -0
  53. agenta/client/backend/types/agenta_root_dto.py +30 -0
  54. agenta/client/backend/types/agenta_roots_response.py +30 -0
  55. agenta/client/backend/types/agenta_tree_dto.py +30 -0
  56. agenta/client/backend/types/agenta_trees_response.py +30 -0
  57. agenta/client/backend/types/aggregated_result.py +16 -31
  58. agenta/client/backend/types/aggregated_result_evaluator_config.py +8 -0
  59. agenta/client/backend/types/analytics_response.py +24 -0
  60. agenta/client/backend/types/app.py +17 -30
  61. agenta/client/backend/types/app_variant_response.py +36 -0
  62. agenta/client/backend/types/app_variant_revision.py +17 -32
  63. agenta/client/backend/types/base_output.py +13 -28
  64. agenta/client/backend/types/body_import_testset.py +15 -31
  65. agenta/client/backend/types/bucket_dto.py +26 -0
  66. agenta/client/backend/types/collect_status_response.py +22 -0
  67. agenta/client/backend/types/config_db.py +16 -31
  68. agenta/client/backend/types/config_dto.py +32 -0
  69. agenta/client/backend/types/config_response_model.py +32 -0
  70. agenta/client/backend/types/correct_answer.py +22 -0
  71. agenta/client/backend/types/create_app_output.py +13 -28
  72. agenta/client/backend/types/create_span.py +45 -0
  73. agenta/client/backend/types/create_trace_response.py +22 -0
  74. agenta/client/backend/types/docker_env_vars.py +13 -28
  75. agenta/client/backend/types/environment_output.py +22 -34
  76. agenta/client/backend/types/environment_output_extended.py +31 -0
  77. agenta/client/backend/types/environment_revision.py +26 -0
  78. agenta/client/backend/types/error.py +22 -0
  79. agenta/client/backend/types/evaluation.py +22 -33
  80. agenta/client/backend/types/evaluation_scenario.py +18 -33
  81. agenta/client/backend/types/evaluation_scenario_input.py +16 -31
  82. agenta/client/backend/types/evaluation_scenario_output.py +17 -30
  83. agenta/client/backend/types/evaluation_scenario_result.py +14 -29
  84. agenta/client/backend/types/evaluation_scenario_score_update.py +21 -0
  85. agenta/client/backend/types/evaluation_status_enum.py +11 -29
  86. agenta/client/backend/types/evaluation_type.py +3 -21
  87. agenta/client/backend/types/evaluator.py +20 -31
  88. agenta/client/backend/types/evaluator_config.py +21 -33
  89. agenta/client/backend/types/evaluator_mapping_output_interface.py +21 -0
  90. agenta/client/backend/types/evaluator_output_interface.py +21 -0
  91. agenta/client/backend/types/exception_dto.py +26 -0
  92. agenta/client/backend/types/get_config_response.py +23 -0
  93. agenta/client/backend/types/header_dto.py +22 -0
  94. agenta/client/backend/types/http_validation_error.py +14 -29
  95. agenta/client/backend/types/human_evaluation.py +18 -34
  96. agenta/client/backend/types/human_evaluation_scenario.py +22 -38
  97. agenta/client/backend/types/human_evaluation_scenario_input.py +13 -28
  98. agenta/client/backend/types/human_evaluation_scenario_output.py +13 -28
  99. agenta/client/backend/types/human_evaluation_scenario_update.py +30 -0
  100. agenta/client/backend/types/human_evaluation_update.py +22 -0
  101. agenta/client/backend/types/image.py +18 -32
  102. agenta/client/backend/types/invite_request.py +16 -30
  103. agenta/client/backend/types/legacy_analytics_response.py +29 -0
  104. agenta/client/backend/types/legacy_data_point.py +27 -0
  105. agenta/client/backend/types/lifecycle_dto.py +24 -0
  106. agenta/client/backend/types/link_dto.py +24 -0
  107. agenta/client/backend/types/list_api_keys_response.py +24 -0
  108. agenta/client/backend/types/llm_run_rate_limit.py +13 -28
  109. agenta/client/backend/types/llm_tokens.py +23 -0
  110. agenta/client/backend/types/metrics_dto.py +24 -0
  111. agenta/client/backend/types/new_human_evaluation.py +27 -0
  112. agenta/client/backend/types/new_testset.py +16 -31
  113. agenta/client/backend/types/node_dto.py +24 -0
  114. agenta/client/backend/types/node_type.py +19 -0
  115. agenta/client/backend/types/o_tel_context_dto.py +22 -0
  116. agenta/client/backend/types/o_tel_event_dto.py +23 -0
  117. agenta/client/backend/types/o_tel_extra_dto.py +26 -0
  118. agenta/client/backend/types/o_tel_link_dto.py +23 -0
  119. agenta/client/backend/types/o_tel_span_dto.py +37 -0
  120. agenta/client/backend/types/o_tel_span_kind.py +15 -0
  121. agenta/client/backend/types/o_tel_spans_response.py +24 -0
  122. agenta/client/backend/types/o_tel_status_code.py +8 -0
  123. agenta/client/backend/types/organization.py +22 -35
  124. agenta/client/backend/types/organization_output.py +13 -28
  125. agenta/client/backend/types/outputs.py +5 -0
  126. agenta/client/backend/types/parent_dto.py +21 -0
  127. agenta/client/backend/types/permission.py +41 -0
  128. agenta/client/backend/types/projects_response.py +28 -0
  129. agenta/client/backend/types/provider_key_dto.py +23 -0
  130. agenta/client/backend/types/provider_kind.py +21 -0
  131. agenta/client/backend/types/reference_dto.py +23 -0
  132. agenta/client/backend/types/reference_request_model.py +23 -0
  133. agenta/client/backend/types/result.py +18 -31
  134. agenta/client/backend/types/root_dto.py +21 -0
  135. agenta/client/backend/types/{human_evaluation_scenario_score.py → score.py} +1 -1
  136. agenta/client/backend/types/secret_dto.py +24 -0
  137. agenta/client/backend/types/{human_evaluation_scenario_update_score.py → secret_kind.py} +1 -1
  138. agenta/client/backend/types/secret_response_dto.py +27 -0
  139. agenta/client/backend/types/simple_evaluation_output.py +13 -28
  140. agenta/client/backend/types/span.py +39 -49
  141. agenta/client/backend/types/span_detail.py +44 -0
  142. agenta/client/backend/types/span_dto.py +54 -0
  143. agenta/client/backend/types/span_dto_nodes_value.py +9 -0
  144. agenta/client/backend/types/span_status_code.py +5 -0
  145. agenta/client/backend/types/span_variant.py +23 -0
  146. agenta/client/backend/types/status_code.py +5 -0
  147. agenta/client/backend/types/status_dto.py +23 -0
  148. agenta/client/backend/types/template.py +14 -29
  149. agenta/client/backend/types/template_image_info.py +21 -35
  150. agenta/client/backend/types/test_set_output_response.py +20 -33
  151. agenta/client/backend/types/test_set_simple_response.py +13 -28
  152. agenta/client/backend/types/time_dto.py +23 -0
  153. agenta/client/backend/types/trace_detail.py +44 -0
  154. agenta/client/backend/types/tree_dto.py +23 -0
  155. agenta/client/backend/types/tree_type.py +5 -0
  156. agenta/client/backend/types/update_app_output.py +22 -0
  157. agenta/client/backend/types/uri.py +13 -28
  158. agenta/client/backend/types/validation_error.py +13 -28
  159. agenta/client/backend/types/variant_action.py +14 -29
  160. agenta/client/backend/types/variant_action_enum.py +1 -19
  161. agenta/client/backend/types/with_pagination.py +26 -0
  162. agenta/client/backend/types/workspace_member_response.py +23 -0
  163. agenta/client/backend/types/workspace_permission.py +25 -0
  164. agenta/client/backend/types/workspace_response.py +29 -0
  165. agenta/client/backend/types/workspace_role.py +15 -0
  166. agenta/client/backend/types/workspace_role_response.py +23 -0
  167. agenta/client/backend/variants/__init__.py +5 -0
  168. agenta/client/backend/variants/client.py +2814 -0
  169. agenta/client/backend/variants/types/__init__.py +7 -0
  170. agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +8 -0
  171. agenta/client/backend/vault/__init__.py +1 -0
  172. agenta/client/backend/vault/client.py +685 -0
  173. agenta/client/client.py +1 -1
  174. agenta/config.py +0 -2
  175. agenta/config.toml +0 -1
  176. agenta/docker/docker-assets/Dockerfile.cloud.template +2 -1
  177. agenta/docker/docker-assets/Dockerfile.template +2 -1
  178. agenta/docker/docker_utils.py +11 -12
  179. agenta/sdk/__init__.py +58 -7
  180. agenta/sdk/agenta_init.py +182 -164
  181. agenta/sdk/assets.py +95 -0
  182. agenta/sdk/client.py +56 -0
  183. agenta/sdk/context/__init__.py +0 -0
  184. agenta/sdk/context/exporting.py +25 -0
  185. agenta/sdk/context/routing.py +27 -0
  186. agenta/sdk/context/tracing.py +28 -0
  187. agenta/sdk/decorators/__init__.py +0 -0
  188. agenta/sdk/decorators/routing.py +576 -0
  189. agenta/sdk/decorators/tracing.py +296 -0
  190. agenta/sdk/litellm/__init__.py +1 -0
  191. agenta/sdk/litellm/litellm.py +314 -0
  192. agenta/sdk/litellm/mockllm.py +27 -0
  193. agenta/sdk/litellm/mocks/__init__.py +26 -0
  194. agenta/sdk/managers/__init__.py +6 -0
  195. agenta/sdk/managers/config.py +208 -0
  196. agenta/sdk/managers/deployment.py +45 -0
  197. agenta/sdk/managers/secrets.py +38 -0
  198. agenta/sdk/managers/shared.py +639 -0
  199. agenta/sdk/managers/variant.py +182 -0
  200. agenta/sdk/managers/vault.py +16 -0
  201. agenta/sdk/middleware/__init__.py +0 -0
  202. agenta/sdk/middleware/auth.py +180 -0
  203. agenta/sdk/middleware/cache.py +47 -0
  204. agenta/sdk/middleware/config.py +255 -0
  205. agenta/sdk/middleware/cors.py +29 -0
  206. agenta/sdk/middleware/inline.py +38 -0
  207. agenta/sdk/middleware/mock.py +33 -0
  208. agenta/sdk/middleware/otel.py +40 -0
  209. agenta/sdk/middleware/vault.py +145 -0
  210. agenta/sdk/router.py +0 -7
  211. agenta/sdk/tracing/__init__.py +1 -0
  212. agenta/sdk/tracing/attributes.py +141 -0
  213. agenta/sdk/tracing/conventions.py +49 -0
  214. agenta/sdk/tracing/exporters.py +103 -0
  215. agenta/sdk/tracing/inline.py +1146 -0
  216. agenta/sdk/tracing/processors.py +121 -0
  217. agenta/sdk/tracing/spans.py +136 -0
  218. agenta/sdk/tracing/tracing.py +237 -0
  219. agenta/sdk/types.py +478 -74
  220. agenta/sdk/utils/__init__.py +0 -0
  221. agenta/sdk/utils/constants.py +1 -0
  222. agenta/sdk/utils/{helper/openai_cost.py → costs.py} +3 -0
  223. agenta/sdk/utils/exceptions.py +59 -0
  224. agenta/sdk/utils/globals.py +6 -10
  225. agenta/sdk/utils/helpers.py +8 -0
  226. agenta/sdk/utils/logging.py +21 -0
  227. agenta/sdk/utils/singleton.py +13 -0
  228. agenta/sdk/utils/timing.py +58 -0
  229. {agenta-0.12.2.dist-info → agenta-0.32.0a1.dist-info}/METADATA +98 -151
  230. agenta-0.32.0a1.dist-info/RECORD +263 -0
  231. {agenta-0.12.2.dist-info → agenta-0.32.0a1.dist-info}/WHEEL +1 -1
  232. agenta/client/backend/types/add_variant_from_base_and_config_response.py +0 -7
  233. agenta/client/backend/types/app_variant_output.py +0 -47
  234. agenta/client/backend/types/app_variant_output_extended.py +0 -50
  235. agenta/client/backend/types/delete_evaluation.py +0 -36
  236. agenta/client/backend/types/evaluation_webhook.py +0 -36
  237. agenta/client/backend/types/feedback.py +0 -40
  238. agenta/client/backend/types/get_config_reponse.py +0 -39
  239. agenta/client/backend/types/list_api_keys_output.py +0 -39
  240. agenta/client/backend/types/trace.py +0 -48
  241. agenta/sdk/agenta_decorator.py +0 -443
  242. agenta/sdk/context.py +0 -41
  243. agenta-0.12.2.dist-info/RECORD +0 -114
  244. {agenta-0.12.2.dist-info → agenta-0.32.0a1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,22 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import pydantic
7
+
8
+
9
+ class Error(UniversalBaseModel):
10
+ message: str
11
+ stacktrace: typing.Optional[str] = None
12
+
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:
18
+
19
+ class Config:
20
+ frozen = True
21
+ smart_union = True
22
+ extra = pydantic.Extra.allow
@@ -1,50 +1,39 @@
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
5
+ from .result import Result
7
6
  from .aggregated_result import AggregatedResult
8
-
9
- try:
10
- import pydantic.v1 as pydantic # type: ignore
11
- except ImportError:
12
- import pydantic # type: ignore
7
+ import datetime as dt
8
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
9
+ import pydantic
13
10
 
14
11
 
15
- class Evaluation(pydantic.BaseModel):
12
+ class Evaluation(UniversalBaseModel):
16
13
  id: str
17
14
  app_id: str
18
- user_id: str
19
- user_username: str
15
+ project_id: str
20
16
  variant_ids: typing.List[str]
21
17
  variant_names: typing.List[str]
22
18
  variant_revision_ids: typing.List[str]
23
19
  revisions: typing.List[str]
24
- testset_id: str
25
- testset_name: str
26
- status: str
20
+ testset_id: typing.Optional[str] = None
21
+ testset_name: typing.Optional[str] = None
22
+ status: Result
27
23
  aggregated_results: typing.List[AggregatedResult]
24
+ average_cost: typing.Optional[Result] = None
25
+ total_cost: typing.Optional[Result] = None
26
+ average_latency: typing.Optional[Result] = None
28
27
  created_at: dt.datetime
29
28
  updated_at: dt.datetime
30
29
 
31
- def json(self, **kwargs: typing.Any) -> str:
32
- kwargs_with_defaults: typing.Any = {
33
- "by_alias": True,
34
- "exclude_unset": True,
35
- **kwargs,
36
- }
37
- return super().json(**kwargs_with_defaults)
38
-
39
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
40
- kwargs_with_defaults: typing.Any = {
41
- "by_alias": True,
42
- "exclude_unset": True,
43
- **kwargs,
44
- }
45
- return super().dict(**kwargs_with_defaults)
30
+ if IS_PYDANTIC_V2:
31
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
32
+ extra="allow", frozen=True
33
+ ) # type: ignore # Pydantic v2
34
+ else:
46
35
 
47
- class Config:
48
- frozen = True
49
- smart_union = True
50
- json_encoders = {dt.datetime: serialize_datetime}
36
+ class Config:
37
+ frozen = True
38
+ smart_union = True
39
+ extra = pydantic.Extra.allow
@@ -1,47 +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 .evaluation_scenario_input import EvaluationScenarioInput
8
6
  from .evaluation_scenario_output import EvaluationScenarioOutput
7
+ from .correct_answer import CorrectAnswer
9
8
  from .evaluation_scenario_result import EvaluationScenarioResult
10
-
11
- try:
12
- import pydantic.v1 as pydantic # type: ignore
13
- except ImportError:
14
- import pydantic # type: ignore
9
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
10
+ import pydantic
15
11
 
16
12
 
17
- class EvaluationScenario(pydantic.BaseModel):
18
- id: typing.Optional[str]
13
+ class EvaluationScenario(UniversalBaseModel):
14
+ id: typing.Optional[str] = None
19
15
  evaluation_id: str
20
16
  inputs: typing.List[EvaluationScenarioInput]
21
17
  outputs: typing.List[EvaluationScenarioOutput]
22
- evaluation: typing.Optional[str]
23
- correct_answer: typing.Optional[str]
24
- is_pinned: typing.Optional[bool]
25
- note: typing.Optional[str]
18
+ correct_answers: typing.Optional[typing.List[CorrectAnswer]] = None
19
+ is_pinned: typing.Optional[bool] = None
20
+ note: typing.Optional[str] = None
26
21
  results: typing.List[EvaluationScenarioResult]
27
22
 
28
- def json(self, **kwargs: typing.Any) -> str:
29
- kwargs_with_defaults: typing.Any = {
30
- "by_alias": True,
31
- "exclude_unset": True,
32
- **kwargs,
33
- }
34
- return super().json(**kwargs_with_defaults)
35
-
36
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
37
- kwargs_with_defaults: typing.Any = {
38
- "by_alias": True,
39
- "exclude_unset": True,
40
- **kwargs,
41
- }
42
- return super().dict(**kwargs_with_defaults)
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:
43
28
 
44
- class Config:
45
- frozen = True
46
- smart_union = True
47
- json_encoders = {dt.datetime: serialize_datetime}
29
+ class Config:
30
+ frozen = True
31
+ smart_union = True
32
+ 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 EvaluationScenarioInput(pydantic.BaseModel):
9
+ class EvaluationScenarioInput(UniversalBaseModel):
15
10
  name: str
16
11
  type: str
17
- value: typing.Optional[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
+ value: typing.Optional[typing.Any] = None
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,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
+ from .result import Result
4
5
  import typing
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import pydantic
5
8
 
6
- from ..core.datetime_utils import serialize_datetime
7
9
 
8
- try:
9
- import pydantic.v1 as pydantic # type: ignore
10
- except ImportError:
11
- import pydantic # type: ignore
10
+ class EvaluationScenarioOutput(UniversalBaseModel):
11
+ result: Result
12
+ cost: typing.Optional[float] = None
13
+ latency: typing.Optional[float] = None
12
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:
13
20
 
14
- class EvaluationScenarioOutput(pydantic.BaseModel):
15
- type: str
16
- value: typing.Optional[typing.Any]
17
-
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)
33
-
34
- class Config:
35
- frozen = True
36
- smart_union = True
37
- json_encoders = {dt.datetime: serialize_datetime}
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
@@ -0,0 +1,21 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
5
+ import typing
6
+ import pydantic
7
+
8
+
9
+ class EvaluationScenarioScoreUpdate(UniversalBaseModel):
10
+ score: float
11
+
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:
17
+
18
+ class Config:
19
+ frozen = True
20
+ smart_union = True
21
+ extra = pydantic.Extra.allow
@@ -1,33 +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_FAILED = "EVALUATION_FAILED"
18
-
19
- def visit(
20
- self,
21
- evaluation_initialized: typing.Callable[[], T_Result],
22
- evaluation_started: typing.Callable[[], T_Result],
23
- evaluation_finished: typing.Callable[[], T_Result],
24
- evaluation_failed: typing.Callable[[], T_Result],
25
- ) -> T_Result:
26
- if self is EvaluationStatusEnum.EVALUATION_INITIALIZED:
27
- return evaluation_initialized()
28
- if self is EvaluationStatusEnum.EVALUATION_STARTED:
29
- return evaluation_started()
30
- if self is EvaluationStatusEnum.EVALUATION_FINISHED:
31
- return evaluation_finished()
32
- if self is EvaluationStatusEnum.EVALUATION_FAILED:
33
- 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,39 +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 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
-
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}
13
+ settings_template: typing.Dict[str, typing.Optional[typing.Any]]
14
+ description: typing.Optional[str] = None
15
+ oss: typing.Optional[bool] = None
16
+ requires_llm_api_keys: typing.Optional[bool] = None
17
+ tags: typing.List[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,41 +1,29 @@
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
12
+ project_id: str
17
13
  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}
14
+ settings_values: typing.Optional[
15
+ typing.Dict[str, typing.Optional[typing.Any]]
16
+ ] = None
17
+ created_at: str
18
+ updated_at: str
19
+
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
22
+ extra="allow", frozen=True
23
+ ) # type: ignore # Pydantic v2
24
+ else:
25
+
26
+ class Config:
27
+ frozen = True
28
+ smart_union = True
29
+ extra = pydantic.Extra.allow
@@ -0,0 +1,21 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import pydantic
7
+
8
+
9
+ class EvaluatorMappingOutputInterface(UniversalBaseModel):
10
+ outputs: typing.Dict[str, typing.Optional[typing.Any]]
11
+
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:
17
+
18
+ class Config:
19
+ frozen = True
20
+ smart_union = True
21
+ extra = pydantic.Extra.allow
@@ -0,0 +1,21 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import pydantic
7
+
8
+
9
+ class EvaluatorOutputInterface(UniversalBaseModel):
10
+ outputs: typing.Dict[str, typing.Optional[typing.Any]]
11
+
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:
17
+
18
+ class Config:
19
+ frozen = True
20
+ smart_union = True
21
+ extra = pydantic.Extra.allow
@@ -0,0 +1,26 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import datetime as dt
5
+ import typing
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import pydantic
8
+
9
+
10
+ class ExceptionDto(UniversalBaseModel):
11
+ timestamp: dt.datetime
12
+ type: str
13
+ message: typing.Optional[str] = None
14
+ stacktrace: typing.Optional[str] = None
15
+ attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = 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
@@ -0,0 +1,23 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import pydantic
7
+
8
+
9
+ class GetConfigResponse(UniversalBaseModel):
10
+ config_name: str
11
+ current_version: int
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
@@ -0,0 +1,22 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import pydantic
7
+
8
+
9
+ class HeaderDto(UniversalBaseModel):
10
+ name: typing.Optional[str] = None
11
+ description: typing.Optional[str] = None
12
+
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:
18
+
19
+ class Config:
20
+ frozen = True
21
+ smart_union = True
22
+ extra = pydantic.Extra.allow