agenta 0.27.0a8__py3-none-any.whl → 0.27.0a12__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.
- agenta/__init__.py +21 -3
- agenta/client/backend/__init__.py +14 -0
- agenta/client/backend/apps/client.py +28 -20
- agenta/client/backend/client.py +25 -2
- agenta/client/backend/containers/client.py +5 -1
- agenta/client/backend/core/__init__.py +2 -1
- agenta/client/backend/core/client_wrapper.py +6 -6
- agenta/client/backend/core/file.py +33 -11
- agenta/client/backend/core/http_client.py +24 -18
- agenta/client/backend/core/pydantic_utilities.py +144 -29
- agenta/client/backend/core/request_options.py +3 -0
- agenta/client/backend/core/serialization.py +139 -42
- agenta/client/backend/evaluations/client.py +7 -2
- agenta/client/backend/evaluators/client.py +349 -1
- agenta/client/backend/observability/client.py +11 -2
- agenta/client/backend/testsets/client.py +10 -10
- agenta/client/backend/types/__init__.py +14 -0
- agenta/client/backend/types/app.py +1 -0
- agenta/client/backend/types/app_variant_response.py +3 -1
- agenta/client/backend/types/config_dto.py +32 -0
- agenta/client/backend/types/config_response_model.py +32 -0
- agenta/client/backend/types/create_span.py +3 -2
- agenta/client/backend/types/environment_output.py +1 -0
- agenta/client/backend/types/environment_output_extended.py +1 -0
- agenta/client/backend/types/evaluation.py +1 -2
- agenta/client/backend/types/evaluator.py +2 -0
- agenta/client/backend/types/evaluator_config.py +1 -0
- agenta/client/backend/types/evaluator_mapping_output_interface.py +21 -0
- agenta/client/backend/types/evaluator_output_interface.py +21 -0
- agenta/client/backend/types/human_evaluation.py +1 -2
- agenta/client/backend/types/lifecycle_dto.py +24 -0
- agenta/client/backend/types/llm_tokens.py +2 -2
- agenta/client/backend/types/reference_dto.py +23 -0
- agenta/client/backend/types/reference_request_model.py +23 -0
- agenta/client/backend/types/span.py +1 -0
- agenta/client/backend/types/span_detail.py +7 -1
- agenta/client/backend/types/test_set_output_response.py +5 -2
- agenta/client/backend/types/trace_detail.py +7 -1
- agenta/client/backend/types/with_pagination.py +4 -2
- agenta/client/backend/variants/client.py +1565 -272
- agenta/sdk/__init__.py +19 -5
- agenta/sdk/agenta_init.py +21 -7
- agenta/sdk/context/routing.py +6 -5
- agenta/sdk/decorators/routing.py +16 -5
- agenta/sdk/decorators/tracing.py +16 -9
- agenta/sdk/litellm/litellm.py +47 -36
- agenta/sdk/managers/__init__.py +6 -0
- agenta/sdk/managers/config.py +318 -0
- agenta/sdk/managers/deployment.py +45 -0
- agenta/sdk/managers/shared.py +639 -0
- agenta/sdk/managers/variant.py +182 -0
- agenta/sdk/tracing/exporters.py +10 -1
- agenta/sdk/tracing/inline.py +45 -0
- agenta/sdk/tracing/processors.py +34 -7
- agenta/sdk/tracing/tracing.py +0 -10
- agenta/sdk/types.py +47 -2
- agenta/sdk/utils/exceptions.py +31 -1
- {agenta-0.27.0a8.dist-info → agenta-0.27.0a12.dist-info}/METADATA +1 -1
- {agenta-0.27.0a8.dist-info → agenta-0.27.0a12.dist-info}/RECORD +61 -50
- agenta/sdk/config_manager.py +0 -205
- {agenta-0.27.0a8.dist-info → agenta-0.27.0a12.dist-info}/WHEEL +0 -0
- {agenta-0.27.0a8.dist-info → agenta-0.27.0a12.dist-info}/entry_points.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
agenta/__init__.py,sha256=
|
|
1
|
+
agenta/__init__.py,sha256=ApHqZRQ4zkvpfKPKFgGVxc5UVM4suXddAyGheyowc2A,1484
|
|
2
2
|
agenta/cli/evaluation_commands.py,sha256=fs6492tprPId9p8eGO02Xy-NCBm2RZNJLZWcUxugwd8,474
|
|
3
3
|
agenta/cli/helper.py,sha256=P97HbNb_qzOyl5CM_MjAqWEBCdgebU6M81G_4UCmF1A,6288
|
|
4
4
|
agenta/cli/main.py,sha256=Wz0ODhoeKK3Qg_CFUhu6D909szk05tc8ZVBB6H1-w7k,9763
|
|
@@ -9,61 +9,63 @@ agenta/client/Readme.md,sha256=K-By3bNRzUIN5VgQ98pKjw4DgCM-JlcxbW0Fsj02P6M,2903
|
|
|
9
9
|
agenta/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
agenta/client/api.py,sha256=r5pwYD8DWppDrV4xaNYwUmwMLjWVNfVzxK_clIboEWg,2434
|
|
11
11
|
agenta/client/api_models.py,sha256=zebfE2-0-SW1SvzyarzmSJMXqyiCLKrX2sHpzoX-RnU,623
|
|
12
|
-
agenta/client/backend/__init__.py,sha256
|
|
12
|
+
agenta/client/backend/__init__.py,sha256=Vsyg0Ir_ltqqf7uXz3dOkVLbaQ_H-pRn2EuJmIuo-dU,4367
|
|
13
13
|
agenta/client/backend/apps/__init__.py,sha256=9mUnTDeA1TxYvkj1l01A1prqsJV0ERRY2tzkY1fA4MQ,64
|
|
14
|
-
agenta/client/backend/apps/client.py,sha256=
|
|
14
|
+
agenta/client/backend/apps/client.py,sha256=UWLU8uGURZ2apjpAdqhAHsLTR3lSbaTNfdfMnibXzlA,54436
|
|
15
15
|
agenta/client/backend/bases/__init__.py,sha256=9mUnTDeA1TxYvkj1l01A1prqsJV0ERRY2tzkY1fA4MQ,64
|
|
16
16
|
agenta/client/backend/bases/client.py,sha256=BZsz5eXaa2voZdJXqgd5J5hPUuYvWwIcPCWyl49w-oY,6028
|
|
17
|
-
agenta/client/backend/client.py,sha256=
|
|
17
|
+
agenta/client/backend/client.py,sha256=Di3OBcvZyWv6ZRAalwkJBnPUSv8XXiZrEidy9pBR6KI,103415
|
|
18
18
|
agenta/client/backend/configs/__init__.py,sha256=9mUnTDeA1TxYvkj1l01A1prqsJV0ERRY2tzkY1fA4MQ,64
|
|
19
19
|
agenta/client/backend/configs/client.py,sha256=qtrRdRuNIZBjh9Ykj7eNKhocp7dFdFQoDSbUduVjKJ0,19089
|
|
20
20
|
agenta/client/backend/containers/__init__.py,sha256=Haw2PwiPhNvM26PLQN57jY0bN-QqPoDG4VA-P_uGL3A,153
|
|
21
|
-
agenta/client/backend/containers/client.py,sha256=
|
|
21
|
+
agenta/client/backend/containers/client.py,sha256=rjN5yIBTt7BgxcSSFOvo1tJBUBO4WSDt9_EtLzxii_Y,20279
|
|
22
22
|
agenta/client/backend/containers/types/__init__.py,sha256=b6yQ-p_vsI5cpKh-Qa8xNE-M5nLHjfBvfgD4JIhqEkY,176
|
|
23
23
|
agenta/client/backend/containers/types/container_templates_response.py,sha256=IFmEkCII_FebAt3ENZByzAYXMB1vgQEeIaSPTLSzG5M,189
|
|
24
|
-
agenta/client/backend/core/__init__.py,sha256=
|
|
24
|
+
agenta/client/backend/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
|
|
25
25
|
agenta/client/backend/core/api_error.py,sha256=TtMtCdxXjd7Tasc9c8ooFg124nPrb2MXG-tKOXV4u9I,440
|
|
26
|
-
agenta/client/backend/core/client_wrapper.py,sha256=
|
|
26
|
+
agenta/client/backend/core/client_wrapper.py,sha256=esOteB9jDmUGJkv6EotT54nPNU42TR_kjF3pPjU6lqY,1817
|
|
27
27
|
agenta/client/backend/core/datetime_utils.py,sha256=BHjt_H3WVslcuPsr6qjJoVif_SsdLvFN0c43ABE5UiQ,1069
|
|
28
|
-
agenta/client/backend/core/file.py,sha256=
|
|
29
|
-
agenta/client/backend/core/http_client.py,sha256=
|
|
28
|
+
agenta/client/backend/core/file.py,sha256=a6kBDHyD9Za_ZiNbn1I4feRneqUepSUkFEQUKjAjrKA,2369
|
|
29
|
+
agenta/client/backend/core/http_client.py,sha256=dPzS0GHwn_j2Javq2u_w1kVju3c-LTDseeziUNI1k5U,20738
|
|
30
30
|
agenta/client/backend/core/jsonable_encoder.py,sha256=SHXw4G4n-f0IPgNkxj_-Fip3kN8NUAI-YrKxdZw8kl0,3662
|
|
31
|
-
agenta/client/backend/core/pydantic_utilities.py,sha256=
|
|
31
|
+
agenta/client/backend/core/pydantic_utilities.py,sha256=BZTSULs3wlfRQwTtsEyKlyY6SkHCtf3WxHqfhH9YSG4,12325
|
|
32
32
|
agenta/client/backend/core/query_encoder.py,sha256=8qYl5VPl1jU4cDF0X7oSU_DXjlVWY5ayigFBpNTMGOA,2150
|
|
33
33
|
agenta/client/backend/core/remove_none_from_dict.py,sha256=EU9SGgYidWq7SexuJbNs4-PZ-5Bl3Vppd864mS6vQZw,342
|
|
34
|
-
agenta/client/backend/core/request_options.py,sha256=
|
|
35
|
-
agenta/client/backend/core/serialization.py,sha256=
|
|
34
|
+
agenta/client/backend/core/request_options.py,sha256=h0QUNCFVdCW_7GclVySCAY2w4NhtXVBUCmHgmzaxpcg,1681
|
|
35
|
+
agenta/client/backend/core/serialization.py,sha256=1VIoFHrJZZgjx5kxsUnUDbgr2v66GFgMJ_J1mqexBXA,9643
|
|
36
36
|
agenta/client/backend/environments/__init__.py,sha256=9mUnTDeA1TxYvkj1l01A1prqsJV0ERRY2tzkY1fA4MQ,64
|
|
37
37
|
agenta/client/backend/environments/client.py,sha256=JG980MafNEcMX60gCtLdPQb8Ja6R603CKBPTD2Vz-qo,6038
|
|
38
38
|
agenta/client/backend/errors/__init__.py,sha256=pbbVUFtB9LCocA1RMWMMF_RKjsy5YkOKX5BAuE49w6g,170
|
|
39
39
|
agenta/client/backend/errors/unprocessable_entity_error.py,sha256=FvR7XPlV3Xx5nu8HNlmLhBRdk4so_gCHjYT5PyZe6sM,313
|
|
40
40
|
agenta/client/backend/evaluations/__init__.py,sha256=9mUnTDeA1TxYvkj1l01A1prqsJV0ERRY2tzkY1fA4MQ,64
|
|
41
|
-
agenta/client/backend/evaluations/client.py,sha256=
|
|
41
|
+
agenta/client/backend/evaluations/client.py,sha256=T7sDKXeuiihQqxW_TIGrcSShCxduZ2QqjK80nTbTg0w,46698
|
|
42
42
|
agenta/client/backend/evaluators/__init__.py,sha256=9mUnTDeA1TxYvkj1l01A1prqsJV0ERRY2tzkY1fA4MQ,64
|
|
43
|
-
agenta/client/backend/evaluators/client.py,sha256=
|
|
43
|
+
agenta/client/backend/evaluators/client.py,sha256=fdfb0ZFLP-kI5jXr6F3O-wKWvWBGUXhqRXIoetyN-zQ,40405
|
|
44
44
|
agenta/client/backend/observability/__init__.py,sha256=9mUnTDeA1TxYvkj1l01A1prqsJV0ERRY2tzkY1fA4MQ,64
|
|
45
|
-
agenta/client/backend/observability/client.py,sha256=
|
|
45
|
+
agenta/client/backend/observability/client.py,sha256=Fr17rjbAeb41G64thBv2FnxiDeiChMUa1b8EwH5V8tI,39687
|
|
46
46
|
agenta/client/backend/testsets/__init__.py,sha256=9mUnTDeA1TxYvkj1l01A1prqsJV0ERRY2tzkY1fA4MQ,64
|
|
47
|
-
agenta/client/backend/testsets/client.py,sha256=
|
|
48
|
-
agenta/client/backend/types/__init__.py,sha256=
|
|
47
|
+
agenta/client/backend/testsets/client.py,sha256=awjS8DjX08FnEgr6LtMHroK9ysMkLqKAZHh2_1-rldE,35201
|
|
48
|
+
agenta/client/backend/types/__init__.py,sha256=GOXeKXtxRWLGTo_bpwdEw_5ilqF4pn5htQ1Zn-0I6Ko,5723
|
|
49
49
|
agenta/client/backend/types/aggregated_result.py,sha256=4WPjBzQSyPW-Q91XuBbtsicHtupzAFgnz065jpYVKi0,747
|
|
50
50
|
agenta/client/backend/types/aggregated_result_evaluator_config.py,sha256=GzU358rxyXbiDvpf9i6LqSTaHuirZV8XoodAdPKi-uY,243
|
|
51
|
-
agenta/client/backend/types/app.py,sha256=
|
|
52
|
-
agenta/client/backend/types/app_variant_response.py,sha256=
|
|
51
|
+
agenta/client/backend/types/app.py,sha256=hMPKPAx4sSUM6TSv-KzqtaJni7Kf277KVG2cbSXSIOg,608
|
|
52
|
+
agenta/client/backend/types/app_variant_response.py,sha256=lFrl63ZTceAjMvLYQyIruRUF4ycQ4bB-OXuJtPqqQ6E,1094
|
|
53
53
|
agenta/client/backend/types/app_variant_revision.py,sha256=PlBmaus97LdGhUHcIVdNEvfsYvsKnmtoupjAvclecRY,681
|
|
54
54
|
agenta/client/backend/types/base_output.py,sha256=_cYuHdi6THNGEeDmvTb1yo82JlvV9-aCVLHcl4Q-UCY,597
|
|
55
55
|
agenta/client/backend/types/body_import_testset.py,sha256=J-AH8SkA6mWgNZ5vIz12xpnhPCdZybctxQ5INVxhxgc,696
|
|
56
56
|
agenta/client/backend/types/config_db.py,sha256=nCM_3WKTCP3zko26wys5wTSn2cun9OYclwMp_vY5qjE,666
|
|
57
|
+
agenta/client/backend/types/config_dto.py,sha256=x13NXqJd46LDN5w5ejj93HkeZay_nYWvH-7xq3yVM90,1207
|
|
58
|
+
agenta/client/backend/types/config_response_model.py,sha256=v14K15XdzX9dSYb3I6Q0BMneGaKKbrmXsJTk6xAkr20,1217
|
|
57
59
|
agenta/client/backend/types/correct_answer.py,sha256=khEHspf9nszpzhswc7rSruCrcmvVdHFm7ti8JRdpXyI,592
|
|
58
60
|
agenta/client/backend/types/create_app_output.py,sha256=0_avs1u3pIU14P5ut1WOUrravDwpg2GkSj8kYsAMK9Y,600
|
|
59
|
-
agenta/client/backend/types/create_span.py,sha256=
|
|
61
|
+
agenta/client/backend/types/create_span.py,sha256=ZMWlTli2MNowD66D1O2e5ZKOE0BGD_-J36_A_a3rsxE,1609
|
|
60
62
|
agenta/client/backend/types/create_trace_response.py,sha256=Pr1NM9nLHiPVzCP8m7VQ1NIb92fOhJTmMlEUK6FrykI,643
|
|
61
63
|
agenta/client/backend/types/docker_env_vars.py,sha256=td2vhkHyYCwIC_TjlUu7hDuIXsfSJH2L7J_wGaNvw_c,600
|
|
62
|
-
agenta/client/backend/types/environment_output.py,sha256=
|
|
63
|
-
agenta/client/backend/types/environment_output_extended.py,sha256=
|
|
64
|
+
agenta/client/backend/types/environment_output.py,sha256=L0KSiTXy4tFrrplV-YnyrsBzRB25E8QSEPTQC9BWBd0,933
|
|
65
|
+
agenta/client/backend/types/environment_output_extended.py,sha256=Sr5cVBZAKekddwQPOIsMmt9diaPTsOWpyzZzOFOFxLs,1043
|
|
64
66
|
agenta/client/backend/types/environment_revision.py,sha256=fZPYZCnXAiRZSp9trp4huruCUcaanyrXnC7WF6-GhXg,748
|
|
65
67
|
agenta/client/backend/types/error.py,sha256=9efIET--nIU5El4GNEdYvkhtqIF5LtgxniKg0SookgE,617
|
|
66
|
-
agenta/client/backend/types/evaluation.py,sha256=
|
|
68
|
+
agenta/client/backend/types/evaluation.py,sha256=BtOUgIkgU-FEzVNbY2IJl0ZSVhwiIe7630hLl3f9k18,1218
|
|
67
69
|
agenta/client/backend/types/evaluation_scenario.py,sha256=AAEZS19leBYMF5ZTlXFCD5ZqAIpu1iHnN7V5KVXtKAA,1168
|
|
68
70
|
agenta/client/backend/types/evaluation_scenario_input.py,sha256=KQYQIL6RXa2C2K6JNwZXXlW9nFYw-xqCJqY5qlp8mco,648
|
|
69
71
|
agenta/client/backend/types/evaluation_scenario_output.py,sha256=-XoVgjhJryWb3XrFuEQ0s0O3TV3BsHQltehYUnxThzA,704
|
|
@@ -71,11 +73,13 @@ agenta/client/backend/types/evaluation_scenario_result.py,sha256=wOs3-2ucAL6rizT
|
|
|
71
73
|
agenta/client/backend/types/evaluation_scenario_score_update.py,sha256=xkyk7DKj99WkuWcOTOmTZ67G_GIaBVTrGUuy7Erfjec,597
|
|
72
74
|
agenta/client/backend/types/evaluation_status_enum.py,sha256=U0yabhF9EZqb0MU13MhLsuOa2wQmUQHGWDS0qawwvfE,370
|
|
73
75
|
agenta/client/backend/types/evaluation_type.py,sha256=FaI9rLp1QBUl5EE9xKtlxFhCDdcKGOx8NPcAWn3ct5o,186
|
|
74
|
-
agenta/client/backend/types/evaluator.py,sha256=
|
|
75
|
-
agenta/client/backend/types/evaluator_config.py,sha256=
|
|
76
|
+
agenta/client/backend/types/evaluator.py,sha256=Ye9m3jEg65hKsJlqWVDxNnlSNXCJAzxFX-KG7qGCPTM,843
|
|
77
|
+
agenta/client/backend/types/evaluator_config.py,sha256=3CIFKMdXJbxixiojihQSCUenr_6UlXG_0IgoCCEvdeQ,780
|
|
78
|
+
agenta/client/backend/types/evaluator_mapping_output_interface.py,sha256=KiQzlq7UCks_32TcMeF9nqYQUJK8jpxIL7HYi5ar-7s,641
|
|
79
|
+
agenta/client/backend/types/evaluator_output_interface.py,sha256=r4aU7-fUBMvdXzbJIeQ9aoFiIhH58Ofmkn_BKpTMJko,634
|
|
76
80
|
agenta/client/backend/types/get_config_response.py,sha256=uNaeYEq3VCNm3uZ1mNnxBhDzrNz0LYjuz984ASEk5Fk,676
|
|
77
81
|
agenta/client/backend/types/http_validation_error.py,sha256=bMxjckCqPguIznV-z-517GS-d2EXC9wJEg0XCcQfq_E,681
|
|
78
|
-
agenta/client/backend/types/human_evaluation.py,sha256=
|
|
82
|
+
agenta/client/backend/types/human_evaluation.py,sha256=jUNYGW6zp4UWB-SOY1oOB6FX_HtJ32cKRjUlXQzvllk,883
|
|
79
83
|
agenta/client/backend/types/human_evaluation_scenario.py,sha256=GZFGdki4Rlfly7RUhNrWpS2x8N0fHelHdk55YtxY3l0,1127
|
|
80
84
|
agenta/client/backend/types/human_evaluation_scenario_input.py,sha256=4iT1sH_hM6gOFmVicewPONFOvz_cW-Dh6HoNU-tCC0E,620
|
|
81
85
|
agenta/client/backend/types/human_evaluation_scenario_output.py,sha256=yVEFImNXK3qSy83AL3X5qypUOgJ__fumLj1bNgXgPXk,624
|
|
@@ -83,9 +87,10 @@ agenta/client/backend/types/human_evaluation_scenario_update.py,sha256=eh33QTkJN
|
|
|
83
87
|
agenta/client/backend/types/human_evaluation_update.py,sha256=PDtYJDYLEfYRaJuG6eqavgXpNhE-LDK81i9qNo7QD7s,686
|
|
84
88
|
agenta/client/backend/types/image.py,sha256=Q8mnZynlIHHwlu3XRarjJAzgfadl87qPJ-fqH2WqQBw,722
|
|
85
89
|
agenta/client/backend/types/invite_request.py,sha256=ZYcO4_O5Jjnz6uDwcFUoQ1Bn-A0F9t2S3rQTx9arwJc,607
|
|
90
|
+
agenta/client/backend/types/lifecycle_dto.py,sha256=jgOgDkq5m2zQ2S2d4USivPi-sZ2J0eaadwYv2LnghYU,742
|
|
86
91
|
agenta/client/backend/types/list_api_keys_response.py,sha256=av8nz-yhcOYiLZEfnJDxr37W7r1C8VnLLoeSgJwQSY0,701
|
|
87
92
|
agenta/client/backend/types/llm_run_rate_limit.py,sha256=XiPGznCpdS-lPDiswj6pX5aIxhMuOfGCOda7IPcB0q8,659
|
|
88
|
-
agenta/client/backend/types/llm_tokens.py,sha256
|
|
93
|
+
agenta/client/backend/types/llm_tokens.py,sha256=-DLWHVU6spcBAkMjRQaI7QH3D3h6w3iOeHK8RXZcuqI,704
|
|
89
94
|
agenta/client/backend/types/lm_providers_enum.py,sha256=TetfW4xvX51XlTuu7t6OZ6Bvhq4XXIB7Ro8jKnD2wkE,494
|
|
90
95
|
agenta/client/backend/types/new_human_evaluation.py,sha256=Rp_cu_ApObG7QBT-Hkvwer604gO6P3QnVwpIfLv0Q38,764
|
|
91
96
|
agenta/client/backend/types/new_testset.py,sha256=S8ENb_fu5CeyxTvjN5ojXuVoaauNKgfwE738svFhWNY,647
|
|
@@ -93,32 +98,34 @@ agenta/client/backend/types/organization.py,sha256=U8xVumZUcp5GnrRNJIHmaqibnxsVd
|
|
|
93
98
|
agenta/client/backend/types/organization_output.py,sha256=dXkUHfNfp_ho220_sb7EX3YmE2AqYc4rlsYngV3ELBI,595
|
|
94
99
|
agenta/client/backend/types/outputs.py,sha256=iSON-p8Feeq3laC5PK3BFe20GqLGSbYU5eI8viyvw-Y,168
|
|
95
100
|
agenta/client/backend/types/permission.py,sha256=Pwg68fQo2U3sZdyeTYwRBkKGTVsGv3_1gizwREmfuk4,1104
|
|
101
|
+
agenta/client/backend/types/reference_dto.py,sha256=VNLakAy13glLgEPIXH9o_3vcPflPkQJdo0o113lPURc,678
|
|
102
|
+
agenta/client/backend/types/reference_request_model.py,sha256=nhf4VUAfAJ-vf9fbOhcTrxk6uuqMFSoy0NhChY9Y0VQ,687
|
|
96
103
|
agenta/client/backend/types/result.py,sha256=6qD2kzmdzu8q4ywLtAyWLQEDHw-Cu5xN5GLCV-FI7_Y,700
|
|
97
104
|
agenta/client/backend/types/score.py,sha256=OAur_nJtRQmpboZfzFi2l1-zmNxFfETcl13C7OAvpMw,111
|
|
98
105
|
agenta/client/backend/types/simple_evaluation_output.py,sha256=XBm4IVY28brTIYrRQVUK7tFmxUUnqL6nKgVW5_E9PbM,731
|
|
99
|
-
agenta/client/backend/types/span.py,sha256=
|
|
100
|
-
agenta/client/backend/types/span_detail.py,sha256=
|
|
106
|
+
agenta/client/backend/types/span.py,sha256=z3VDnH3vN-NWyP_QLtuJ16N8JVcHt0RUm5ziQ32R1G0,1278
|
|
107
|
+
agenta/client/backend/types/span_detail.py,sha256=cHedPJi4rBouIkQmjfMBoOx9W7TP9t09wlOoqgvIEWs,1410
|
|
101
108
|
agenta/client/backend/types/span_status_code.py,sha256=h1D60dDCfmCI10d79QXPbgpYa4Q3n6LhEsCj9dBaxpU,162
|
|
102
109
|
agenta/client/backend/types/span_variant.py,sha256=MxGbLEYlkTge7mJcvwhhZDXdHUOOH436DEoZ9To_TAk,694
|
|
103
110
|
agenta/client/backend/types/template.py,sha256=O-2LZEElxLj4LbslKqFY8EzlkCzFSwfYMXkHcfh5XM4,651
|
|
104
111
|
agenta/client/backend/types/template_image_info.py,sha256=Bodh11Vi35CNGMmtQgLMjTi8rcUB5oNERcVwHnu4V6c,860
|
|
105
|
-
agenta/client/backend/types/test_set_output_response.py,sha256=
|
|
112
|
+
agenta/client/backend/types/test_set_output_response.py,sha256=RNOj6QtQww1pXgdpWUQTV_1Rozs9eUvNQxag_W4HmWg,767
|
|
106
113
|
agenta/client/backend/types/test_set_simple_response.py,sha256=dNftvPtUnNiGJKP9VzTFnjh3ffKxPocAG4sd45ZbHkg,618
|
|
107
|
-
agenta/client/backend/types/trace_detail.py,sha256=
|
|
114
|
+
agenta/client/backend/types/trace_detail.py,sha256=jGDWzpGi4bJXLs3BXIJGksUGZm6RsqgXi0Q8nvwTtoY,1413
|
|
108
115
|
agenta/client/backend/types/update_app_output.py,sha256=VOZS9MM_eNY2tVD7cnjiP-tUodAbuaRZed7KTONi1-E,600
|
|
109
116
|
agenta/client/backend/types/uri.py,sha256=tiY_sNZOWfG2INOhsthGx9QMnN_5Ibrqi68AkPHyDvw,567
|
|
110
117
|
agenta/client/backend/types/validation_error.py,sha256=nNDCxS4lCvY-79Yfwcnth5a1RXm51EZ_tMCbxnmzbAQ,700
|
|
111
118
|
agenta/client/backend/types/validation_error_loc_item.py,sha256=LAtjCHIllWRBFXvAZ5QZpp7CPXjdtN9EB7HrLVo6EP0,128
|
|
112
119
|
agenta/client/backend/types/variant_action.py,sha256=m3SWsIZF9rPfFSh3ypDA5vawKiTHwI_7_SfhyQO3OoU,645
|
|
113
120
|
agenta/client/backend/types/variant_action_enum.py,sha256=KZzhy-BKA9m8zwZlmoESywDQIn-VGyI2qCRr9-tqaks,158
|
|
114
|
-
agenta/client/backend/types/with_pagination.py,sha256=
|
|
121
|
+
agenta/client/backend/types/with_pagination.py,sha256=NseT9aXCB-cqkDDjlxEkzb1cYqbsDQEaO6tMitToR0g,798
|
|
115
122
|
agenta/client/backend/types/workspace_member_response.py,sha256=-iF-xitcARF6FqGkQKojf06O7GU2oDRbvI0mpu2Clyk,728
|
|
116
123
|
agenta/client/backend/types/workspace_permission.py,sha256=f-e3FUDOIyTmORW2P-K38WOJy3r1g5sZVBl6VUHAt74,791
|
|
117
124
|
agenta/client/backend/types/workspace_response.py,sha256=n1884dwY4C9Gm-JCyprnLfOxAVg4j9SsXL7hQdwsUl8,924
|
|
118
125
|
agenta/client/backend/types/workspace_role.py,sha256=k-ltfq7aAWGg85tTPIf8HpFMMf4gu02_X8R2fFPmB7U,286
|
|
119
126
|
agenta/client/backend/types/workspace_role_response.py,sha256=6hlRcsMmpf6Q0ejLzRKJiZo_9rygazcbJfpPq2jQZVw,693
|
|
120
127
|
agenta/client/backend/variants/__init__.py,sha256=BMR4SvsrqXC9FU8nPVzY8M9xGrBEhEGrmbgvy3iM1aE,171
|
|
121
|
-
agenta/client/backend/variants/client.py,sha256=
|
|
128
|
+
agenta/client/backend/variants/client.py,sha256=i5JeOEv4vneUeWB-babLXs_5N4Spau--jI-Lmdt4Ktk,90565
|
|
122
129
|
agenta/client/backend/variants/types/__init__.py,sha256=TrRUAyPsJ1bKg2gfW0d_S1rEu6eaYnHmr2g_URTuwPU,216
|
|
123
130
|
agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py,sha256=nbcakmo3eZpWmyX_DhS6F4jyhfV2t5zN-zOgDtM2rKQ,247
|
|
124
131
|
agenta/client/client.py,sha256=DWOGS9A8u4wu28s9jGOR4eRhf7vo4zT7GyDvrIGu59Y,19648
|
|
@@ -132,34 +139,38 @@ agenta/docker/docker-assets/entrypoint.sh,sha256=29XK8VQjQsx4hN2j-4JDy-6kQb5y4LC
|
|
|
132
139
|
agenta/docker/docker-assets/lambda_function.py,sha256=h4UZSSfqwpfsCgERv6frqwm_4JrYu9rLz3I-LxCfeEg,83
|
|
133
140
|
agenta/docker/docker-assets/main.py,sha256=7MI-21n81U7N7A0GxebNi0cmGWtJKcR2sPB6FcH2QfA,251
|
|
134
141
|
agenta/docker/docker_utils.py,sha256=kO1q2_IR0fEAo4M-2Pt_v-zC7GxxnkLogjKFhU869Ps,3555
|
|
135
|
-
agenta/sdk/__init__.py,sha256=
|
|
136
|
-
agenta/sdk/agenta_init.py,sha256=
|
|
142
|
+
agenta/sdk/__init__.py,sha256=G-KGS3nIyzsMFc_Ct3mZ_6MuKppJg7qDnBXuz_oy1Go,1688
|
|
143
|
+
agenta/sdk/agenta_init.py,sha256=_GugAX15eqTODzpGRIcBbqF87znl1q5gD12Fw7vjPs4,10652
|
|
137
144
|
agenta/sdk/assets.py,sha256=Zv4i8MVUSB3jMODQon1mzJtYxuntmrCNjLGk8f-2fls,2856
|
|
138
145
|
agenta/sdk/client.py,sha256=trKyBOYFZRk0v5Eptxvh87yPf50Y9CqY6Qgv4Fy-VH4,2142
|
|
139
|
-
agenta/sdk/config_manager.py,sha256=HFOJpJKBkhlA0C-KPuxb4-bHNZeZqdpmx_beoX4lQw8,7997
|
|
140
146
|
agenta/sdk/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
141
|
-
agenta/sdk/context/routing.py,sha256=
|
|
147
|
+
agenta/sdk/context/routing.py,sha256=ycUgmJZyWhL4bHjKtUSAsTlt_0Fujr_6OpoaEH1lAN0,683
|
|
142
148
|
agenta/sdk/context/tracing.py,sha256=UmmW15UFFsvxS0myS6aD9wBk5iNepNlQi4tEQ_ejfYM,96
|
|
143
149
|
agenta/sdk/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
144
|
-
agenta/sdk/decorators/routing.py,sha256=
|
|
145
|
-
agenta/sdk/decorators/tracing.py,sha256=
|
|
150
|
+
agenta/sdk/decorators/routing.py,sha256=wfi9BaSTR7EqSxmX1IylSfR-xemkMTDUmPx5OnDQQBs,36138
|
|
151
|
+
agenta/sdk/decorators/tracing.py,sha256=rwxbxsDb6B0VaJf4qLPgyTMYNkJMFLsCiX2ZQ6W-zOw,7713
|
|
146
152
|
agenta/sdk/litellm/__init__.py,sha256=Bpz1gfHQc0MN1yolWcjifLWznv6GjHggvRGQSpxpihM,37
|
|
147
|
-
agenta/sdk/litellm/litellm.py,sha256=
|
|
153
|
+
agenta/sdk/litellm/litellm.py,sha256=J9NefQ2yvfWQy9e0zmPZiRQDz5GM2ThWAw5XM8gCaqw,8461
|
|
154
|
+
agenta/sdk/managers/__init__.py,sha256=SN-LRwG0pRRDV3u2Q4JiiSTigN3-mYpzGNM35RzT4mc,238
|
|
155
|
+
agenta/sdk/managers/config.py,sha256=t6QABH6fMVeSo_IIXBPbhb4w8Nl3KUwfY3ujHP91VVs,11726
|
|
156
|
+
agenta/sdk/managers/deployment.py,sha256=SEokjZeh6n7HRKZ92Y0WncdG49hIFx-Z3B3HAl2kmUg,1174
|
|
157
|
+
agenta/sdk/managers/shared.py,sha256=e53jckQq5PIMpjdxADOonUj7o8aGfzmSvdeH5f43rGs,21497
|
|
158
|
+
agenta/sdk/managers/variant.py,sha256=A5ga3mq3b0weUTXa9HO72MGaspthGcu1uK9K5OnP738,4172
|
|
148
159
|
agenta/sdk/router.py,sha256=mOguvtOwl2wmyAgOuWTsf98pQwpNiUILKIo67W_hR3A,119
|
|
149
160
|
agenta/sdk/tracing/__init__.py,sha256=rQNe5-zT5Kt7_CDhq-lnUIi1EYTBVzVf_MbfcIxVD98,41
|
|
150
161
|
agenta/sdk/tracing/attributes.py,sha256=zh8JQZSeYCLBeIRSopKJx6QQ-WEgw08Cr64DS_WOcT8,3833
|
|
151
162
|
agenta/sdk/tracing/context.py,sha256=PSJdhcaOXSMAuGUBySpLKPKyx8duF3TJzhUEk2ufqPc,777
|
|
152
163
|
agenta/sdk/tracing/conventions.py,sha256=JBtznBXZ3aRkGKkLl7cPwdMNh3w1G-H2Ta2YrAxbr38,950
|
|
153
|
-
agenta/sdk/tracing/exporters.py,sha256=
|
|
154
|
-
agenta/sdk/tracing/inline.py,sha256=
|
|
155
|
-
agenta/sdk/tracing/processors.py,sha256=
|
|
164
|
+
agenta/sdk/tracing/exporters.py,sha256=mFK5vrL7X-pQmyH-c9vrmGtsjSkCBOR31q2M4ZsOo80,1568
|
|
165
|
+
agenta/sdk/tracing/inline.py,sha256=aPeY-zfIZ_4m8gIO0UT7cYmv7QpEYu7Ta_2MnLg0MVI,34515
|
|
166
|
+
agenta/sdk/tracing/processors.py,sha256=8hgwC44qtPDmQ5yurKA4T6rEVx5y927w2sDHdU5GoUA,3115
|
|
156
167
|
agenta/sdk/tracing/spans.py,sha256=nqUOjjirBxB8Eacv8Qj4Ra_6rknGi3lbJdNyKmk5ODQ,3707
|
|
157
|
-
agenta/sdk/tracing/tracing.py,sha256=
|
|
158
|
-
agenta/sdk/types.py,sha256=
|
|
168
|
+
agenta/sdk/tracing/tracing.py,sha256=laInX27JUBCS_KiOqMax2Ja5UJ9X72tY5bufLbcYebo,6990
|
|
169
|
+
agenta/sdk/types.py,sha256=naGZ5QYpX2HxAA8yO7xiUKs1FDPcC7rtT2K3NURifMg,6827
|
|
159
170
|
agenta/sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
160
171
|
agenta/sdk/utils/costs.py,sha256=i8C7ud__pThLS55XkN4YW8czXtGeXr2mx7jjcOFeiXg,5955
|
|
161
172
|
agenta/sdk/utils/debug.py,sha256=DxiCAeXxxrcEZT2CjlNA6BMvujGP4nzQ-rfb-_mLMck,2114
|
|
162
|
-
agenta/sdk/utils/exceptions.py,sha256=
|
|
173
|
+
agenta/sdk/utils/exceptions.py,sha256=AU0csJtuzswjkr8O8K-PmuOEr0vRNymKPZVRnRR_0Ts,1646
|
|
163
174
|
agenta/sdk/utils/globals.py,sha256=2HhyzWn55BbYNCZ3rT8dAxk1GGXuGQPbtq_THjaHbBw,372
|
|
164
175
|
agenta/sdk/utils/logging.py,sha256=FKzAO5eHjR_qvpEnc4tKXUA6WftmwdwYwuJK6CbSc84,379
|
|
165
176
|
agenta/sdk/utils/preinit.py,sha256=YlJL7RLfel0R7DFp-jK7OV-z4ZIQJM0oupYlk7g8b5o,1278
|
|
@@ -179,7 +190,7 @@ agenta/templates/simple_prompt/app.py,sha256=kODgF6lhzsaJPdgL5b21bUki6jkvqjWZzWR
|
|
|
179
190
|
agenta/templates/simple_prompt/env.example,sha256=g9AE5bYcGPpxawXMJ96gh8oenEPCHTabsiOnfQo3c5k,70
|
|
180
191
|
agenta/templates/simple_prompt/requirements.txt,sha256=ywRglRy7pPkw8bljmMEJJ4aOOQKrt9FGKULZ-DGkoBU,23
|
|
181
192
|
agenta/templates/simple_prompt/template.toml,sha256=DQBtRrF4GU8LBEXOZ-GGuINXMQDKGTEG5y37tnvIUIE,60
|
|
182
|
-
agenta-0.27.
|
|
183
|
-
agenta-0.27.
|
|
184
|
-
agenta-0.27.
|
|
185
|
-
agenta-0.27.
|
|
193
|
+
agenta-0.27.0a12.dist-info/METADATA,sha256=7YiEcddLp2Q-vb3NvqOvSAsoAyur_IA9NXRBSUul_j8,31739
|
|
194
|
+
agenta-0.27.0a12.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
195
|
+
agenta-0.27.0a12.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
|
|
196
|
+
agenta-0.27.0a12.dist-info/RECORD,,
|
agenta/sdk/config_manager.py
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
import logging
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
from typing import Optional, Type, TypeVar
|
|
5
|
-
|
|
6
|
-
import yaml
|
|
7
|
-
from pydantic import BaseModel, ValidationError
|
|
8
|
-
|
|
9
|
-
from agenta.client.backend.client import AgentaApi
|
|
10
|
-
from agenta.sdk.context.routing import routing_context
|
|
11
|
-
|
|
12
|
-
from . import AgentaSingleton
|
|
13
|
-
|
|
14
|
-
T = TypeVar("T", bound=BaseModel)
|
|
15
|
-
|
|
16
|
-
logger = logging.getLogger(__name__)
|
|
17
|
-
singleton = AgentaSingleton()
|
|
18
|
-
|
|
19
|
-
AVAILABLE_ENVIRONMENTS = ["development", "production", "staging"]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class ConfigManager:
|
|
23
|
-
client = None
|
|
24
|
-
|
|
25
|
-
@staticmethod
|
|
26
|
-
def get_from_route(schema: Type[T]) -> T:
|
|
27
|
-
"""
|
|
28
|
-
Retrieves the configuration from the route context and returns a config object.
|
|
29
|
-
|
|
30
|
-
This method checks the route context for configuration information and returns
|
|
31
|
-
an instance of the specified schema based on the available context data.
|
|
32
|
-
|
|
33
|
-
Args:
|
|
34
|
-
schema (Type[T]): A Pydantic model class that defines the structure of the configuration.
|
|
35
|
-
|
|
36
|
-
Returns:
|
|
37
|
-
T: An instance of the specified schema populated with the configuration data.
|
|
38
|
-
|
|
39
|
-
Raises:
|
|
40
|
-
ValueError: If conflicting configuration sources are provided or if no valid
|
|
41
|
-
configuration source is found in the context.
|
|
42
|
-
|
|
43
|
-
Note:
|
|
44
|
-
The method prioritizes the inputs in the following way:
|
|
45
|
-
1. 'config' (i.e. when called explicitly from the playground)
|
|
46
|
-
2. 'environment'
|
|
47
|
-
3. 'variant'
|
|
48
|
-
Only one of these should be provided.
|
|
49
|
-
"""
|
|
50
|
-
context = routing_context.get()
|
|
51
|
-
if ("config" in context and context["config"]) and (
|
|
52
|
-
("environment" in context and context["environment"])
|
|
53
|
-
or ("variant" in context and context["variant"])
|
|
54
|
-
):
|
|
55
|
-
raise ValueError(
|
|
56
|
-
"Either config, environment or variant must be provided. Not both."
|
|
57
|
-
)
|
|
58
|
-
if "config" in context and context["config"]:
|
|
59
|
-
return schema(**context["config"])
|
|
60
|
-
elif "environment" in context and context["environment"]:
|
|
61
|
-
return ConfigManager.get_from_registry(
|
|
62
|
-
schema, environment=context["environment"]
|
|
63
|
-
)
|
|
64
|
-
elif "variant" in context and context["variant"]:
|
|
65
|
-
return ConfigManager.get_from_registry(schema, variant=context["variant"])
|
|
66
|
-
else:
|
|
67
|
-
raise ValueError("Either config, environment or variant must be provided")
|
|
68
|
-
|
|
69
|
-
@staticmethod
|
|
70
|
-
def get_from_registry(
|
|
71
|
-
schema: Type[T],
|
|
72
|
-
environment: Optional[str] = None,
|
|
73
|
-
version: Optional[str] = None,
|
|
74
|
-
variant: Optional[str] = None,
|
|
75
|
-
) -> T:
|
|
76
|
-
"""
|
|
77
|
-
Pulls the parameters for the app variant from the server and returns a config object.
|
|
78
|
-
|
|
79
|
-
This method retrieves the configuration from the backend server based on the provided
|
|
80
|
-
environment or variant. It then validates and returns the configuration as an instance
|
|
81
|
-
of the specified schema.
|
|
82
|
-
|
|
83
|
-
Args:
|
|
84
|
-
schema (Type[T]): A Pydantic model class that defines the structure of the configuration.
|
|
85
|
-
environment (Optional[str]): The environment name to fetch the configuration for.
|
|
86
|
-
Must be one of "development", "production", or "staging".
|
|
87
|
-
version (Optional[str]): Currently not implemented. Will raise NotImplementedError if provided.
|
|
88
|
-
variant (Optional[str]): The variant name to fetch the configuration for.
|
|
89
|
-
|
|
90
|
-
Returns:
|
|
91
|
-
T: An instance of the specified schema populated with the configuration data.
|
|
92
|
-
|
|
93
|
-
Raises:
|
|
94
|
-
ValueError: If neither environment nor variant is provided.
|
|
95
|
-
NotImplementedError: If a specific version is requested (not yet implemented).
|
|
96
|
-
ValidationError: If the retrieved configuration data doesn't match the schema.
|
|
97
|
-
Exception: For any other errors during the process (e.g., API communication issues).
|
|
98
|
-
|
|
99
|
-
Note:
|
|
100
|
-
Either environment or variant must be provided, but not both.
|
|
101
|
-
"""
|
|
102
|
-
if not ConfigManager.client:
|
|
103
|
-
try:
|
|
104
|
-
ConfigManager.client = AgentaApi(
|
|
105
|
-
base_url=singleton.host + "/api",
|
|
106
|
-
api_key=singleton.api_key if singleton.api_key else "",
|
|
107
|
-
)
|
|
108
|
-
except Exception as ex:
|
|
109
|
-
logger.error(
|
|
110
|
-
"Failed to initialize Agenta client with error: %s", str(ex)
|
|
111
|
-
)
|
|
112
|
-
raise
|
|
113
|
-
if not environment and not variant:
|
|
114
|
-
raise ValueError("Either environment or variant must be provided")
|
|
115
|
-
try:
|
|
116
|
-
if environment:
|
|
117
|
-
if version:
|
|
118
|
-
raise NotImplementedError(
|
|
119
|
-
"Getting config for a specific version is not implemented yet."
|
|
120
|
-
)
|
|
121
|
-
else:
|
|
122
|
-
assert (
|
|
123
|
-
environment in AVAILABLE_ENVIRONMENTS
|
|
124
|
-
), f"Environment must be in {AVAILABLE_ENVIRONMENTS}"
|
|
125
|
-
config = ConfigManager.client.configs.get_config(
|
|
126
|
-
base_id=singleton.base_id, environment_name=environment
|
|
127
|
-
)
|
|
128
|
-
elif variant:
|
|
129
|
-
config = ConfigManager.client.configs.get_config(
|
|
130
|
-
base_id=singleton.base_id, config_name=variant
|
|
131
|
-
)
|
|
132
|
-
except Exception as ex:
|
|
133
|
-
logger.error(
|
|
134
|
-
"Failed to pull the configuration from the server with error: %s",
|
|
135
|
-
str(ex),
|
|
136
|
-
)
|
|
137
|
-
|
|
138
|
-
try:
|
|
139
|
-
result = schema(**config.parameters)
|
|
140
|
-
except ValidationError as ex:
|
|
141
|
-
logger.error("Failed to validate the configuration with error: %s", str(ex))
|
|
142
|
-
raise
|
|
143
|
-
return result
|
|
144
|
-
|
|
145
|
-
@staticmethod
|
|
146
|
-
def get_from_yaml(filename: str, schema: Type[T]) -> T:
|
|
147
|
-
"""
|
|
148
|
-
Loads configuration from a YAML file and returns a config object.
|
|
149
|
-
|
|
150
|
-
Args:
|
|
151
|
-
filename (str): The name of the YAML file to load.
|
|
152
|
-
schema (Type[T]): A Pydantic model class that defines the structure of the configuration.
|
|
153
|
-
|
|
154
|
-
Returns:
|
|
155
|
-
T: An instance of the specified schema populated with the configuration data.
|
|
156
|
-
|
|
157
|
-
Raises:
|
|
158
|
-
FileNotFoundError: If the specified file doesn't exist.
|
|
159
|
-
ValidationError: If the loaded configuration data doesn't match the schema.
|
|
160
|
-
"""
|
|
161
|
-
file_path = Path(filename)
|
|
162
|
-
if not file_path.exists():
|
|
163
|
-
raise FileNotFoundError(f"Config file not found: {filename}")
|
|
164
|
-
|
|
165
|
-
with open(file_path, "r") as file:
|
|
166
|
-
config_data = yaml.safe_load(file)
|
|
167
|
-
|
|
168
|
-
try:
|
|
169
|
-
return schema(**config_data)
|
|
170
|
-
except ValidationError as ex:
|
|
171
|
-
logger.error(
|
|
172
|
-
f"Failed to validate the configuration from {filename} with error: {str(ex)}"
|
|
173
|
-
)
|
|
174
|
-
raise
|
|
175
|
-
|
|
176
|
-
@staticmethod
|
|
177
|
-
def get_from_json(filename: str, schema: Type[T]) -> T:
|
|
178
|
-
"""
|
|
179
|
-
Loads configuration from a JSON file and returns a config object.
|
|
180
|
-
|
|
181
|
-
Args:
|
|
182
|
-
filename (str): The name of the JSON file to load.
|
|
183
|
-
schema (Type[T]): A Pydantic model class that defines the structure of the configuration.
|
|
184
|
-
|
|
185
|
-
Returns:
|
|
186
|
-
T: An instance of the specified schema populated with the configuration data.
|
|
187
|
-
|
|
188
|
-
Raises:
|
|
189
|
-
FileNotFoundError: If the specified file doesn't exist.
|
|
190
|
-
ValidationError: If the loaded configuration data doesn't match the schema.
|
|
191
|
-
"""
|
|
192
|
-
file_path = Path(filename)
|
|
193
|
-
if not file_path.exists():
|
|
194
|
-
raise FileNotFoundError(f"Config file not found: {filename}")
|
|
195
|
-
|
|
196
|
-
with open(file_path, "r") as file:
|
|
197
|
-
config_data = json.load(file)
|
|
198
|
-
|
|
199
|
-
try:
|
|
200
|
-
return schema(**config_data)
|
|
201
|
-
except ValidationError as ex:
|
|
202
|
-
logger.error(
|
|
203
|
-
f"Failed to validate the configuration from {filename} with error: {str(ex)}"
|
|
204
|
-
)
|
|
205
|
-
raise
|
|
File without changes
|
|
File without changes
|