agenta 0.27.6__tar.gz → 0.27.6a1__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.27.6 → agenta-0.27.6a1}/PKG-INFO +3 -5
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/__init__.py +29 -6
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/__init__.py +8 -4
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/agenta_init.py +10 -3
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/decorators/routing.py +27 -3
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/decorators/tracing.py +31 -7
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/litellm/litellm.py +36 -25
- agenta-0.27.6a1/agenta/sdk/middleware/auth.py +142 -0
- agenta-0.27.6a1/agenta/sdk/middleware/cache.py +43 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/tracing/exporters.py +1 -1
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/tracing/processors.py +1 -1
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/tracing/tracing.py +7 -1
- agenta-0.27.6a1/agenta/sdk/utils/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/pyproject.toml +1 -4
- {agenta-0.27.6 → agenta-0.27.6a1}/README.md +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/cli/evaluation_commands.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/cli/helper.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/cli/main.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/cli/telemetry.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/cli/variant_commands.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/cli/variant_configs.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/Readme.md +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/api.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/api_models.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/apps/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/apps/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/bases/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/bases/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/configs/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/configs/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/containers/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/containers/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/containers/types/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/containers/types/container_templates_response.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/core/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/core/api_error.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/core/client_wrapper.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/core/datetime_utils.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/core/file.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/core/http_client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/core/jsonable_encoder.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/core/pydantic_utilities.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/core/query_encoder.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/core/remove_none_from_dict.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/core/request_options.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/core/serialization.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/environments/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/environments/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/errors/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/errors/unprocessable_entity_error.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/evaluations/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/evaluations/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/evaluators/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/evaluators/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/observability/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/observability/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/testsets/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/testsets/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/aggregated_result.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/aggregated_result_evaluator_config.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/app.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/app_variant_response.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/app_variant_revision.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/base_output.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/body_import_testset.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/config_db.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/config_dto.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/config_response_model.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/correct_answer.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/create_app_output.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/create_span.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/create_trace_response.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/docker_env_vars.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/environment_output.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/environment_output_extended.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/environment_revision.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/error.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/evaluation.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/evaluation_scenario.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/evaluation_scenario_input.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/evaluation_scenario_output.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/evaluation_scenario_result.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/evaluation_scenario_score_update.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/evaluation_status_enum.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/evaluation_type.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/evaluator.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/evaluator_config.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/evaluator_mapping_output_interface.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/evaluator_output_interface.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/get_config_response.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/http_validation_error.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/human_evaluation.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/human_evaluation_scenario.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/human_evaluation_scenario_input.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/human_evaluation_scenario_output.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/human_evaluation_scenario_update.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/human_evaluation_update.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/image.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/invite_request.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/lifecycle_dto.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/list_api_keys_response.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/llm_run_rate_limit.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/llm_tokens.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/lm_providers_enum.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/new_human_evaluation.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/new_testset.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/organization.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/organization_output.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/outputs.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/permission.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/reference_dto.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/reference_request_model.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/result.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/score.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/simple_evaluation_output.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/span.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/span_detail.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/span_status_code.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/span_variant.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/template.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/template_image_info.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/test_set_output_response.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/test_set_simple_response.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/trace_detail.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/update_app_output.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/uri.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/validation_error.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/validation_error_loc_item.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/variant_action.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/variant_action_enum.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/with_pagination.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/workspace_member_response.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/workspace_permission.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/workspace_response.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/workspace_role.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/types/workspace_role_response.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/variants/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/variants/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/variants/types/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/client/exceptions.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/config.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/config.toml +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/docker/docker-assets/Dockerfile.cloud.template +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/docker/docker-assets/Dockerfile.template +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/docker/docker-assets/README.md +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/docker/docker-assets/entrypoint.sh +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/docker/docker-assets/lambda_function.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/docker/docker-assets/main.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/docker/docker_utils.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/assets.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/client.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/context/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/context/routing.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/context/tracing.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/decorators/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/litellm/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/managers/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/managers/config.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/managers/deployment.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/managers/shared.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/managers/variant.py +0 -0
- {agenta-0.27.6/agenta/sdk/utils → agenta-0.27.6a1/agenta/sdk/middleware}/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/router.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/tracing/__init__.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/tracing/attributes.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/tracing/context.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/tracing/conventions.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/tracing/inline.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/tracing/spans.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/types.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/utils/costs.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/utils/debug.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/utils/exceptions.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/utils/globals.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/utils/logging.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/utils/preinit.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/sdk/utils/singleton.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/compose_email/README.md +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/compose_email/app.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/compose_email/env.example +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/compose_email/requirements.txt +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/compose_email/template.toml +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/extract_data_to_json/README.md +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/extract_data_to_json/app.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/extract_data_to_json/env.example +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/extract_data_to_json/requirements.txt +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/extract_data_to_json/template.toml +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/simple_prompt/README.md +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/simple_prompt/app.py +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/simple_prompt/env.example +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/agenta/templates/simple_prompt/requirements.txt +0 -0
- {agenta-0.27.6 → agenta-0.27.6a1}/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.27.
|
|
3
|
+
Version: 0.27.6a1
|
|
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
|
|
@@ -13,7 +13,8 @@ Classifier: Programming Language :: Python :: 3
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.9
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
18
|
Classifier: Topic :: Software Development :: Libraries
|
|
18
19
|
Requires-Dist: cachetools (>=5.3.3,<6.0.0)
|
|
19
20
|
Requires-Dist: click (>=8.1.3,<9.0.0)
|
|
@@ -21,16 +22,13 @@ Requires-Dist: docker (>=6.1.1,<8.0.0)
|
|
|
21
22
|
Requires-Dist: fastapi (>=0.100.0)
|
|
22
23
|
Requires-Dist: httpx (>=0.24,<0.28)
|
|
23
24
|
Requires-Dist: importlib-metadata (>=8.0.0,<9.0)
|
|
24
|
-
Requires-Dist: ipdb (>=0.13)
|
|
25
25
|
Requires-Dist: litellm (>=1.48.0,<2.0.0)
|
|
26
26
|
Requires-Dist: opentelemetry-api (>=1.27.0,<2.0.0)
|
|
27
27
|
Requires-Dist: opentelemetry-exporter-otlp (>=1.27.0,<2.0.0)
|
|
28
28
|
Requires-Dist: opentelemetry-sdk (>=1.27.0,<2.0.0)
|
|
29
29
|
Requires-Dist: posthog (>=3.1.0,<4.0.0)
|
|
30
30
|
Requires-Dist: pydantic (>=2)
|
|
31
|
-
Requires-Dist: pymongo (>=4.6.3,<5.0.0)
|
|
32
31
|
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
|
|
33
|
-
Requires-Dist: python-multipart (>=0.0.6,<0.0.10)
|
|
34
32
|
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
35
33
|
Requires-Dist: questionary (>=1.10,<3.0)
|
|
36
34
|
Requires-Dist: toml (>=0.10.2,<0.11.0)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Any, Callable, Optional
|
|
2
|
+
|
|
1
3
|
from .sdk.utils.preinit import PreInitObject
|
|
2
4
|
|
|
3
5
|
import agenta.client.backend.types as client_types # pylint: disable=wrong-import-order
|
|
@@ -18,7 +20,7 @@ from .sdk.types import (
|
|
|
18
20
|
)
|
|
19
21
|
|
|
20
22
|
from .sdk.utils.logging import log as logging
|
|
21
|
-
from .sdk.tracing import Tracing
|
|
23
|
+
from .sdk.tracing import Tracing, get_tracer
|
|
22
24
|
from .sdk.decorators.tracing import instrument
|
|
23
25
|
from .sdk.tracing.conventions import Reference
|
|
24
26
|
from .sdk.decorators.routing import entrypoint, app, route
|
|
@@ -36,15 +38,36 @@ config = PreInitObject("agenta.config", Config)
|
|
|
36
38
|
DEFAULT_AGENTA_SINGLETON_INSTANCE = AgentaSingleton()
|
|
37
39
|
|
|
38
40
|
types = client_types
|
|
39
|
-
|
|
41
|
+
|
|
40
42
|
api = None
|
|
41
43
|
async_api = None
|
|
42
44
|
|
|
45
|
+
tracing = DEFAULT_AGENTA_SINGLETON_INSTANCE.tracing # type: ignore
|
|
46
|
+
tracer = get_tracer(tracing)
|
|
43
47
|
|
|
44
|
-
def init(*args, **kwargs):
|
|
45
|
-
global api, async_api, tracing, config
|
|
46
|
-
_init(*args, **kwargs)
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
def init(
|
|
50
|
+
host: Optional[str] = None,
|
|
51
|
+
api_key: Optional[str] = None,
|
|
52
|
+
config_fname: Optional[str] = None,
|
|
53
|
+
redact: Optional[Callable[..., Any]] = None,
|
|
54
|
+
redact_on_error: Optional[bool] = True,
|
|
55
|
+
# DEPRECATING
|
|
56
|
+
app_id: Optional[str] = None,
|
|
57
|
+
):
|
|
58
|
+
global api, async_api, tracing, tracer # pylint: disable=global-statement
|
|
59
|
+
|
|
60
|
+
_init(
|
|
61
|
+
host=host,
|
|
62
|
+
api_key=api_key,
|
|
63
|
+
config_fname=config_fname,
|
|
64
|
+
redact=redact,
|
|
65
|
+
redact_on_error=redact_on_error,
|
|
66
|
+
app_id=app_id,
|
|
67
|
+
)
|
|
68
|
+
|
|
49
69
|
api = DEFAULT_AGENTA_SINGLETON_INSTANCE.api # type: ignore
|
|
50
70
|
async_api = DEFAULT_AGENTA_SINGLETON_INSTANCE.async_api # type: ignore
|
|
71
|
+
|
|
72
|
+
tracing = DEFAULT_AGENTA_SINGLETON_INSTANCE.tracing # type: ignore
|
|
73
|
+
tracer = get_tracer(tracing)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Optional
|
|
1
|
+
from typing import Optional, Callable, Any
|
|
2
2
|
|
|
3
3
|
from .utils.preinit import PreInitObject # always the first import!
|
|
4
4
|
|
|
@@ -43,17 +43,21 @@ tracer = get_tracer(tracing)
|
|
|
43
43
|
|
|
44
44
|
def init(
|
|
45
45
|
host: Optional[str] = None,
|
|
46
|
-
app_id: Optional[str] = None,
|
|
47
46
|
api_key: Optional[str] = None,
|
|
48
47
|
config_fname: Optional[str] = None,
|
|
48
|
+
redact: Optional[Callable[..., Any]] = None,
|
|
49
|
+
redact_on_error: Optional[bool] = True,
|
|
50
|
+
# DEPRECATING
|
|
51
|
+
app_id: Optional[str] = None,
|
|
49
52
|
):
|
|
50
|
-
global api, async_api, tracing, tracer
|
|
53
|
+
global api, async_api, tracing, tracer # pylint: disable=global-statement
|
|
51
54
|
|
|
52
55
|
_init(
|
|
53
56
|
host=host,
|
|
54
57
|
api_key=api_key,
|
|
55
58
|
config_fname=config_fname,
|
|
56
|
-
|
|
59
|
+
redact=redact,
|
|
60
|
+
redact_on_error=redact_on_error,
|
|
57
61
|
app_id=app_id,
|
|
58
62
|
)
|
|
59
63
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import toml
|
|
3
3
|
from os import getenv
|
|
4
|
-
from typing import Optional
|
|
4
|
+
from typing import Optional, Callable, Any
|
|
5
5
|
from importlib.metadata import version
|
|
6
6
|
|
|
7
7
|
from agenta.sdk.utils.logging import log
|
|
@@ -36,6 +36,8 @@ class AgentaSingleton:
|
|
|
36
36
|
host: Optional[str] = None,
|
|
37
37
|
api_key: Optional[str] = None,
|
|
38
38
|
config_fname: Optional[str] = None,
|
|
39
|
+
redact: Optional[Callable[..., Any]] = None,
|
|
40
|
+
redact_on_error: Optional[bool] = True,
|
|
39
41
|
# DEPRECATING
|
|
40
42
|
app_id: Optional[str] = None,
|
|
41
43
|
) -> None:
|
|
@@ -91,6 +93,8 @@ class AgentaSingleton:
|
|
|
91
93
|
|
|
92
94
|
self.tracing = Tracing(
|
|
93
95
|
url=f"{self.host}/api/observability/v1/otlp/traces", # type: ignore
|
|
96
|
+
redact=redact,
|
|
97
|
+
redact_on_error=redact_on_error,
|
|
94
98
|
)
|
|
95
99
|
|
|
96
100
|
self.tracing.configure(
|
|
@@ -258,7 +262,9 @@ def init(
|
|
|
258
262
|
host: Optional[str] = None,
|
|
259
263
|
api_key: Optional[str] = None,
|
|
260
264
|
config_fname: Optional[str] = None,
|
|
261
|
-
|
|
265
|
+
redact: Optional[Callable[..., Any]] = None,
|
|
266
|
+
redact_on_error: Optional[bool] = True,
|
|
267
|
+
# DEPRECATING
|
|
262
268
|
app_id: Optional[str] = None,
|
|
263
269
|
):
|
|
264
270
|
"""Main function to initialize the agenta sdk.
|
|
@@ -289,7 +295,8 @@ def init(
|
|
|
289
295
|
host=host,
|
|
290
296
|
api_key=api_key,
|
|
291
297
|
config_fname=config_fname,
|
|
292
|
-
|
|
298
|
+
redact=redact,
|
|
299
|
+
redact_on_error=redact_on_error,
|
|
293
300
|
app_id=app_id,
|
|
294
301
|
)
|
|
295
302
|
|
|
@@ -14,9 +14,10 @@ from os import environ
|
|
|
14
14
|
from fastapi.middleware.cors import CORSMiddleware
|
|
15
15
|
from fastapi import Body, FastAPI, UploadFile, HTTPException
|
|
16
16
|
|
|
17
|
+
from agenta.sdk.middleware.auth import AuthorizationMiddleware
|
|
17
18
|
from agenta.sdk.context.routing import routing_context_manager, routing_context
|
|
18
19
|
from agenta.sdk.context.tracing import tracing_context
|
|
19
|
-
from agenta.sdk.router import router
|
|
20
|
+
from agenta.sdk.router import router
|
|
20
21
|
from agenta.sdk.utils.exceptions import suppress
|
|
21
22
|
from agenta.sdk.utils.logging import log
|
|
22
23
|
from agenta.sdk.types import (
|
|
@@ -50,6 +51,9 @@ app.add_middleware(
|
|
|
50
51
|
allow_headers=["*"],
|
|
51
52
|
)
|
|
52
53
|
|
|
54
|
+
_MIDDLEWARES = True
|
|
55
|
+
|
|
56
|
+
|
|
53
57
|
app.include_router(router, prefix="")
|
|
54
58
|
|
|
55
59
|
|
|
@@ -121,6 +125,26 @@ class entrypoint:
|
|
|
121
125
|
route_path="",
|
|
122
126
|
config_schema: Optional[BaseModel] = None,
|
|
123
127
|
):
|
|
128
|
+
### --- Update Middleware --- #
|
|
129
|
+
try:
|
|
130
|
+
global _MIDDLEWARES # pylint: disable=global-statement
|
|
131
|
+
|
|
132
|
+
if _MIDDLEWARES:
|
|
133
|
+
app.add_middleware(
|
|
134
|
+
AuthorizationMiddleware,
|
|
135
|
+
host=ag.DEFAULT_AGENTA_SINGLETON_INSTANCE.host,
|
|
136
|
+
resource_id=ag.DEFAULT_AGENTA_SINGLETON_INSTANCE.app_id,
|
|
137
|
+
resource_type="application",
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
_MIDDLEWARES = False
|
|
141
|
+
|
|
142
|
+
except: # pylint: disable=bare-except
|
|
143
|
+
log.error("------------------------------------")
|
|
144
|
+
log.error("Agenta SDK - failed to secure route: %s", route_path)
|
|
145
|
+
log.error("------------------------------------")
|
|
146
|
+
### --- Update Middleware --- #
|
|
147
|
+
|
|
124
148
|
DEFAULT_PATH = "generate"
|
|
125
149
|
PLAYGROUND_PATH = "/playground"
|
|
126
150
|
RUN_PATH = "/run"
|
|
@@ -330,9 +354,9 @@ class entrypoint:
|
|
|
330
354
|
*args,
|
|
331
355
|
**func_params,
|
|
332
356
|
):
|
|
333
|
-
log.info(
|
|
357
|
+
log.info("---------------------------")
|
|
334
358
|
log.info(f"Agenta SDK - running route: {repr(self.route_path or '/')}")
|
|
335
|
-
log.info(
|
|
359
|
+
log.info("---------------------------")
|
|
336
360
|
|
|
337
361
|
tracing_context.set(routing_context.get())
|
|
338
362
|
|
|
@@ -19,6 +19,8 @@ class instrument: # pylint: disable=invalid-name
|
|
|
19
19
|
config: Optional[Dict[str, Any]] = None,
|
|
20
20
|
ignore_inputs: Optional[bool] = None,
|
|
21
21
|
ignore_outputs: Optional[bool] = None,
|
|
22
|
+
redact: Optional[Callable[..., Any]] = None,
|
|
23
|
+
redact_on_error: Optional[bool] = True,
|
|
22
24
|
max_depth: Optional[int] = 2,
|
|
23
25
|
# DEPRECATING
|
|
24
26
|
kind: str = "task",
|
|
@@ -29,6 +31,8 @@ class instrument: # pylint: disable=invalid-name
|
|
|
29
31
|
self.config = config
|
|
30
32
|
self.ignore_inputs = ignore_inputs
|
|
31
33
|
self.ignore_outputs = ignore_outputs
|
|
34
|
+
self.redact = redact
|
|
35
|
+
self.redact_on_error = redact_on_error
|
|
32
36
|
self.max_depth = max_depth
|
|
33
37
|
|
|
34
38
|
def __call__(self, func: Callable[..., Any]):
|
|
@@ -109,12 +113,10 @@ class instrument: # pylint: disable=invalid-name
|
|
|
109
113
|
)
|
|
110
114
|
|
|
111
115
|
_inputs = self._redact(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
),
|
|
117
|
-
self.ignore_inputs,
|
|
116
|
+
name=span.name,
|
|
117
|
+
field="inputs",
|
|
118
|
+
io=self._parse(func, *args, **kwargs),
|
|
119
|
+
ignore=self.ignore_inputs,
|
|
118
120
|
)
|
|
119
121
|
span.set_attributes(
|
|
120
122
|
attributes={"inputs": _inputs},
|
|
@@ -153,7 +155,12 @@ class instrument: # pylint: disable=invalid-name
|
|
|
153
155
|
namespace="metrics.unit.tokens",
|
|
154
156
|
)
|
|
155
157
|
|
|
156
|
-
_outputs = self._redact(
|
|
158
|
+
_outputs = self._redact(
|
|
159
|
+
name=span.name,
|
|
160
|
+
field="outputs",
|
|
161
|
+
io=self._patch(result),
|
|
162
|
+
ignore=self.ignore_outputs,
|
|
163
|
+
)
|
|
157
164
|
span.set_attributes(
|
|
158
165
|
attributes={"outputs": _outputs},
|
|
159
166
|
namespace="data",
|
|
@@ -192,6 +199,9 @@ class instrument: # pylint: disable=invalid-name
|
|
|
192
199
|
|
|
193
200
|
def _redact(
|
|
194
201
|
self,
|
|
202
|
+
*,
|
|
203
|
+
name: str,
|
|
204
|
+
field: str,
|
|
195
205
|
io: Dict[str, Any],
|
|
196
206
|
ignore: Union[List[str], bool] = False,
|
|
197
207
|
) -> Dict[str, Any]:
|
|
@@ -220,6 +230,20 @@ class instrument: # pylint: disable=invalid-name
|
|
|
220
230
|
)
|
|
221
231
|
}
|
|
222
232
|
|
|
233
|
+
if self.redact is not None:
|
|
234
|
+
try:
|
|
235
|
+
io = self.redact(name, field, io)
|
|
236
|
+
except: # pylint: disable=bare-except
|
|
237
|
+
if self.redact_on_error:
|
|
238
|
+
io = {}
|
|
239
|
+
|
|
240
|
+
if ag.tracing.redact is not None:
|
|
241
|
+
try:
|
|
242
|
+
io = ag.tracing.redact(name, field, io)
|
|
243
|
+
except: # pylint: disable=bare-except
|
|
244
|
+
if ag.tracing.redact_on_error:
|
|
245
|
+
io = {}
|
|
246
|
+
|
|
223
247
|
return io
|
|
224
248
|
|
|
225
249
|
def _patch(
|
|
@@ -89,16 +89,20 @@ def litellm_handler():
|
|
|
89
89
|
log.error("LiteLLM callback error: span not found.")
|
|
90
90
|
return
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
try:
|
|
93
|
+
result = []
|
|
94
|
+
for choice in response_obj.choices:
|
|
95
|
+
message = choice.message.__dict__
|
|
96
|
+
result.append(message)
|
|
93
97
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
outputs = {"completion": result}
|
|
99
|
+
self.span.set_attributes(
|
|
100
|
+
attributes={"outputs": outputs},
|
|
101
|
+
namespace="data",
|
|
102
|
+
)
|
|
97
103
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
namespace="data",
|
|
101
|
-
)
|
|
104
|
+
except Exception as e:
|
|
105
|
+
pass
|
|
102
106
|
|
|
103
107
|
self.span.set_attributes(
|
|
104
108
|
attributes={"total": kwargs.get("response_cost")},
|
|
@@ -194,16 +198,20 @@ def litellm_handler():
|
|
|
194
198
|
log.error("LiteLLM callback error: span not found.")
|
|
195
199
|
return
|
|
196
200
|
|
|
197
|
-
|
|
201
|
+
try:
|
|
202
|
+
result = []
|
|
203
|
+
for choice in response_obj.choices:
|
|
204
|
+
message = choice.message.__dict__
|
|
205
|
+
result.append(message)
|
|
198
206
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
207
|
+
outputs = {"completion": result}
|
|
208
|
+
self.span.set_attributes(
|
|
209
|
+
attributes={"outputs": outputs},
|
|
210
|
+
namespace="data",
|
|
211
|
+
)
|
|
202
212
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
namespace="data",
|
|
206
|
-
)
|
|
213
|
+
except Exception as e:
|
|
214
|
+
pass
|
|
207
215
|
|
|
208
216
|
self.span.set_attributes(
|
|
209
217
|
attributes={"total": kwargs.get("response_cost")},
|
|
@@ -236,17 +244,20 @@ def litellm_handler():
|
|
|
236
244
|
log.error("LiteLLM callback error: span not found.")
|
|
237
245
|
return
|
|
238
246
|
|
|
239
|
-
|
|
240
|
-
|
|
247
|
+
try:
|
|
248
|
+
result = []
|
|
249
|
+
for choice in response_obj.choices:
|
|
250
|
+
message = choice.message.__dict__
|
|
251
|
+
result.append(message)
|
|
241
252
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
253
|
+
outputs = {"completion": result}
|
|
254
|
+
self.span.set_attributes(
|
|
255
|
+
attributes={"outputs": outputs},
|
|
256
|
+
namespace="data",
|
|
257
|
+
)
|
|
245
258
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
namespace="data",
|
|
249
|
-
)
|
|
259
|
+
except Exception as e:
|
|
260
|
+
pass
|
|
250
261
|
|
|
251
262
|
self.span.set_attributes(
|
|
252
263
|
attributes={"total": kwargs.get("response_cost")},
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
from typing import Callable, Optional
|
|
2
|
+
from os import environ
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
from json import dumps
|
|
5
|
+
from traceback import format_exc
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
from starlette.middleware.base import BaseHTTPMiddleware
|
|
9
|
+
from fastapi import FastAPI, Request, Response
|
|
10
|
+
|
|
11
|
+
from agenta.sdk.utils.logging import log
|
|
12
|
+
from agenta.sdk.middleware.cache import TTLLRUCache
|
|
13
|
+
|
|
14
|
+
AGENTA_SDK_AUTH_CACHE_CAPACITY = environ.get(
|
|
15
|
+
"AGENTA_SDK_AUTH_CACHE_CAPACITY",
|
|
16
|
+
512,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
AGENTA_SDK_AUTH_CACHE_TTL = environ.get(
|
|
20
|
+
"AGENTA_SDK_AUTH_CACHE_TTL",
|
|
21
|
+
15 * 60, # 15 minutes
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
AGENTA_SDK_AUTH_CACHE = str(environ.get("AGENTA_SDK_AUTH_CACHE", True)).lower() in (
|
|
25
|
+
"true",
|
|
26
|
+
"1",
|
|
27
|
+
"t",
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
AGENTA_UNAUTHORIZED_EXECUTION_ALLOWED = str(
|
|
31
|
+
environ.get("AGENTA_UNAUTHORIZED_EXECUTION_ALLOWED", False)
|
|
32
|
+
).lower() in ("true", "1", "t")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Deny(Response):
|
|
36
|
+
def __init__(self) -> None:
|
|
37
|
+
super().__init__(status_code=401, content="Unauthorized")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
cache = TTLLRUCache(
|
|
41
|
+
capacity=AGENTA_SDK_AUTH_CACHE_CAPACITY,
|
|
42
|
+
ttl=AGENTA_SDK_AUTH_CACHE_TTL,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class AuthorizationMiddleware(BaseHTTPMiddleware):
|
|
47
|
+
def __init__(
|
|
48
|
+
self,
|
|
49
|
+
app: FastAPI,
|
|
50
|
+
host: str,
|
|
51
|
+
resource_id: UUID,
|
|
52
|
+
resource_type: str,
|
|
53
|
+
):
|
|
54
|
+
super().__init__(app)
|
|
55
|
+
|
|
56
|
+
self.host = host
|
|
57
|
+
self.resource_id = resource_id
|
|
58
|
+
self.resource_type = resource_type
|
|
59
|
+
|
|
60
|
+
async def dispatch(
|
|
61
|
+
self,
|
|
62
|
+
request: Request,
|
|
63
|
+
call_next: Callable,
|
|
64
|
+
project_id: Optional[UUID] = None,
|
|
65
|
+
):
|
|
66
|
+
if AGENTA_UNAUTHORIZED_EXECUTION_ALLOWED:
|
|
67
|
+
return await call_next(request)
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
authorization = (
|
|
71
|
+
request.headers.get("Authorization")
|
|
72
|
+
or request.headers.get("authorization")
|
|
73
|
+
or None
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
headers = {"Authorization": authorization} if authorization else None
|
|
77
|
+
|
|
78
|
+
cookies = {"sAccessToken": request.cookies.get("sAccessToken")}
|
|
79
|
+
|
|
80
|
+
params = {
|
|
81
|
+
"action": "run_service",
|
|
82
|
+
"resource_type": self.resource_type,
|
|
83
|
+
"resource_id": self.resource_id,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if project_id:
|
|
87
|
+
params["project_id"] = project_id
|
|
88
|
+
|
|
89
|
+
_hash = dumps(
|
|
90
|
+
{
|
|
91
|
+
"headers": headers,
|
|
92
|
+
"cookies": cookies,
|
|
93
|
+
"params": params,
|
|
94
|
+
},
|
|
95
|
+
sort_keys=True,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
policy = None
|
|
99
|
+
if AGENTA_SDK_AUTH_CACHE:
|
|
100
|
+
policy = cache.get(_hash)
|
|
101
|
+
|
|
102
|
+
if not policy:
|
|
103
|
+
async with httpx.AsyncClient() as client:
|
|
104
|
+
response = await client.get(
|
|
105
|
+
f"{self.host}/api/permissions/verify",
|
|
106
|
+
headers=headers,
|
|
107
|
+
cookies=cookies,
|
|
108
|
+
params=params,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
if response.status_code != 200:
|
|
112
|
+
cache.put(_hash, {"effect": "deny"})
|
|
113
|
+
return Deny()
|
|
114
|
+
|
|
115
|
+
auth = response.json()
|
|
116
|
+
|
|
117
|
+
if auth.get("effect") != "allow":
|
|
118
|
+
cache.put(_hash, {"effect": "deny"})
|
|
119
|
+
return Deny()
|
|
120
|
+
|
|
121
|
+
policy = {
|
|
122
|
+
"effect": "allow",
|
|
123
|
+
"credentials": auth.get("credentials"),
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
cache.put(_hash, policy)
|
|
127
|
+
|
|
128
|
+
if policy.get("effect") == "deny":
|
|
129
|
+
return Deny()
|
|
130
|
+
|
|
131
|
+
request.state.credentials = policy.get("credentials")
|
|
132
|
+
|
|
133
|
+
return await call_next(request)
|
|
134
|
+
|
|
135
|
+
except: # pylint: disable=bare-except
|
|
136
|
+
log.error("------------------------------------------------------")
|
|
137
|
+
log.error("Agenta SDK - handling auth middleware exception below:")
|
|
138
|
+
log.error("------------------------------------------------------")
|
|
139
|
+
log.error(format_exc().strip("\n"))
|
|
140
|
+
log.error("------------------------------------------------------")
|
|
141
|
+
|
|
142
|
+
return Deny()
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from time import time
|
|
2
|
+
from collections import OrderedDict
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class TTLLRUCache:
|
|
6
|
+
def __init__(self, capacity: int, ttl: int):
|
|
7
|
+
self.cache = OrderedDict()
|
|
8
|
+
self.capacity = capacity
|
|
9
|
+
self.ttl = ttl
|
|
10
|
+
|
|
11
|
+
def get(self, key):
|
|
12
|
+
# CACHE
|
|
13
|
+
if key not in self.cache:
|
|
14
|
+
return None
|
|
15
|
+
|
|
16
|
+
value, expiry = self.cache[key]
|
|
17
|
+
# -----
|
|
18
|
+
|
|
19
|
+
# TTL
|
|
20
|
+
if time() > expiry:
|
|
21
|
+
del self.cache[key]
|
|
22
|
+
|
|
23
|
+
return None
|
|
24
|
+
# ---
|
|
25
|
+
|
|
26
|
+
# LRU
|
|
27
|
+
self.cache.move_to_end(key)
|
|
28
|
+
# ---
|
|
29
|
+
|
|
30
|
+
return value
|
|
31
|
+
|
|
32
|
+
def put(self, key, value):
|
|
33
|
+
# CACHE
|
|
34
|
+
if key in self.cache:
|
|
35
|
+
del self.cache[key]
|
|
36
|
+
# CACHE & LRU
|
|
37
|
+
elif len(self.cache) >= self.capacity:
|
|
38
|
+
self.cache.popitem(last=False)
|
|
39
|
+
# -----------
|
|
40
|
+
|
|
41
|
+
# TTL
|
|
42
|
+
self.cache[key] = (value, time() + self.ttl)
|
|
43
|
+
# ---
|
|
@@ -58,7 +58,7 @@ class InlineTraceExporter(SpanExporter):
|
|
|
58
58
|
return trace
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
OTLPSpanExporter._MAX_RETRY_TIMEOUT = 2
|
|
61
|
+
OTLPSpanExporter._MAX_RETRY_TIMEOUT = 2 # pylint: disable=protected-access
|
|
62
62
|
|
|
63
63
|
ConsoleExporter = ConsoleSpanExporter
|
|
64
64
|
InlineExporter = InlineTraceExporter
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Optional, Any, Dict
|
|
1
|
+
from typing import Optional, Any, Dict, Callable
|
|
2
2
|
from enum import Enum
|
|
3
3
|
|
|
4
4
|
from httpx import get as check
|
|
@@ -32,6 +32,8 @@ class Tracing(metaclass=Singleton):
|
|
|
32
32
|
def __init__(
|
|
33
33
|
self,
|
|
34
34
|
url: str,
|
|
35
|
+
redact: Optional[Callable[..., Any]] = None,
|
|
36
|
+
redact_on_error: Optional[bool] = True,
|
|
35
37
|
) -> None:
|
|
36
38
|
# ENDPOINT (OTLP)
|
|
37
39
|
self.otlp_url = url
|
|
@@ -49,6 +51,10 @@ class Tracing(metaclass=Singleton):
|
|
|
49
51
|
# INLINE SPANS for INLINE TRACES (INLINE PROCESSOR)
|
|
50
52
|
self.inline_spans: Dict[str, Any] = dict()
|
|
51
53
|
|
|
54
|
+
# REDACT
|
|
55
|
+
self.redact = redact
|
|
56
|
+
self.redact_on_error = redact_on_error
|
|
57
|
+
|
|
52
58
|
# PUBLIC
|
|
53
59
|
|
|
54
60
|
def configure(
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "agenta"
|
|
3
|
-
version = "0.27.
|
|
3
|
+
version = "0.27.6a1"
|
|
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>"]
|
|
@@ -26,14 +26,11 @@ click = "^8.1.3"
|
|
|
26
26
|
fastapi = ">=0.100.0"
|
|
27
27
|
toml = "^0.10.2"
|
|
28
28
|
questionary = ">=1.10,<3.0"
|
|
29
|
-
ipdb = ">=0.13"
|
|
30
29
|
python-dotenv = "^1.0.0"
|
|
31
|
-
python-multipart = ">=0.0.6,<0.0.10"
|
|
32
30
|
importlib-metadata = ">=8.0.0,<9.0"
|
|
33
31
|
posthog = "^3.1.0"
|
|
34
32
|
pydantic = ">=2"
|
|
35
33
|
httpx = ">=0.24, <0.28"
|
|
36
|
-
pymongo = "^4.6.3"
|
|
37
34
|
cachetools = "^5.3.3"
|
|
38
35
|
pyyaml = "^6.0.2"
|
|
39
36
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|