agenta 0.26.0a0__py3-none-any.whl → 0.27.0__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 (85) hide show
  1. agenta/__init__.py +29 -10
  2. agenta/cli/helper.py +5 -1
  3. agenta/client/backend/__init__.py +14 -0
  4. agenta/client/backend/apps/client.py +28 -20
  5. agenta/client/backend/client.py +47 -16
  6. agenta/client/backend/containers/client.py +5 -1
  7. agenta/client/backend/core/__init__.py +2 -1
  8. agenta/client/backend/core/client_wrapper.py +6 -6
  9. agenta/client/backend/core/file.py +33 -11
  10. agenta/client/backend/core/http_client.py +45 -31
  11. agenta/client/backend/core/pydantic_utilities.py +144 -29
  12. agenta/client/backend/core/request_options.py +3 -0
  13. agenta/client/backend/core/serialization.py +139 -42
  14. agenta/client/backend/evaluations/client.py +7 -2
  15. agenta/client/backend/evaluators/client.py +349 -1
  16. agenta/client/backend/observability/client.py +11 -2
  17. agenta/client/backend/testsets/client.py +10 -10
  18. agenta/client/backend/types/__init__.py +14 -0
  19. agenta/client/backend/types/app.py +1 -0
  20. agenta/client/backend/types/app_variant_response.py +3 -1
  21. agenta/client/backend/types/config_dto.py +32 -0
  22. agenta/client/backend/types/config_response_model.py +32 -0
  23. agenta/client/backend/types/create_span.py +3 -2
  24. agenta/client/backend/types/environment_output.py +1 -0
  25. agenta/client/backend/types/environment_output_extended.py +1 -0
  26. agenta/client/backend/types/evaluation.py +1 -2
  27. agenta/client/backend/types/evaluator.py +2 -0
  28. agenta/client/backend/types/evaluator_config.py +1 -0
  29. agenta/client/backend/types/evaluator_mapping_output_interface.py +21 -0
  30. agenta/client/backend/types/evaluator_output_interface.py +21 -0
  31. agenta/client/backend/types/human_evaluation.py +1 -2
  32. agenta/client/backend/types/lifecycle_dto.py +24 -0
  33. agenta/client/backend/types/llm_tokens.py +2 -2
  34. agenta/client/backend/types/reference_dto.py +23 -0
  35. agenta/client/backend/types/reference_request_model.py +23 -0
  36. agenta/client/backend/types/span.py +1 -0
  37. agenta/client/backend/types/span_detail.py +7 -1
  38. agenta/client/backend/types/test_set_output_response.py +5 -2
  39. agenta/client/backend/types/trace_detail.py +7 -1
  40. agenta/client/backend/types/with_pagination.py +4 -2
  41. agenta/client/backend/variants/client.py +1565 -272
  42. agenta/docker/docker-assets/Dockerfile.cloud.template +1 -1
  43. agenta/sdk/__init__.py +44 -7
  44. agenta/sdk/agenta_init.py +85 -33
  45. agenta/sdk/context/__init__.py +0 -0
  46. agenta/sdk/context/routing.py +26 -0
  47. agenta/sdk/context/tracing.py +3 -0
  48. agenta/sdk/decorators/__init__.py +0 -0
  49. agenta/sdk/decorators/{llm_entrypoint.py → routing.py} +216 -191
  50. agenta/sdk/decorators/tracing.py +218 -99
  51. agenta/sdk/litellm/__init__.py +1 -0
  52. agenta/sdk/litellm/litellm.py +288 -0
  53. agenta/sdk/managers/__init__.py +6 -0
  54. agenta/sdk/managers/config.py +318 -0
  55. agenta/sdk/managers/deployment.py +45 -0
  56. agenta/sdk/managers/shared.py +639 -0
  57. agenta/sdk/managers/variant.py +182 -0
  58. agenta/sdk/router.py +0 -7
  59. agenta/sdk/tracing/__init__.py +1 -0
  60. agenta/sdk/tracing/attributes.py +141 -0
  61. agenta/sdk/tracing/context.py +24 -0
  62. agenta/sdk/tracing/conventions.py +49 -0
  63. agenta/sdk/tracing/exporters.py +65 -0
  64. agenta/sdk/tracing/inline.py +1252 -0
  65. agenta/sdk/tracing/processors.py +117 -0
  66. agenta/sdk/tracing/spans.py +136 -0
  67. agenta/sdk/tracing/tracing.py +233 -0
  68. agenta/sdk/types.py +49 -2
  69. agenta/sdk/utils/{helper/openai_cost.py → costs.py} +3 -0
  70. agenta/sdk/utils/debug.py +5 -5
  71. agenta/sdk/utils/exceptions.py +52 -0
  72. agenta/sdk/utils/globals.py +3 -5
  73. agenta/sdk/{tracing/logger.py → utils/logging.py} +3 -5
  74. agenta/sdk/utils/singleton.py +13 -0
  75. {agenta-0.26.0a0.dist-info → agenta-0.27.0.dist-info}/METADATA +5 -1
  76. {agenta-0.26.0a0.dist-info → agenta-0.27.0.dist-info}/RECORD +78 -57
  77. agenta/sdk/config_manager.py +0 -205
  78. agenta/sdk/context.py +0 -41
  79. agenta/sdk/decorators/base.py +0 -10
  80. agenta/sdk/tracing/callbacks.py +0 -187
  81. agenta/sdk/tracing/llm_tracing.py +0 -617
  82. agenta/sdk/tracing/tasks_manager.py +0 -129
  83. agenta/sdk/tracing/tracing_context.py +0 -27
  84. {agenta-0.26.0a0.dist-info → agenta-0.27.0.dist-info}/WHEEL +0 -0
  85. {agenta-0.26.0a0.dist-info → agenta-0.27.0.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,13 @@
1
+ from threading import Lock
2
+
3
+
4
+ class Singleton(type):
5
+ _instances = {}
6
+
7
+ _lock: Lock = Lock()
8
+
9
+ def __call__(cls, *args, **kwargs):
10
+ with cls._lock:
11
+ if cls not in cls._instances:
12
+ cls._instances[cls] = super().__call__(*args, **kwargs)
13
+ return cls._instances[cls]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agenta
3
- Version: 0.26.0a0
3
+ Version: 0.27.0
4
4
  Summary: The SDK for agenta is an open-source LLMOps platform.
5
5
  Home-page: https://agenta.ai
6
6
  Keywords: LLMOps,LLM,evaluation,prompt engineering
@@ -23,6 +23,10 @@ Requires-Dist: fastapi (>=0.100.0)
23
23
  Requires-Dist: httpx (>=0.24,<0.28)
24
24
  Requires-Dist: importlib-metadata (>=8.0.0,<9.0)
25
25
  Requires-Dist: ipdb (>=0.13)
26
+ Requires-Dist: litellm (>=1.48.0,<2.0.0)
27
+ Requires-Dist: opentelemetry-api (>=1.27.0,<2.0.0)
28
+ Requires-Dist: opentelemetry-exporter-otlp (>=1.27.0,<2.0.0)
29
+ Requires-Dist: opentelemetry-sdk (>=1.27.0,<2.0.0)
26
30
  Requires-Dist: posthog (>=3.1.0,<4.0.0)
27
31
  Requires-Dist: pydantic (>=2)
28
32
  Requires-Dist: pymongo (>=4.6.3,<5.0.0)
@@ -1,6 +1,6 @@
1
- agenta/__init__.py,sha256=MCeFBzYtrVNdhElvl1fBjypsqhgEaAMKy6ZR-B3YmJk,993
1
+ agenta/__init__.py,sha256=vZmOjCyJZMfW3UlqARG1xfkBZe-0kTjg7a_BaZZg2to,1496
2
2
  agenta/cli/evaluation_commands.py,sha256=fs6492tprPId9p8eGO02Xy-NCBm2RZNJLZWcUxugwd8,474
3
- agenta/cli/helper.py,sha256=vRxHyeNaltzNIGrfU2vO0H28_rXDzx9QqIZ_S-W6zL4,6212
3
+ agenta/cli/helper.py,sha256=P97HbNb_qzOyl5CM_MjAqWEBCdgebU6M81G_4UCmF1A,6288
4
4
  agenta/cli/main.py,sha256=Wz0ODhoeKK3Qg_CFUhu6D909szk05tc8ZVBB6H1-w7k,9763
5
5
  agenta/cli/telemetry.py,sha256=GaFFRsE_NtrcSSJ10r2jhgFs5Sk8gf2C09Ox3gOr3eU,1317
6
6
  agenta/cli/variant_commands.py,sha256=HfKRZsajKOXwZD2OyzjSfNtSx1yI01wI1cfqpvoHETI,17400
@@ -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=-vfan7YuXI5AR9m3AaqrePk-HJylFG0rXtBNxJxa8ww,4013
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=9rWax7LlEIpXdqq4McPAkvwHweSTomnyrFxFo8ehYy0,54136
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=NqKTA7oKQFI4eU0TNfB-SEDILMgVEJSZFodGsl3hWZI,102435
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=XRFlR9hh_Z6oNKqM0BuNuxZ3vonC-9zgHXWVnzPEay8,20132
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=FzSvKbXjuM18Hdk3iGK-jsGY_DfouyRS659thZV5c1Y,1394
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=mU22mZBjz2QXalKJLDGo1qNeAt1awLxRMO8fzbPbnr8,1829
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=vliNmlB7PbDfi4EKiVPNq5QaGXJ4zlDBGupv7Qciy7g,1520
29
- agenta/client/backend/core/http_client.py,sha256=LHzx7H12q9WOUquq8QZYSUPCt4TRdwxcRbwQm2JboeE,20278
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=sLzQZQLS_y66SZSBMtJE7YrQK8INda-ta1tKwAHabGk,7540
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=5cCGt5AEGgtP5xifDl4oVQUmSjlIA8FmRItAlJawM18,1417
35
- agenta/client/backend/core/serialization.py,sha256=Y0r8sJwxpA1a29ZuIpZ5sf9LEbeg43DTcv9voyLKxk8,5962
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=CB5sGhqY8sJFgJZf-Tn3odzjaUwad_YOW5L2NAd6j4Y,46357
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=YGsFQRf70dxYWb0IHmu_bMRsw8Pre-wcshTyvIDm5vM,28684
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=yvdodh76GS0kge2nZXNOQInQLv555BYF54EXF3_CyKE,39240
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=9P8T4iMqTnGMBnkb0AllqdGlSHD2BB7QmLS9dmfGybY,35193
48
- agenta/client/backend/types/__init__.py,sha256=khxcL80swPldYIYUzt2Tknzzk0PchL7UjeRiJqEL4Gk,5166
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=_6bnVodk9xT3xgeEbnxiOa_eDNSYWa_yBLJPQOoaU8k,588
52
- agenta/client/backend/types/app_variant_response.py,sha256=B1EmFbNs_tRZ1OxytAo3h9pQ1c4pN-BL0e-GFgfI-Yo,999
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=ka5f5ia8N_VjlSqdkapbDGaYobdqfduKCLNP6clbPig,1567
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=BuQNgdo07gAlHgC8RSV3Aq-IRpSwi3jai-jbyrTi8OQ,913
63
- agenta/client/backend/types/environment_output_extended.py,sha256=ZlpB50ea_j9COluArHYRJb1SfUrtrVmI5AEm3k8aOO4,1023
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=h2SWBFONuMQiz5uFFg8wtcQbayLvx0a_EOJ72vznoEU,1238
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=TQgGEL_w5e6hMr2roZdO8PpOwyRXT2LvVDKWufm06n4,760
75
- agenta/client/backend/types/evaluator_config.py,sha256=G-NCQxA4SBk00ClhdhKZcqZFS80usBWb2wR9-un4L4E,760
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=aLtloRMxDp1jfVW50rBiMxD2A6xDVM8NOFzNnOWuLso,903
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=3TjGNWX1vh0cbj93J6KeXgDP8ZysFXYiH6n8HnA2VYA,706
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,67 +98,83 @@ 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=A5nNVYsG2b4h49xuj9K13mfJpV5_-_DuAIKMbuq-BmM,1234
100
- agenta/client/backend/types/span_detail.py,sha256=kyt0Oxl4sd6iFWLgLeTr6NdKwJlV8DKQ35iy9qRdC5w,1222
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=XuifxiNgMeWU7-GpzYZJ7f8jzQsUeZ_VbbBozNX1aE8,648
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=bXQp-mTQ_nD0CA-raDyzO9Si1CALNhbv3UqUj7MzECE,1223
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=yI6jR7VxcyGdboTnkJwVarJtARwiJViZgpGHAknHAyk,699
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=d7y45zaOZaXx5S_CaYB7Qc5-ATWwtLzRPgTufJa90os,46444
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
125
132
  agenta/client/exceptions.py,sha256=cxLjjKvZKlUgBxt4Vn9J_SsezJPPNHvrZxnoq-D6zmw,94
126
133
  agenta/config.py,sha256=0VrTqduB4g8Mt_Ll7ffFcEjKF5qjTUIxmUtTPW2ygWw,653
127
134
  agenta/config.toml,sha256=sIORbhnyct2R9lJrquxhNL4pHul3O0R7iaipCoja5MY,193
128
- agenta/docker/docker-assets/Dockerfile.cloud.template,sha256=uJuXKvtkMY6f4KaOh3XE5pmuJR7mfZEXJk_8hj2uatc,386
135
+ agenta/docker/docker-assets/Dockerfile.cloud.template,sha256=_b3mLMgGXSFABn5VSlio29cl4guYAJc4UkSdy5nAUmg,386
129
136
  agenta/docker/docker-assets/Dockerfile.template,sha256=aVA_okx0xXalcTvdQGhSfzSjNpQZVoLJCGYA39-2Nwk,280
130
137
  agenta/docker/docker-assets/README.md,sha256=XHxwh2ks_ozrtAU7SLbL3J14SB2holG6buoTxwmMiZM,102
131
138
  agenta/docker/docker-assets/entrypoint.sh,sha256=29XK8VQjQsx4hN2j-4JDy-6kQb5y4LCqZEa7PD4eqCQ,74
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=XyxMUm8-fCH6G6KAFU0iAfiKTGEzNzBtbAfCp9i1Y7o,831
136
- agenta/sdk/agenta_init.py,sha256=8MfDuypxohd0qRTdtGjX7L17KW-1UGmzNVdiqF15_ak,9790
142
+ agenta/sdk/__init__.py,sha256=-Z44_jFgz_WAyAvgAd3zHZ6Q-rDf8zaLi09OXQGtPrk,1700
143
+ agenta/sdk/agenta_init.py,sha256=yUqHK55NtcrYM0XRVR1u1RADi0kGKJ2EZitDaVw2wlk,10666
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=n3UTpIhiB1J6FIQ5IvlucfGVpxoIIemnmdI68p34Yvw,8003
140
- agenta/sdk/context.py,sha256=q-PxL05-I84puunUAs9LGsffEXcYhDxhQxjuOz2vK90,901
141
- agenta/sdk/decorators/base.py,sha256=9aNdX5h8a2mFweuhdO-BQPwXGKY9ONPIdLRhSGAGMfY,217
142
- agenta/sdk/decorators/llm_entrypoint.py,sha256=jXXTQS-sCwmkKvF0bNYTG9pkK13B2odnHsrYepTU_x8,35572
143
- agenta/sdk/decorators/tracing.py,sha256=e0olx2EEdjXY0NqpIoDJSVxCnUmv0woewTUuCJXy2tM,4166
144
- agenta/sdk/router.py,sha256=0sbajvn5C7t18anH6yNo7-oYxldHnYfwcbmQnIXBePw,269
145
- agenta/sdk/tracing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
146
- agenta/sdk/tracing/callbacks.py,sha256=ug9xeXLgJEpx4l3x1BrJD2bFrH83I3kajlGsU8WtG4U,7699
147
- agenta/sdk/tracing/llm_tracing.py,sha256=5EeIuRu2wgGknlsZD-AkuJH_gOBrmsrCrWK0-h0Uov0,17941
148
- agenta/sdk/tracing/logger.py,sha256=GfH7V-jBHcn7h5dbdrnkDMe_ml3wkXFBeoQiqR4KVRc,474
149
- agenta/sdk/tracing/tasks_manager.py,sha256=FBSFOWIKBycyA4ShB2ZVMzrzYQ8pWGWWBClFX8nlZFA,3726
150
- agenta/sdk/tracing/tracing_context.py,sha256=nt3ewa-TK9BRJviGIZYazsAQUiG4daWxjtsbjeaDprs,789
151
- agenta/sdk/types.py,sha256=1AXUKTURFFgPH5iWeTYcNcg6dxVo1RrD0WuVe9e-NgU,5919
146
+ agenta/sdk/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
147
+ agenta/sdk/context/routing.py,sha256=ycUgmJZyWhL4bHjKtUSAsTlt_0Fujr_6OpoaEH1lAN0,683
148
+ agenta/sdk/context/tracing.py,sha256=UmmW15UFFsvxS0myS6aD9wBk5iNepNlQi4tEQ_ejfYM,96
149
+ agenta/sdk/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
150
+ agenta/sdk/decorators/routing.py,sha256=wfi9BaSTR7EqSxmX1IylSfR-xemkMTDUmPx5OnDQQBs,36138
151
+ agenta/sdk/decorators/tracing.py,sha256=rwxbxsDb6B0VaJf4qLPgyTMYNkJMFLsCiX2ZQ6W-zOw,7713
152
+ agenta/sdk/litellm/__init__.py,sha256=Bpz1gfHQc0MN1yolWcjifLWznv6GjHggvRGQSpxpihM,37
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
159
+ agenta/sdk/router.py,sha256=mOguvtOwl2wmyAgOuWTsf98pQwpNiUILKIo67W_hR3A,119
160
+ agenta/sdk/tracing/__init__.py,sha256=rQNe5-zT5Kt7_CDhq-lnUIi1EYTBVzVf_MbfcIxVD98,41
161
+ agenta/sdk/tracing/attributes.py,sha256=zh8JQZSeYCLBeIRSopKJx6QQ-WEgw08Cr64DS_WOcT8,3833
162
+ agenta/sdk/tracing/context.py,sha256=PSJdhcaOXSMAuGUBySpLKPKyx8duF3TJzhUEk2ufqPc,777
163
+ agenta/sdk/tracing/conventions.py,sha256=JBtznBXZ3aRkGKkLl7cPwdMNh3w1G-H2Ta2YrAxbr38,950
164
+ agenta/sdk/tracing/exporters.py,sha256=mFK5vrL7X-pQmyH-c9vrmGtsjSkCBOR31q2M4ZsOo80,1568
165
+ agenta/sdk/tracing/inline.py,sha256=jVIlmDIFSzXr-ofMbGlO8VFnNeiUL4C4yA8soED4AHI,34611
166
+ agenta/sdk/tracing/processors.py,sha256=8hgwC44qtPDmQ5yurKA4T6rEVx5y927w2sDHdU5GoUA,3115
167
+ agenta/sdk/tracing/spans.py,sha256=nqUOjjirBxB8Eacv8Qj4Ra_6rknGi3lbJdNyKmk5ODQ,3707
168
+ agenta/sdk/tracing/tracing.py,sha256=50669Lr6XwRoIEWDqEFj-K4HRcYSaL9i5vqwARvP7bk,6778
169
+ agenta/sdk/types.py,sha256=oEeSUQn4tMzV7dkSuucBC2YlAaxS-7qgkdlT763YfLM,7076
152
170
  agenta/sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
153
- agenta/sdk/utils/debug.py,sha256=QyuPsSoN0425UD13x_msPxSF_VT6YwHiQunZUibI-jg,2149
154
- agenta/sdk/utils/globals.py,sha256=JmhJcCOSbwvjQ6GDyUc2_SYR27DZk7YcrRH80ktHHOM,435
155
- agenta/sdk/utils/helper/openai_cost.py,sha256=1VkgvucDnNZm1pTfcVLz9icWunntp1d7zwMmnviy3Uw,5877
171
+ agenta/sdk/utils/costs.py,sha256=i8C7ud__pThLS55XkN4YW8czXtGeXr2mx7jjcOFeiXg,5955
172
+ agenta/sdk/utils/debug.py,sha256=DxiCAeXxxrcEZT2CjlNA6BMvujGP4nzQ-rfb-_mLMck,2114
173
+ agenta/sdk/utils/exceptions.py,sha256=AU0csJtuzswjkr8O8K-PmuOEr0vRNymKPZVRnRR_0Ts,1646
174
+ agenta/sdk/utils/globals.py,sha256=2HhyzWn55BbYNCZ3rT8dAxk1GGXuGQPbtq_THjaHbBw,372
175
+ agenta/sdk/utils/logging.py,sha256=FKzAO5eHjR_qvpEnc4tKXUA6WftmwdwYwuJK6CbSc84,379
156
176
  agenta/sdk/utils/preinit.py,sha256=YlJL7RLfel0R7DFp-jK7OV-z4ZIQJM0oupYlk7g8b5o,1278
177
+ agenta/sdk/utils/singleton.py,sha256=17Ph7LGnnV8HkPjImruKita2ni03Ari5jr0jqm__4sc,312
157
178
  agenta/templates/compose_email/README.md,sha256=ss7vZPpI1Hg0VmYtFliwq_r5LnqbCy_S5OQDXg8UoIA,308
158
179
  agenta/templates/compose_email/app.py,sha256=SG8QnBkC49MtvWa2z5_YQ2d8wxZxhO_hWs15j3CsWvc,2384
159
180
  agenta/templates/compose_email/env.example,sha256=g9AE5bYcGPpxawXMJ96gh8oenEPCHTabsiOnfQo3c5k,70
@@ -169,7 +190,7 @@ agenta/templates/simple_prompt/app.py,sha256=kODgF6lhzsaJPdgL5b21bUki6jkvqjWZzWR
169
190
  agenta/templates/simple_prompt/env.example,sha256=g9AE5bYcGPpxawXMJ96gh8oenEPCHTabsiOnfQo3c5k,70
170
191
  agenta/templates/simple_prompt/requirements.txt,sha256=ywRglRy7pPkw8bljmMEJJ4aOOQKrt9FGKULZ-DGkoBU,23
171
192
  agenta/templates/simple_prompt/template.toml,sha256=DQBtRrF4GU8LBEXOZ-GGuINXMQDKGTEG5y37tnvIUIE,60
172
- agenta-0.26.0a0.dist-info/METADATA,sha256=X9sEaKeywN8OI24YukCQYnvywurjaK_1Rz6AZdWOuDc,31534
173
- agenta-0.26.0a0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
174
- agenta-0.26.0a0.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
175
- agenta-0.26.0a0.dist-info/RECORD,,
193
+ agenta-0.27.0.dist-info/METADATA,sha256=Kk6wpTG_hkynSrOXFjnVIfqSlMex3yxAdMbK5xcHs18,31736
194
+ agenta-0.27.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
195
+ agenta-0.27.0.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
196
+ agenta-0.27.0.dist-info/RECORD,,
@@ -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.decorators.llm_entrypoint import route_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 = route_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
agenta/sdk/context.py DELETED
@@ -1,41 +0,0 @@
1
- import json
2
- import sqlite3
3
- from typing import List
4
- from .types import Context
5
-
6
-
7
- def setup_db():
8
- conn = sqlite3.connect("context.db")
9
- c = conn.cursor()
10
- c.execute(
11
- """
12
- CREATE TABLE IF NOT EXISTS contexts
13
- (id INTEGER PRIMARY KEY AUTOINCREMENT, context TEXT)
14
- """
15
- )
16
- conn.commit()
17
- conn.close()
18
-
19
-
20
- def get_contexts() -> List[Context]:
21
- contexts = []
22
- conn = sqlite3.connect("context.db")
23
- c = conn.cursor()
24
- for row in c.execute("SELECT * FROM contexts"):
25
- context_data = json.loads(row[1])
26
- contexts.append(Context.parse_obj(context_data))
27
- conn.close()
28
- return contexts
29
-
30
-
31
- def save_context(result: Context):
32
- conn = sqlite3.connect("context.db")
33
- c = conn.cursor()
34
- c.execute(
35
- """
36
- INSERT INTO contexts (context) VALUES (?)
37
- """,
38
- (json.dumps(result.dict()),),
39
- )
40
- conn.commit()
41
- conn.close()
@@ -1,10 +0,0 @@
1
- # Stdlib Imports
2
- from typing import Any, Callable
3
-
4
-
5
- class BaseDecorator:
6
- def __init__(self):
7
- pass
8
-
9
- def __call__(self, func: Callable[..., Any]) -> Callable[..., Any]:
10
- raise NotImplementedError