agenta 0.21.0a1__tar.gz → 0.22.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. {agenta-0.21.0a1 → agenta-0.22.0}/PKG-INFO +1 -2
  2. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/__init__.py +1 -2
  3. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/docker/docker_utils.py +1 -2
  4. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/__init__.py +0 -2
  5. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/decorators/llm_entrypoint.py +55 -223
  6. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/types.py +0 -7
  7. {agenta-0.21.0a1 → agenta-0.22.0}/pyproject.toml +1 -2
  8. agenta-0.21.0a1/agenta/sdk/config_manager.py +0 -205
  9. {agenta-0.21.0a1 → agenta-0.22.0}/README.md +0 -0
  10. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/cli/evaluation_commands.py +0 -0
  11. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/cli/helper.py +0 -0
  12. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/cli/main.py +0 -0
  13. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/cli/telemetry.py +0 -0
  14. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/cli/variant_commands.py +0 -0
  15. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/cli/variant_configs.py +0 -0
  16. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/Readme.md +0 -0
  17. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/__init__.py +0 -0
  18. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/api.py +0 -0
  19. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/api_models.py +0 -0
  20. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/__init__.py +0 -0
  21. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/client.py +0 -0
  22. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/core/__init__.py +0 -0
  23. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/core/api_error.py +0 -0
  24. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/core/client_wrapper.py +0 -0
  25. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/core/datetime_utils.py +0 -0
  26. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/core/jsonable_encoder.py +0 -0
  27. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/core/remove_none_from_dict.py +0 -0
  28. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/errors/__init__.py +0 -0
  29. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/errors/unprocessable_entity_error.py +0 -0
  30. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/__init__.py +0 -0
  31. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/apps/__init__.py +0 -0
  32. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/apps/client.py +0 -0
  33. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/bases/__init__.py +0 -0
  34. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/bases/client.py +0 -0
  35. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/configs/__init__.py +0 -0
  36. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/configs/client.py +0 -0
  37. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/containers/__init__.py +0 -0
  38. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/containers/client.py +0 -0
  39. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/containers/types/__init__.py +0 -0
  40. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/containers/types/container_templates_response.py +0 -0
  41. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/environments/__init__.py +0 -0
  42. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/environments/client.py +0 -0
  43. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/evaluations/__init__.py +0 -0
  44. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/evaluations/client.py +0 -0
  45. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/evaluators/__init__.py +0 -0
  46. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/evaluators/client.py +0 -0
  47. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/observability/__init__.py +0 -0
  48. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/observability/client.py +0 -0
  49. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/testsets/__init__.py +0 -0
  50. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/testsets/client.py +0 -0
  51. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/variants/__init__.py +0 -0
  52. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/variants/client.py +0 -0
  53. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/variants/types/__init__.py +0 -0
  54. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/resources/variants/types/add_variant_from_base_and_config_response.py +0 -0
  55. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/__init__.py +0 -0
  56. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/aggregated_result.py +0 -0
  57. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/aggregated_result_evaluator_config.py +0 -0
  58. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/app.py +0 -0
  59. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/app_variant_response.py +0 -0
  60. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/app_variant_revision.py +0 -0
  61. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/base_output.py +0 -0
  62. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/body_import_testset.py +0 -0
  63. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/config_db.py +0 -0
  64. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/create_app_output.py +0 -0
  65. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/create_span.py +0 -0
  66. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/create_trace_response.py +0 -0
  67. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/docker_env_vars.py +0 -0
  68. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/environment_output.py +0 -0
  69. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/environment_output_extended.py +0 -0
  70. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/environment_revision.py +0 -0
  71. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/error.py +0 -0
  72. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/evaluation.py +0 -0
  73. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/evaluation_scenario.py +0 -0
  74. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/evaluation_scenario_input.py +0 -0
  75. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/evaluation_scenario_output.py +0 -0
  76. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/evaluation_scenario_result.py +0 -0
  77. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/evaluation_scenario_score_update.py +0 -0
  78. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/evaluation_status_enum.py +0 -0
  79. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/evaluation_type.py +0 -0
  80. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/evaluation_webhook.py +0 -0
  81. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/evaluator.py +0 -0
  82. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/evaluator_config.py +0 -0
  83. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/feedback.py +0 -0
  84. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/get_config_response.py +0 -0
  85. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/http_validation_error.py +0 -0
  86. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/human_evaluation.py +0 -0
  87. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/human_evaluation_scenario.py +0 -0
  88. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/human_evaluation_scenario_input.py +0 -0
  89. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/human_evaluation_scenario_output.py +0 -0
  90. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/human_evaluation_scenario_update.py +0 -0
  91. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/human_evaluation_update.py +0 -0
  92. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/image.py +0 -0
  93. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/invite_request.py +0 -0
  94. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/list_api_keys_response.py +0 -0
  95. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/llm_run_rate_limit.py +0 -0
  96. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/llm_tokens.py +0 -0
  97. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/new_human_evaluation.py +0 -0
  98. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/new_testset.py +0 -0
  99. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/organization.py +0 -0
  100. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/organization_output.py +0 -0
  101. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/permission.py +0 -0
  102. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/result.py +0 -0
  103. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/score.py +0 -0
  104. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/simple_evaluation_output.py +0 -0
  105. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/span.py +0 -0
  106. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/span_detail.py +0 -0
  107. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/span_kind.py +0 -0
  108. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/span_status_code.py +0 -0
  109. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/span_variant.py +0 -0
  110. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/template.py +0 -0
  111. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/template_image_info.py +0 -0
  112. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/test_set_output_response.py +0 -0
  113. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/test_set_simple_response.py +0 -0
  114. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/trace_detail.py +0 -0
  115. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/uri.py +0 -0
  116. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/validation_error.py +0 -0
  117. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/validation_error_loc_item.py +0 -0
  118. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/variant_action.py +0 -0
  119. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/variant_action_enum.py +0 -0
  120. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/with_pagination.py +0 -0
  121. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/workspace_member_response.py +0 -0
  122. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/workspace_permission.py +0 -0
  123. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/workspace_response.py +0 -0
  124. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/workspace_role.py +0 -0
  125. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/backend/types/workspace_role_response.py +0 -0
  126. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/client.py +0 -0
  127. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/client/exceptions.py +0 -0
  128. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/config.py +0 -0
  129. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/config.toml +0 -0
  130. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/docker/docker-assets/Dockerfile.cloud.template +0 -0
  131. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/docker/docker-assets/Dockerfile.template +0 -0
  132. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/docker/docker-assets/README.md +0 -0
  133. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/docker/docker-assets/entrypoint.sh +0 -0
  134. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/docker/docker-assets/lambda_function.py +0 -0
  135. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/docker/docker-assets/main.py +0 -0
  136. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/agenta_init.py +0 -0
  137. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/client.py +0 -0
  138. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/context.py +0 -0
  139. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/decorators/base.py +0 -0
  140. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/decorators/tracing.py +0 -0
  141. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/router.py +0 -0
  142. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/tracing/__init__.py +0 -0
  143. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/tracing/callbacks.py +0 -0
  144. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/tracing/llm_tracing.py +0 -0
  145. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/tracing/logger.py +0 -0
  146. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/tracing/tasks_manager.py +0 -0
  147. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/tracing/tracing_context.py +0 -0
  148. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/utils/debug.py +0 -0
  149. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/utils/globals.py +0 -0
  150. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/utils/helper/openai_cost.py +0 -0
  151. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/sdk/utils/preinit.py +0 -0
  152. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/compose_email/README.md +0 -0
  153. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/compose_email/app.py +0 -0
  154. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/compose_email/env.example +0 -0
  155. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/compose_email/requirements.txt +0 -0
  156. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/compose_email/template.toml +0 -0
  157. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/extract_data_to_json/README.md +0 -0
  158. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/extract_data_to_json/app.py +0 -0
  159. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/extract_data_to_json/env.example +0 -0
  160. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/extract_data_to_json/requirements.txt +0 -0
  161. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/extract_data_to_json/template.toml +0 -0
  162. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/simple_prompt/README.md +0 -0
  163. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/simple_prompt/app.py +0 -0
  164. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/simple_prompt/env.example +0 -0
  165. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/simple_prompt/requirements.txt +0 -0
  166. {agenta-0.21.0a1 → agenta-0.22.0}/agenta/templates/simple_prompt/template.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agenta
3
- Version: 0.21.0a1
3
+ Version: 0.22.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
@@ -27,7 +27,6 @@ Requires-Dist: pydantic (>=2)
27
27
  Requires-Dist: pymongo (>=4.6.3,<5.0.0)
28
28
  Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
29
29
  Requires-Dist: python-multipart (>=0.0.6,<0.0.10)
30
- Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
31
30
  Requires-Dist: questionary (>=1.10,<3.0)
32
31
  Requires-Dist: toml (>=0.10.2,<0.11.0)
33
32
  Project-URL: Documentation, https://docs.agenta.ai
@@ -3,7 +3,6 @@ from .sdk.context import get_contexts, save_context
3
3
  from .sdk.types import (
4
4
  Context,
5
5
  DictInput,
6
- MultipleChoice,
7
6
  FloatParam,
8
7
  InFile,
9
8
  IntParam,
@@ -23,7 +22,7 @@ from .sdk.agenta_init import Config, AgentaSingleton, init
23
22
  from .sdk.utils.helper.openai_cost import calculate_token_usage
24
23
  from .sdk.client import Agenta
25
24
  from .sdk.tracing import callbacks
26
- from .sdk.config_manager import ConfigManager
25
+
27
26
 
28
27
  config = PreInitObject("agenta.config", Config)
29
28
  DEFAULT_AGENTA_SINGLETON_INSTANCE = AgentaSingleton()
@@ -3,13 +3,12 @@ import shutil
3
3
  import tarfile
4
4
  import tempfile
5
5
  from pathlib import Path
6
- import os
7
6
 
8
7
 
9
8
  logger = logging.getLogger(__name__)
10
9
  logger.setLevel(logging.DEBUG)
11
10
 
12
- DEBUG = os.environ.get("AGENTA_CLI_DEBUG", False)
11
+ DEBUG = False
13
12
 
14
13
 
15
14
  def create_dockerfile(out_folder: Path) -> Path:
@@ -3,7 +3,6 @@ from .context import get_contexts, save_context
3
3
  from .types import (
4
4
  Context,
5
5
  DictInput,
6
- MultipleChoice,
7
6
  FloatParam,
8
7
  InFile,
9
8
  IntParam,
@@ -20,7 +19,6 @@ from .decorators.tracing import instrument
20
19
  from .decorators.llm_entrypoint import entrypoint, app, route
21
20
  from .agenta_init import Config, AgentaSingleton, init
22
21
  from .utils.helper.openai_cost import calculate_token_usage
23
- from .config_manager import ConfigManager
24
22
 
25
23
  config = PreInitObject("agenta.config", Config)
26
24
  DEFAULT_AGENTA_SINGLETON_INSTANCE = AgentaSingleton()
@@ -1,6 +1,5 @@
1
1
  """The code for the Agenta SDK"""
2
2
 
3
- from agenta.sdk.utils.debug import debug, DEBUG, SHIFT
4
3
  import os
5
4
  import sys
6
5
  import time
@@ -31,7 +30,6 @@ from agenta.sdk.types import (
31
30
  InFile,
32
31
  IntParam,
33
32
  MultipleChoiceParam,
34
- MultipleChoice,
35
33
  GroupedMultipleChoiceParam,
36
34
  TextParam,
37
35
  MessagesInput,
@@ -39,16 +37,8 @@ from agenta.sdk.types import (
39
37
  BaseResponse,
40
38
  BinaryParam,
41
39
  )
42
- import pydantic
43
-
44
- from pydantic import BaseModel
45
- from typing import Type
46
- from annotated_types import Ge, Le, Gt, Lt
47
40
 
48
41
  from pydantic import BaseModel, HttpUrl
49
- import contextvars
50
- from contextlib import contextmanager
51
-
52
42
 
53
43
  app = FastAPI()
54
44
 
@@ -66,30 +56,10 @@ app.add_middleware(
66
56
 
67
57
  app.include_router(router, prefix="")
68
58
 
59
+ from agenta.sdk.utils.debug import debug, DEBUG, SHIFT
69
60
 
70
- logging.setLevel("DEBUG")
71
61
 
72
- route_context = contextvars.ContextVar("route_context", default={})
73
-
74
-
75
- @contextmanager
76
- def route_context_manager(
77
- config: Optional[Dict[str, Any]] = None,
78
- environment: Optional[str] = None,
79
- version: Optional[str] = None,
80
- variant: Optional[str] = None,
81
- ):
82
- context = {
83
- "config": config,
84
- "environment": environment,
85
- "version": version,
86
- "variant": variant,
87
- }
88
- token = route_context.set(context)
89
- try:
90
- yield
91
- finally:
92
- route_context.reset(token)
62
+ logging.setLevel("DEBUG")
93
63
 
94
64
 
95
65
  class PathValidator(BaseModel):
@@ -102,18 +72,16 @@ class route(BaseDecorator):
102
72
  # the @entrypoint decorator, which has certain limitations. By using @route(), we can create new
103
73
  # routes without altering the main workflow entrypoint. This helps in modularizing the services
104
74
  # and provides flexibility in how we expose different functionalities as APIs.
105
- def __init__(self, path, config_schema: BaseModel):
106
- self.config_schema: BaseModel = config_schema
107
- if path != "" and path[0] != "/":
108
- path = "/" + path
75
+ def __init__(self, path):
76
+ path = "/" + path.strip("/").strip()
77
+ path = "" if path == "/" else path
78
+
109
79
  PathValidator(url=f"http://example.com{path}")
110
80
 
111
81
  self.route_path = path
112
82
 
113
83
  def __call__(self, f):
114
- self.e = entrypoint(
115
- f, route_path=self.route_path, config_schema=self.config_schema
116
- )
84
+ self.e = entrypoint(f, route_path=self.route_path)
117
85
 
118
86
  return f
119
87
 
@@ -151,29 +119,15 @@ class entrypoint(BaseDecorator):
151
119
 
152
120
  routes = list()
153
121
 
154
- def __init__(
155
- self, func: Callable[..., Any], route_path="", config_schema: BaseModel = None
156
- ):
122
+ def __init__(self, func: Callable[..., Any], route_path=""):
157
123
  logging.info(f"Using Agenta Python SDK version {version('agenta')}")
158
124
 
159
125
  DEFAULT_PATH = "generate"
160
126
  PLAYGROUND_PATH = "/playground"
161
127
  RUN_PATH = "/run"
162
- func_signature = inspect.signature(func)
163
- try:
164
- config = (
165
- config_schema() if config_schema else None
166
- ) # we initialize the config object to be able to use it
167
- except pydantic.ValidationError as e:
168
- raise ValueError(
169
- f"Error initializing config_schema. Please ensure all required fields have default values: {str(e)}"
170
- ) from e
171
- except Exception as e:
172
- raise ValueError(
173
- f"Unexpected error initializing config_schema: {str(e)}"
174
- ) from e
175
128
 
176
- config_params = config.dict() if config else ag.config.all()
129
+ func_signature = inspect.signature(func)
130
+ config_params = ag.config.all()
177
131
  ingestible_files = self.extract_ingestible_files(func_signature)
178
132
 
179
133
  ### --- Playground --- #
@@ -182,44 +136,36 @@ class entrypoint(BaseDecorator):
182
136
  async def wrapper(*args, **kwargs) -> Any:
183
137
  func_params, api_config_params = self.split_kwargs(kwargs, config_params)
184
138
  self.ingest_files(func_params, ingestible_files)
185
- if not config_schema:
186
- ag.config.set(**api_config_params)
139
+ ag.config.set(**api_config_params)
187
140
 
188
141
  # Set the configuration and environment of the LLM app parent span at run-time
189
142
  ag.tracing.update_baggage(
190
143
  {"config": config_params, "environment": "playground"}
191
144
  )
192
- with route_context_manager(config=api_config_params):
193
- entrypoint_result = await self.execute_function(
194
- func,
195
- True, # inline trace: True
196
- *args,
197
- params=func_params,
198
- config_params=config_params,
199
- )
145
+
146
+ entrypoint_result = await self.execute_function(
147
+ func,
148
+ True, # inline trace: True
149
+ *args,
150
+ params=func_params,
151
+ config_params=config_params,
152
+ )
200
153
 
201
154
  return entrypoint_result
202
155
 
203
156
  self.update_function_signature(
204
- wrapper=wrapper,
205
- func_signature=func_signature,
206
- config_class=config,
207
- config_dict=config_params,
208
- ingestible_files=ingestible_files,
157
+ wrapper, func_signature, config_params, ingestible_files
209
158
  )
210
159
 
211
160
  #
212
- if route_path == "" or route_path == "/":
161
+ if route_path == "":
213
162
  route = f"/{DEFAULT_PATH}"
214
163
  app.post(route, response_model=BaseResponse)(wrapper)
215
164
  entrypoint.routes.append(
216
165
  {
217
166
  "func": func.__name__,
218
167
  "endpoint": route,
219
- "params": {**config_params, **func_signature.parameters}
220
- if not config
221
- else func_signature.parameters,
222
- "config": config,
168
+ "params": {**config_params, **func_signature.parameters},
223
169
  }
224
170
  )
225
171
 
@@ -229,10 +175,7 @@ class entrypoint(BaseDecorator):
229
175
  {
230
176
  "func": func.__name__,
231
177
  "endpoint": route,
232
- "params": {**config_params, **func_signature.parameters}
233
- if not config
234
- else func_signature.parameters,
235
- "config": config,
178
+ "params": {**config_params, **func_signature.parameters},
236
179
  }
237
180
  )
238
181
  ### ---------------------------- #
@@ -244,28 +187,26 @@ class entrypoint(BaseDecorator):
244
187
  func_params = {
245
188
  k: v for k, v in kwargs.items() if k not in ["config", "environment"]
246
189
  }
247
- if not config_schema:
248
- if "environment" in kwargs and kwargs["environment"] is not None:
249
- ag.config.pull(environment_name=kwargs["environment"])
250
- elif "config" in kwargs and kwargs["config"] is not None:
251
- ag.config.pull(config_name=kwargs["config"])
252
- else:
253
- ag.config.pull(config_name="default")
190
+
191
+ if "environment" in kwargs and kwargs["environment"] is not None:
192
+ ag.config.pull(environment_name=kwargs["environment"])
193
+ elif "config" in kwargs and kwargs["config"] is not None:
194
+ ag.config.pull(config_name=kwargs["config"])
195
+ else:
196
+ ag.config.pull(config_name="default")
254
197
 
255
198
  # Set the configuration and environment of the LLM app parent span at run-time
256
199
  ag.tracing.update_baggage(
257
200
  {"config": config_params, "environment": kwargs["environment"]}
258
201
  )
259
- with route_context_manager(
260
- variant=kwargs["config"], environment=kwargs["environment"]
261
- ):
262
- entrypoint_result = await self.execute_function(
263
- func,
264
- False, # inline trace: False
265
- *args,
266
- params=func_params,
267
- config_params=config_params,
268
- )
202
+
203
+ entrypoint_result = await self.execute_function(
204
+ func,
205
+ False, # inline trace: False
206
+ *args,
207
+ params=func_params,
208
+ config_params=config_params,
209
+ )
269
210
 
270
211
  return entrypoint_result
271
212
 
@@ -274,7 +215,8 @@ class entrypoint(BaseDecorator):
274
215
  func_signature,
275
216
  ingestible_files,
276
217
  )
277
- if route_path == "" or route_path == "/":
218
+
219
+ if route_path == "":
278
220
  route_deployed = f"/{DEFAULT_PATH}_deployed"
279
221
  app.post(route_deployed, response_model=BaseResponse)(wrapper_deployed)
280
222
 
@@ -289,18 +231,11 @@ class entrypoint(BaseDecorator):
289
231
  for route in entrypoint.routes:
290
232
  self.override_schema(
291
233
  openapi_schema=openapi_schema,
292
- func_name=route["func"],
234
+ func=route["func"],
293
235
  endpoint=route["endpoint"],
294
236
  params=route["params"],
295
237
  )
296
- if route["config"] is not None: # new SDK version
297
- self.override_config_in_schema(
298
- openapi_schema=openapi_schema,
299
- func_name=route["func"],
300
- endpoint=route["endpoint"],
301
- config=route["config"],
302
- )
303
-
238
+ ### ---------------------- #
304
239
  if self.is_main_script(func) and route_path == "":
305
240
  self.handle_terminal_run(
306
241
  func,
@@ -458,17 +393,13 @@ class entrypoint(BaseDecorator):
458
393
  self,
459
394
  wrapper: Callable[..., Any],
460
395
  func_signature: inspect.Signature,
461
- config_class: Type[BaseModel], # TODO: change to our type
462
- config_dict: Dict[str, Any],
396
+ config_params: Dict[str, Any],
463
397
  ingestible_files: Dict[str, inspect.Parameter],
464
398
  ) -> None:
465
399
  """Update the function signature to include new parameters."""
466
400
 
467
401
  updated_params: List[inspect.Parameter] = []
468
- if config_class:
469
- self.add_config_params_to_parser(updated_params, config_class)
470
- else:
471
- self.depracated_add_config_params_to_parser(updated_params, config_dict)
402
+ self.add_config_params_to_parser(updated_params, config_params)
472
403
  self.add_func_params_to_parser(updated_params, func_signature, ingestible_files)
473
404
  self.update_wrapper_signature(wrapper, updated_params)
474
405
 
@@ -488,8 +419,8 @@ class entrypoint(BaseDecorator):
488
419
  ]: # we add the config and environment parameters
489
420
  updated_params.append(
490
421
  inspect.Parameter(
491
- name=param,
492
- kind=inspect.Parameter.KEYWORD_ONLY,
422
+ param,
423
+ inspect.Parameter.KEYWORD_ONLY,
493
424
  default=Body(None),
494
425
  annotation=str,
495
426
  )
@@ -497,32 +428,17 @@ class entrypoint(BaseDecorator):
497
428
  self.update_wrapper_signature(wrapper, updated_params)
498
429
 
499
430
  def add_config_params_to_parser(
500
- self, updated_params: list, config_class: Type[BaseModel]
501
- ) -> None:
502
- """Add configuration parameters to function signature."""
503
- for name, field in config_class.__fields__.items():
504
- assert field.default is not None, f"Field {name} has no default value"
505
- updated_params.append(
506
- inspect.Parameter(
507
- name=name,
508
- kind=inspect.Parameter.KEYWORD_ONLY,
509
- annotation=field.annotation.__name__,
510
- default=Body(field.default),
511
- )
512
- )
513
-
514
- def depracated_add_config_params_to_parser(
515
- self, updated_params: list, config_dict: Dict[str, Any]
431
+ self, updated_params: list, config_params: Dict[str, Any]
516
432
  ) -> None:
517
433
  """Add configuration parameters to function signature."""
518
- for name, param in config_dict.items():
434
+ for name, param in config_params.items():
519
435
  assert (
520
436
  len(param.__class__.__bases__) == 1
521
437
  ), f"Inherited standard type of {param.__class__} needs to be one."
522
438
  updated_params.append(
523
439
  inspect.Parameter(
524
- name=name,
525
- kind=inspect.Parameter.KEYWORD_ONLY,
440
+ name,
441
+ inspect.Parameter.KEYWORD_ONLY,
526
442
  default=Body(param),
527
443
  annotation=param.__class__.__bases__[
528
444
  0
@@ -630,17 +546,10 @@ class entrypoint(BaseDecorator):
630
546
  file_path=args_func_params[name],
631
547
  )
632
548
 
633
- # Update args_config_params with default values from config_params if not provided in command line arguments
634
- args_config_params.update(
635
- {
636
- key: value
637
- for key, value in config_params.items()
638
- if key not in args_config_params
639
- }
640
- )
549
+ ag.config.set(**args_config_params)
641
550
 
642
551
  # Set the configuration and environment of the LLM app parent span at run-time
643
- ag.tracing.update_baggage({"config": args_config_params, "environment": "bash"})
552
+ ag.tracing.update_baggage({"config": ag.config.all(), "environment": "bash"})
644
553
 
645
554
  loop = asyncio.get_event_loop()
646
555
 
@@ -652,92 +561,15 @@ class entrypoint(BaseDecorator):
652
561
  )
653
562
  )
654
563
 
655
- print("\n========== Result ==========\n")
564
+ print(f"\n========== Result ==========\n")
656
565
 
657
566
  print("-> data")
658
567
  print(json.dumps(result.data, indent=2))
659
568
  print("-> trace")
660
569
  print(json.dumps(result.trace, indent=2))
661
570
 
662
- with open("trace.json", "w") as trace_file:
663
- json.dump(result.trace, trace_file, indent=4)
664
-
665
- def override_config_in_schema(
666
- self,
667
- openapi_schema: dict,
668
- func_name: str,
669
- endpoint: str,
670
- config: Type[BaseModel],
671
- ):
672
- endpoint = endpoint[1:].replace("/", "_")
673
- schema_to_override = openapi_schema["components"]["schemas"][
674
- f"Body_{func_name}_{endpoint}_post"
675
- ]["properties"]
676
- # New logic
677
- for param_name, param_val in config.__fields__.items():
678
- if param_val.annotation is str:
679
- if any(
680
- isinstance(constraint, MultipleChoice)
681
- for constraint in param_val.metadata
682
- ):
683
- choices = next(
684
- constraint.choices
685
- for constraint in param_val.metadata
686
- if isinstance(constraint, MultipleChoice)
687
- )
688
- if isinstance(choices, dict):
689
- schema_to_override[param_name]["x-parameter"] = "grouped_choice"
690
- schema_to_override[param_name]["choices"] = choices
691
- elif isinstance(choices, list):
692
- schema_to_override[param_name]["x-parameter"] = "choice"
693
- schema_to_override[param_name]["enum"] = choices
694
- else:
695
- schema_to_override[param_name]["x-parameter"] = "text"
696
- if param_val.annotation is bool:
697
- schema_to_override[param_name]["x-parameter"] = "bool"
698
- if param_val.annotation in (int, float):
699
- schema_to_override[param_name]["x-parameter"] = (
700
- "int" if param_val.annotation is int else "float"
701
- )
702
- # Check for greater than or equal to constraint
703
- if any(isinstance(constraint, Ge) for constraint in param_val.metadata):
704
- min_value = next(
705
- constraint.ge
706
- for constraint in param_val.metadata
707
- if isinstance(constraint, Ge)
708
- )
709
- schema_to_override[param_name]["minimum"] = min_value
710
- # Check for greater than constraint
711
- elif any(
712
- isinstance(constraint, Gt) for constraint in param_val.metadata
713
- ):
714
- min_value = next(
715
- constraint.gt
716
- for constraint in param_val.metadata
717
- if isinstance(constraint, Gt)
718
- )
719
- schema_to_override[param_name]["exclusiveMinimum"] = min_value
720
- # Check for less than or equal to constraint
721
- if any(isinstance(constraint, Le) for constraint in param_val.metadata):
722
- max_value = next(
723
- constraint.le
724
- for constraint in param_val.metadata
725
- if isinstance(constraint, Le)
726
- )
727
- schema_to_override[param_name]["maximum"] = max_value
728
- # Check for less than constraint
729
- elif any(
730
- isinstance(constraint, Lt) for constraint in param_val.metadata
731
- ):
732
- max_value = next(
733
- constraint.lt
734
- for constraint in param_val.metadata
735
- if isinstance(constraint, Lt)
736
- )
737
- schema_to_override[param_name]["exclusiveMaximum"] = max_value
738
-
739
571
  def override_schema(
740
- self, openapi_schema: dict, func_name: str, endpoint: str, params: dict
572
+ self, openapi_schema: dict, func: str, endpoint: str, params: dict
741
573
  ):
742
574
  """
743
575
  Overrides the default openai schema generated by fastapi with additional information about:
@@ -809,7 +641,7 @@ class entrypoint(BaseDecorator):
809
641
  endpoint = endpoint[1:].replace("/", "_")
810
642
 
811
643
  schema_to_override = openapi_schema["components"]["schemas"][
812
- f"Body_{func_name}_{endpoint}_post"
644
+ f"Body_{func}_{endpoint}_post"
813
645
  ]["properties"]
814
646
 
815
647
  for param_name, param_val in params.items():
@@ -2,13 +2,6 @@ import json
2
2
  from typing import Dict, List, Optional, Any, Union
3
3
 
4
4
  from pydantic import ConfigDict, BaseModel, HttpUrl
5
- from dataclasses import dataclass
6
- from typing import Union
7
-
8
-
9
- @dataclass
10
- class MultipleChoice:
11
- choices: Union[List[str], Dict[str, List[str]]]
12
5
 
13
6
 
14
7
  class InFile:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "agenta"
3
- version = "0.21.0a1"
3
+ version = "0.22.0"
4
4
  description = "The SDK for agenta is an open-source LLMOps platform."
5
5
  readme = "README.md"
6
6
  authors = ["Mahmoud Mabrouk <mahmoud@agenta.ai>"]
@@ -31,7 +31,6 @@ pydantic = ">=2"
31
31
  httpx = ">=0.24, <0.28"
32
32
  pymongo = "^4.6.3"
33
33
  cachetools = "^5.3.3"
34
- pyyaml = "^6.0.2"
35
34
 
36
35
  [tool.poetry.dev-dependencies]
37
36
  pytest = "^8.3"