agenta 0.21.0a1__tar.gz → 0.21.0b1__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.
Potentially problematic release.
This version of agenta might be problematic. Click here for more details.
- {agenta-0.21.0a1 → agenta-0.21.0b1}/PKG-INFO +1 -2
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/__init__.py +1 -2
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/docker/docker_utils.py +1 -2
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/__init__.py +0 -2
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/decorators/llm_entrypoint.py +55 -223
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/types.py +0 -7
- {agenta-0.21.0a1 → agenta-0.21.0b1}/pyproject.toml +1 -2
- agenta-0.21.0a1/agenta/sdk/config_manager.py +0 -205
- {agenta-0.21.0a1 → agenta-0.21.0b1}/README.md +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/cli/evaluation_commands.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/cli/helper.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/cli/main.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/cli/telemetry.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/cli/variant_commands.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/cli/variant_configs.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/Readme.md +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/api.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/api_models.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/core/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/core/api_error.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/core/client_wrapper.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/core/datetime_utils.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/core/jsonable_encoder.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/core/remove_none_from_dict.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/errors/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/errors/unprocessable_entity_error.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/apps/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/apps/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/bases/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/bases/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/configs/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/configs/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/containers/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/containers/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/containers/types/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/containers/types/container_templates_response.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/environments/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/environments/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/evaluations/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/evaluations/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/evaluators/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/evaluators/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/observability/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/observability/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/testsets/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/testsets/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/variants/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/variants/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/variants/types/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/resources/variants/types/add_variant_from_base_and_config_response.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/aggregated_result.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/aggregated_result_evaluator_config.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/app.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/app_variant_response.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/app_variant_revision.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/base_output.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/body_import_testset.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/config_db.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/create_app_output.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/create_span.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/create_trace_response.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/docker_env_vars.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/environment_output.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/environment_output_extended.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/environment_revision.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/error.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/evaluation.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/evaluation_scenario.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/evaluation_scenario_input.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/evaluation_scenario_output.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/evaluation_scenario_result.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/evaluation_scenario_score_update.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/evaluation_status_enum.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/evaluation_type.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/evaluation_webhook.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/evaluator.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/evaluator_config.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/feedback.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/get_config_response.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/http_validation_error.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/human_evaluation.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/human_evaluation_scenario.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/human_evaluation_scenario_input.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/human_evaluation_scenario_output.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/human_evaluation_scenario_update.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/human_evaluation_update.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/image.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/invite_request.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/list_api_keys_response.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/llm_run_rate_limit.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/llm_tokens.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/new_human_evaluation.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/new_testset.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/organization.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/organization_output.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/permission.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/result.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/score.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/simple_evaluation_output.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/span.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/span_detail.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/span_kind.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/span_status_code.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/span_variant.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/template.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/template_image_info.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/test_set_output_response.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/test_set_simple_response.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/trace_detail.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/uri.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/validation_error.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/validation_error_loc_item.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/variant_action.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/variant_action_enum.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/with_pagination.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/workspace_member_response.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/workspace_permission.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/workspace_response.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/workspace_role.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/backend/types/workspace_role_response.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/client/exceptions.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/config.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/config.toml +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/docker/docker-assets/Dockerfile.cloud.template +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/docker/docker-assets/Dockerfile.template +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/docker/docker-assets/README.md +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/docker/docker-assets/entrypoint.sh +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/docker/docker-assets/lambda_function.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/docker/docker-assets/main.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/agenta_init.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/client.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/context.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/decorators/base.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/decorators/tracing.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/router.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/tracing/__init__.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/tracing/callbacks.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/tracing/llm_tracing.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/tracing/logger.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/tracing/tasks_manager.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/tracing/tracing_context.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/utils/debug.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/utils/globals.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/utils/helper/openai_cost.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/sdk/utils/preinit.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/compose_email/README.md +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/compose_email/app.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/compose_email/env.example +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/compose_email/requirements.txt +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/compose_email/template.toml +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/extract_data_to_json/README.md +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/extract_data_to_json/app.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/extract_data_to_json/env.example +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/extract_data_to_json/requirements.txt +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/extract_data_to_json/template.toml +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/simple_prompt/README.md +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/simple_prompt/app.py +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/simple_prompt/env.example +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/agenta/templates/simple_prompt/requirements.txt +0 -0
- {agenta-0.21.0a1 → agenta-0.21.0b1}/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.
|
|
3
|
+
Version: 0.21.0b1
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
|
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 == ""
|
|
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
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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
|
-
|
|
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
|
-
|
|
234
|
+
func=route["func"],
|
|
293
235
|
endpoint=route["endpoint"],
|
|
294
236
|
params=route["params"],
|
|
295
237
|
)
|
|
296
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
492
|
-
|
|
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,
|
|
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
|
|
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
|
|
525
|
-
|
|
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
|
-
|
|
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":
|
|
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,
|
|
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_{
|
|
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.
|
|
3
|
+
version = "0.21.0b1"
|
|
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"
|