agenta 0.25.4a3__tar.gz → 0.25.4a4__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.25.4a3 → agenta-0.25.4a4}/PKG-INFO +1 -5
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/__init__.py +7 -6
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/client.py +14 -22
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/core/http_client.py +15 -23
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/core/pydantic_utilities.py +0 -2
- agenta-0.25.4a4/agenta/sdk/__init__.py +27 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/sdk/agenta_init.py +26 -73
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/sdk/config_manager.py +2 -2
- agenta-0.25.4a4/agenta/sdk/context.py +41 -0
- agenta-0.25.4a4/agenta/sdk/decorators/base.py +10 -0
- agenta-0.25.4a3/agenta/sdk/decorators/routing.py → agenta-0.25.4a4/agenta/sdk/decorators/llm_entrypoint.py +124 -137
- agenta-0.25.4a4/agenta/sdk/decorators/tracing.py +131 -0
- agenta-0.25.4a4/agenta/sdk/router.py +15 -0
- agenta-0.25.4a4/agenta/sdk/tracing/callbacks.py +187 -0
- agenta-0.25.4a4/agenta/sdk/tracing/llm_tracing.py +617 -0
- agenta-0.25.4a3/agenta/sdk/utils/logging.py → agenta-0.25.4a4/agenta/sdk/tracing/logger.py +5 -3
- agenta-0.25.4a4/agenta/sdk/tracing/tasks_manager.py +129 -0
- agenta-0.25.4a4/agenta/sdk/tracing/tracing_context.py +27 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/sdk/types.py +12 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/sdk/utils/debug.py +5 -5
- agenta-0.25.4a4/agenta/sdk/utils/globals.py +16 -0
- agenta-0.25.4a3/agenta/sdk/utils/costs.py → agenta-0.25.4a4/agenta/sdk/utils/helper/openai_cost.py +0 -3
- {agenta-0.25.4a3 → agenta-0.25.4a4}/pyproject.toml +1 -6
- agenta-0.25.4a3/agenta/sdk/__init__.py +0 -48
- agenta-0.25.4a3/agenta/sdk/context/routing.py +0 -25
- agenta-0.25.4a3/agenta/sdk/context/tracing.py +0 -3
- agenta-0.25.4a3/agenta/sdk/decorators/tracing.py +0 -299
- agenta-0.25.4a3/agenta/sdk/litellm/__init__.py +0 -1
- agenta-0.25.4a3/agenta/sdk/litellm/litellm.py +0 -277
- agenta-0.25.4a3/agenta/sdk/router.py +0 -8
- agenta-0.25.4a3/agenta/sdk/tracing/__init__.py +0 -1
- agenta-0.25.4a3/agenta/sdk/tracing/attributes.py +0 -181
- agenta-0.25.4a3/agenta/sdk/tracing/context.py +0 -21
- agenta-0.25.4a3/agenta/sdk/tracing/conventions.py +0 -43
- agenta-0.25.4a3/agenta/sdk/tracing/exporters.py +0 -53
- agenta-0.25.4a3/agenta/sdk/tracing/inline.py +0 -1305
- agenta-0.25.4a3/agenta/sdk/tracing/processors.py +0 -65
- agenta-0.25.4a3/agenta/sdk/tracing/spans.py +0 -124
- agenta-0.25.4a3/agenta/sdk/tracing/tracing.py +0 -174
- agenta-0.25.4a3/agenta/sdk/utils/__init__.py +0 -0
- agenta-0.25.4a3/agenta/sdk/utils/exceptions.py +0 -19
- agenta-0.25.4a3/agenta/sdk/utils/globals.py +0 -14
- agenta-0.25.4a3/agenta/sdk/utils/singleton.py +0 -13
- {agenta-0.25.4a3 → agenta-0.25.4a4}/README.md +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/cli/evaluation_commands.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/cli/helper.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/cli/main.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/cli/telemetry.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/cli/variant_commands.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/cli/variant_configs.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/Readme.md +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/api.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/api_models.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/apps/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/apps/client.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/bases/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/bases/client.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/configs/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/configs/client.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/containers/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/containers/client.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/containers/types/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/containers/types/container_templates_response.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/core/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/core/api_error.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/core/client_wrapper.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/core/datetime_utils.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/core/file.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/core/jsonable_encoder.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/core/query_encoder.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/core/remove_none_from_dict.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/core/request_options.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/core/serialization.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/environments/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/environments/client.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/errors/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/errors/unprocessable_entity_error.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/evaluations/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/evaluations/client.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/evaluators/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/evaluators/client.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/observability/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/observability/client.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/testsets/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/testsets/client.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/aggregated_result.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/aggregated_result_evaluator_config.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/app.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/app_variant_response.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/app_variant_revision.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/base_output.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/body_import_testset.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/config_db.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/correct_answer.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/create_app_output.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/create_span.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/create_trace_response.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/docker_env_vars.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/environment_output.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/environment_output_extended.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/environment_revision.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/error.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/evaluation.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/evaluation_scenario.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/evaluation_scenario_input.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/evaluation_scenario_output.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/evaluation_scenario_result.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/evaluation_scenario_score_update.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/evaluation_status_enum.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/evaluation_type.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/evaluator.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/evaluator_config.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/get_config_response.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/http_validation_error.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/human_evaluation.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/human_evaluation_scenario.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/human_evaluation_scenario_input.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/human_evaluation_scenario_output.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/human_evaluation_scenario_update.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/human_evaluation_update.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/image.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/invite_request.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/list_api_keys_response.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/llm_run_rate_limit.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/llm_tokens.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/lm_providers_enum.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/new_human_evaluation.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/new_testset.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/organization.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/organization_output.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/outputs.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/permission.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/result.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/score.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/simple_evaluation_output.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/span.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/span_detail.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/span_status_code.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/span_variant.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/template.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/template_image_info.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/test_set_output_response.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/test_set_simple_response.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/trace_detail.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/update_app_output.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/uri.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/validation_error.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/validation_error_loc_item.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/variant_action.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/variant_action_enum.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/with_pagination.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/workspace_member_response.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/workspace_permission.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/workspace_response.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/workspace_role.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/types/workspace_role_response.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/variants/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/variants/client.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/variants/types/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/client.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/client/exceptions.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/config.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/config.toml +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/docker/docker-assets/Dockerfile.cloud.template +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/docker/docker-assets/Dockerfile.template +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/docker/docker-assets/README.md +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/docker/docker-assets/entrypoint.sh +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/docker/docker-assets/lambda_function.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/docker/docker-assets/main.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/docker/docker_utils.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/sdk/assets.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/sdk/client.py +0 -0
- {agenta-0.25.4a3/agenta/sdk/context → agenta-0.25.4a4/agenta/sdk/tracing}/__init__.py +0 -0
- {agenta-0.25.4a3/agenta/sdk/decorators → agenta-0.25.4a4/agenta/sdk/utils}/__init__.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/sdk/utils/preinit.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/compose_email/README.md +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/compose_email/app.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/compose_email/env.example +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/compose_email/requirements.txt +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/compose_email/template.toml +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/extract_data_to_json/README.md +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/extract_data_to_json/app.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/extract_data_to_json/env.example +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/extract_data_to_json/requirements.txt +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/extract_data_to_json/template.toml +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/simple_prompt/README.md +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/simple_prompt/app.py +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/simple_prompt/env.example +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/agenta/templates/simple_prompt/requirements.txt +0 -0
- {agenta-0.25.4a3 → agenta-0.25.4a4}/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.25.
|
|
3
|
+
Version: 0.25.4a4
|
|
4
4
|
Summary: The SDK for agenta is an open-source LLMOps platform.
|
|
5
5
|
Home-page: https://agenta.ai
|
|
6
6
|
Keywords: LLMOps,LLM,evaluation,prompt engineering
|
|
@@ -23,10 +23,6 @@ Requires-Dist: fastapi (>=0.100.0)
|
|
|
23
23
|
Requires-Dist: httpx (>=0.24,<0.28)
|
|
24
24
|
Requires-Dist: importlib-metadata (>=8.0.0,<9.0)
|
|
25
25
|
Requires-Dist: ipdb (>=0.13)
|
|
26
|
-
Requires-Dist: litellm (>=1.48.0,<2.0.0)
|
|
27
|
-
Requires-Dist: opentelemetry-api (>=1.27.0,<2.0.0)
|
|
28
|
-
Requires-Dist: opentelemetry-exporter-otlp (>=1.27.0,<2.0.0)
|
|
29
|
-
Requires-Dist: opentelemetry-sdk (>=1.27.0,<2.0.0)
|
|
30
26
|
Requires-Dist: posthog (>=3.1.0,<4.0.0)
|
|
31
27
|
Requires-Dist: pydantic (>=2)
|
|
32
28
|
Requires-Dist: pymongo (>=4.6.3,<5.0.0)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from .sdk.utils.preinit import PreInitObject
|
|
2
|
+
from .sdk.context import get_contexts, save_context
|
|
2
3
|
from .sdk.types import (
|
|
4
|
+
Context,
|
|
3
5
|
DictInput,
|
|
4
6
|
MultipleChoice,
|
|
5
7
|
FloatParam,
|
|
@@ -13,17 +15,16 @@ from .sdk.types import (
|
|
|
13
15
|
BinaryParam,
|
|
14
16
|
)
|
|
15
17
|
|
|
16
|
-
from .sdk.
|
|
17
|
-
from .sdk.tracing import Tracing
|
|
18
|
+
from .sdk.tracing.logger import llm_logger as logging
|
|
19
|
+
from .sdk.tracing.llm_tracing import Tracing
|
|
18
20
|
from .sdk.decorators.tracing import instrument
|
|
19
|
-
from .sdk.decorators.
|
|
21
|
+
from .sdk.decorators.llm_entrypoint import entrypoint, app, route
|
|
20
22
|
from .sdk.agenta_init import Config, AgentaSingleton, init
|
|
21
|
-
from .sdk.utils.
|
|
23
|
+
from .sdk.utils.helper.openai_cost import calculate_token_usage
|
|
22
24
|
from .sdk.client import Agenta
|
|
23
|
-
from .sdk.
|
|
25
|
+
from .sdk.tracing import callbacks
|
|
24
26
|
from .sdk.config_manager import ConfigManager
|
|
25
27
|
from .sdk import assets as assets
|
|
26
|
-
from .sdk import tracer
|
|
27
28
|
|
|
28
29
|
config = PreInitObject("agenta.config", Config)
|
|
29
30
|
DEFAULT_AGENTA_SINGLETON_INSTANCE = AgentaSingleton()
|
|
@@ -88,17 +88,13 @@ class AgentaApi:
|
|
|
88
88
|
self._client_wrapper = SyncClientWrapper(
|
|
89
89
|
base_url=base_url,
|
|
90
90
|
api_key=api_key,
|
|
91
|
-
httpx_client=
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if follow_redirects is not None
|
|
99
|
-
else httpx.Client(timeout=_defaulted_timeout)
|
|
100
|
-
)
|
|
101
|
-
),
|
|
91
|
+
httpx_client=httpx_client
|
|
92
|
+
if httpx_client is not None
|
|
93
|
+
else httpx.Client(
|
|
94
|
+
timeout=_defaulted_timeout, follow_redirects=follow_redirects
|
|
95
|
+
)
|
|
96
|
+
if follow_redirects is not None
|
|
97
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
|
102
98
|
timeout=_defaulted_timeout,
|
|
103
99
|
)
|
|
104
100
|
self.observability = ObservabilityClient(client_wrapper=self._client_wrapper)
|
|
@@ -1607,17 +1603,13 @@ class AsyncAgentaApi:
|
|
|
1607
1603
|
self._client_wrapper = AsyncClientWrapper(
|
|
1608
1604
|
base_url=base_url,
|
|
1609
1605
|
api_key=api_key,
|
|
1610
|
-
httpx_client=
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
if follow_redirects is not None
|
|
1618
|
-
else httpx.AsyncClient(timeout=_defaulted_timeout)
|
|
1619
|
-
)
|
|
1620
|
-
),
|
|
1606
|
+
httpx_client=httpx_client
|
|
1607
|
+
if httpx_client is not None
|
|
1608
|
+
else httpx.AsyncClient(
|
|
1609
|
+
timeout=_defaulted_timeout, follow_redirects=follow_redirects
|
|
1610
|
+
)
|
|
1611
|
+
if follow_redirects is not None
|
|
1612
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
|
1621
1613
|
timeout=_defaulted_timeout,
|
|
1622
1614
|
)
|
|
1623
1615
|
self.observability = AsyncObservabilityClient(
|
|
@@ -148,9 +148,9 @@ def get_request_body(
|
|
|
148
148
|
json_body = maybe_filter_request_body(json, request_options, omit)
|
|
149
149
|
|
|
150
150
|
# If you have an empty JSON body, you should just send None
|
|
151
|
-
return (
|
|
152
|
-
|
|
153
|
-
)
|
|
151
|
+
return (
|
|
152
|
+
json_body if json_body != {} else None
|
|
153
|
+
), data_body if data_body != {} else None
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
class HttpClient:
|
|
@@ -246,11 +246,9 @@ class HttpClient:
|
|
|
246
246
|
json=json_body,
|
|
247
247
|
data=data_body,
|
|
248
248
|
content=content,
|
|
249
|
-
files=(
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
else None
|
|
253
|
-
),
|
|
249
|
+
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
|
|
250
|
+
if files is not None
|
|
251
|
+
else None,
|
|
254
252
|
timeout=timeout,
|
|
255
253
|
)
|
|
256
254
|
|
|
@@ -347,11 +345,9 @@ class HttpClient:
|
|
|
347
345
|
json=json_body,
|
|
348
346
|
data=data_body,
|
|
349
347
|
content=content,
|
|
350
|
-
files=(
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
else None
|
|
354
|
-
),
|
|
348
|
+
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
|
|
349
|
+
if files is not None
|
|
350
|
+
else None,
|
|
355
351
|
timeout=timeout,
|
|
356
352
|
) as stream:
|
|
357
353
|
yield stream
|
|
@@ -451,11 +447,9 @@ class AsyncHttpClient:
|
|
|
451
447
|
json=json_body,
|
|
452
448
|
data=data_body,
|
|
453
449
|
content=content,
|
|
454
|
-
files=(
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
else None
|
|
458
|
-
),
|
|
450
|
+
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
|
|
451
|
+
if files is not None
|
|
452
|
+
else None,
|
|
459
453
|
timeout=timeout,
|
|
460
454
|
)
|
|
461
455
|
|
|
@@ -551,11 +545,9 @@ class AsyncHttpClient:
|
|
|
551
545
|
json=json_body,
|
|
552
546
|
data=data_body,
|
|
553
547
|
content=content,
|
|
554
|
-
files=(
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
else None
|
|
558
|
-
),
|
|
548
|
+
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
|
|
549
|
+
if files is not None
|
|
550
|
+
else None,
|
|
559
551
|
timeout=timeout,
|
|
560
552
|
) as stream:
|
|
561
553
|
yield stream
|
|
@@ -77,8 +77,6 @@ def to_jsonable_with_fallback(
|
|
|
77
77
|
class UniversalBaseModel(pydantic.BaseModel):
|
|
78
78
|
class Config:
|
|
79
79
|
populate_by_name = True
|
|
80
|
-
# smart_union = True
|
|
81
|
-
# allow_population_by_field_name = True
|
|
82
80
|
json_encoders = {dt.datetime: serialize_datetime}
|
|
83
81
|
|
|
84
82
|
def json(self, **kwargs: typing.Any) -> str:
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from .utils.preinit import PreInitObject # always the first import!
|
|
2
|
+
from .context import get_contexts, save_context
|
|
3
|
+
from .types import (
|
|
4
|
+
Context,
|
|
5
|
+
DictInput,
|
|
6
|
+
MultipleChoice,
|
|
7
|
+
FloatParam,
|
|
8
|
+
InFile,
|
|
9
|
+
IntParam,
|
|
10
|
+
MultipleChoiceParam,
|
|
11
|
+
GroupedMultipleChoiceParam,
|
|
12
|
+
TextParam,
|
|
13
|
+
MessagesInput,
|
|
14
|
+
FileInputURL,
|
|
15
|
+
BinaryParam,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
from .tracing.llm_tracing import Tracing
|
|
19
|
+
from .decorators.tracing import instrument
|
|
20
|
+
from .decorators.llm_entrypoint import entrypoint, app, route
|
|
21
|
+
from .agenta_init import Config, AgentaSingleton, init
|
|
22
|
+
from .utils.helper.openai_cost import calculate_token_usage
|
|
23
|
+
from .config_manager import ConfigManager
|
|
24
|
+
|
|
25
|
+
config = PreInitObject("agenta.config", Config)
|
|
26
|
+
DEFAULT_AGENTA_SINGLETON_INSTANCE = AgentaSingleton()
|
|
27
|
+
tracing = DEFAULT_AGENTA_SINGLETON_INSTANCE.tracing # type: ignore
|
|
@@ -2,12 +2,10 @@ import os
|
|
|
2
2
|
import logging
|
|
3
3
|
import toml
|
|
4
4
|
from typing import Optional
|
|
5
|
-
from importlib.metadata import version
|
|
6
5
|
|
|
7
|
-
from agenta.sdk.utils.logging import log
|
|
8
6
|
from agenta.sdk.utils.globals import set_global
|
|
9
7
|
from agenta.client.backend.client import AgentaApi
|
|
10
|
-
from agenta.sdk.tracing import Tracing
|
|
8
|
+
from agenta.sdk.tracing.llm_tracing import Tracing
|
|
11
9
|
from agenta.client.exceptions import APIRequestError
|
|
12
10
|
|
|
13
11
|
|
|
@@ -19,8 +17,9 @@ class AgentaSingleton:
|
|
|
19
17
|
"""Singleton class to save all the "global variables" for the sdk."""
|
|
20
18
|
|
|
21
19
|
_instance = None
|
|
20
|
+
setup = None
|
|
22
21
|
config = None
|
|
23
|
-
tracing = None
|
|
22
|
+
tracing: Optional[Tracing] = None
|
|
24
23
|
|
|
25
24
|
def __new__(cls):
|
|
26
25
|
if not cls._instance:
|
|
@@ -29,18 +28,11 @@ class AgentaSingleton:
|
|
|
29
28
|
|
|
30
29
|
def init(
|
|
31
30
|
self,
|
|
32
|
-
|
|
31
|
+
app_id: Optional[str] = None,
|
|
33
32
|
host: Optional[str] = None,
|
|
34
|
-
project_id: Optional[str] = None,
|
|
35
33
|
api_key: Optional[str] = None,
|
|
36
34
|
config_fname: Optional[str] = None,
|
|
37
|
-
#
|
|
38
|
-
app_id: Optional[str] = None,
|
|
39
35
|
) -> None:
|
|
40
|
-
log.info(f"\n--------------------------------")
|
|
41
|
-
log.info(f"Using Agenta Python SDK version: {version('agenta')}")
|
|
42
|
-
log.info(f"--------------------------------\n")
|
|
43
|
-
|
|
44
36
|
"""Main function to initialize the singleton.
|
|
45
37
|
|
|
46
38
|
Initializes the singleton with the given `app_id`, `host`, and `api_key`. The order of precedence for these variables is:
|
|
@@ -62,20 +54,20 @@ class AgentaSingleton:
|
|
|
62
54
|
Raises:
|
|
63
55
|
ValueError: If `app_id` is not specified either as an argument, in the config file, or in the environment variables.
|
|
64
56
|
"""
|
|
65
|
-
|
|
66
57
|
config = {}
|
|
67
58
|
if config_fname:
|
|
68
59
|
config = toml.load(config_fname)
|
|
69
60
|
|
|
61
|
+
self.app_id = app_id or config.get("app_id") or os.environ.get("AGENTA_APP_ID")
|
|
70
62
|
self.host = (
|
|
71
63
|
host
|
|
72
|
-
or os.environ.get("AGENTA_HOST")
|
|
73
64
|
or config.get("backend_host")
|
|
74
|
-
or
|
|
75
|
-
|
|
65
|
+
or os.environ.get("AGENTA_HOST", "https://cloud.agenta.ai")
|
|
66
|
+
)
|
|
67
|
+
self.api_key = (
|
|
68
|
+
api_key or config.get("api_key") or os.environ.get("AGENTA_API_KEY")
|
|
76
69
|
)
|
|
77
70
|
|
|
78
|
-
self.app_id = app_id or config.get("app_id") or os.environ.get("AGENTA_APP_ID")
|
|
79
71
|
if not self.app_id:
|
|
80
72
|
raise ValueError(
|
|
81
73
|
"App ID must be specified. You can provide it in one of the following ways:\n"
|
|
@@ -83,60 +75,26 @@ class AgentaSingleton:
|
|
|
83
75
|
"2. In the configuration file specified by config_fname.\n"
|
|
84
76
|
"3. As an environment variable 'AGENTA_APP_ID'."
|
|
85
77
|
)
|
|
86
|
-
|
|
87
|
-
self.project_id = (
|
|
88
|
-
project_id
|
|
89
|
-
or config.get("project_id")
|
|
90
|
-
or os.environ.get("AGENTA_PROJECT_ID")
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
self.api_key = (
|
|
94
|
-
api_key or config.get("api_key") or os.environ.get("AGENTA_API_KEY")
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
self.tracing = Tracing(
|
|
98
|
-
url=f"{self.host}/api/observability/v1/traces", # type: ignore
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
self.tracing.configure(
|
|
102
|
-
project_id=self.project_id,
|
|
103
|
-
api_key=self.api_key,
|
|
104
|
-
# DEPRECATED
|
|
105
|
-
app_id=self.app_id,
|
|
106
|
-
)
|
|
107
|
-
|
|
108
78
|
self.base_id = os.environ.get("AGENTA_BASE_ID")
|
|
79
|
+
if self.base_id is None:
|
|
80
|
+
print(
|
|
81
|
+
"Warning: Your configuration will not be saved permanently since base_id is not provided."
|
|
82
|
+
)
|
|
109
83
|
|
|
110
|
-
self.config = Config(
|
|
111
|
-
host=self.host,
|
|
112
|
-
base_id=self.base_id,
|
|
113
|
-
api_key=self.api_key,
|
|
114
|
-
)
|
|
84
|
+
self.config = Config(base_id=self.base_id, host=self.host, api_key=self.api_key) # type: ignore
|
|
115
85
|
|
|
116
86
|
|
|
117
87
|
class Config:
|
|
118
|
-
def __init__(
|
|
119
|
-
self,
|
|
120
|
-
host: str,
|
|
121
|
-
base_id: Optional[str] = None,
|
|
122
|
-
api_key: Optional[str] = "",
|
|
123
|
-
):
|
|
124
|
-
self.host = host
|
|
125
|
-
|
|
88
|
+
def __init__(self, base_id: str, host: str, api_key: Optional[str] = ""):
|
|
126
89
|
self.base_id = base_id
|
|
127
|
-
|
|
128
|
-
if self.base_id is None:
|
|
129
|
-
print(
|
|
130
|
-
"Warning: Your configuration will not be saved permanently since base_id is not provided.\n"
|
|
131
|
-
)
|
|
90
|
+
self.host = host
|
|
132
91
|
|
|
133
92
|
if base_id is None or host is None:
|
|
134
93
|
self.persist = False
|
|
135
94
|
else:
|
|
136
95
|
self.persist = True
|
|
137
96
|
self.client = AgentaApi(
|
|
138
|
-
base_url=self.host + "/api",
|
|
139
|
-
api_key=api_key if api_key else "",
|
|
97
|
+
base_url=self.host + "/api", api_key=api_key if api_key else ""
|
|
140
98
|
)
|
|
141
99
|
|
|
142
100
|
def register_default(self, overwrite=False, **kwargs):
|
|
@@ -250,12 +208,11 @@ class Config:
|
|
|
250
208
|
|
|
251
209
|
|
|
252
210
|
def init(
|
|
211
|
+
app_id: Optional[str] = None,
|
|
253
212
|
host: Optional[str] = None,
|
|
254
|
-
project_id: Optional[str] = None,
|
|
255
213
|
api_key: Optional[str] = None,
|
|
256
214
|
config_fname: Optional[str] = None,
|
|
257
|
-
|
|
258
|
-
app_id: Optional[str] = None,
|
|
215
|
+
max_workers: Optional[int] = None,
|
|
259
216
|
):
|
|
260
217
|
"""Main function to initialize the agenta sdk.
|
|
261
218
|
|
|
@@ -281,16 +238,12 @@ def init(
|
|
|
281
238
|
|
|
282
239
|
singleton = AgentaSingleton()
|
|
283
240
|
|
|
284
|
-
singleton.init(
|
|
285
|
-
host=host,
|
|
286
|
-
project_id=project_id,
|
|
287
|
-
api_key=api_key,
|
|
288
|
-
config_fname=config_fname,
|
|
289
|
-
# DEPRECATED
|
|
290
|
-
app_id=app_id,
|
|
291
|
-
)
|
|
241
|
+
singleton.init(app_id=app_id, host=host, api_key=api_key, config_fname=config_fname)
|
|
292
242
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
243
|
+
tracing = Tracing(
|
|
244
|
+
host=singleton.host, # type: ignore
|
|
245
|
+
app_id=singleton.app_id, # type: ignore
|
|
246
|
+
api_key=singleton.api_key,
|
|
247
|
+
max_workers=max_workers,
|
|
296
248
|
)
|
|
249
|
+
set_global(setup=singleton.setup, config=singleton.config, tracing=tracing)
|
|
@@ -7,7 +7,7 @@ import yaml
|
|
|
7
7
|
from pydantic import BaseModel, ValidationError
|
|
8
8
|
|
|
9
9
|
from agenta.client.backend.client import AgentaApi
|
|
10
|
-
from agenta.sdk.
|
|
10
|
+
from agenta.sdk.decorators.llm_entrypoint import route_context
|
|
11
11
|
|
|
12
12
|
from . import AgentaSingleton
|
|
13
13
|
|
|
@@ -47,7 +47,7 @@ class ConfigManager:
|
|
|
47
47
|
3. 'variant'
|
|
48
48
|
Only one of these should be provided.
|
|
49
49
|
"""
|
|
50
|
-
context =
|
|
50
|
+
context = route_context.get()
|
|
51
51
|
if ("config" in context and context["config"]) and (
|
|
52
52
|
("environment" in context and context["environment"])
|
|
53
53
|
or ("variant" in context and context["variant"])
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import sqlite3
|
|
3
|
+
from typing import List
|
|
4
|
+
from .types import Context
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def setup_db():
|
|
8
|
+
conn = sqlite3.connect("context.db")
|
|
9
|
+
c = conn.cursor()
|
|
10
|
+
c.execute(
|
|
11
|
+
"""
|
|
12
|
+
CREATE TABLE IF NOT EXISTS contexts
|
|
13
|
+
(id INTEGER PRIMARY KEY AUTOINCREMENT, context TEXT)
|
|
14
|
+
"""
|
|
15
|
+
)
|
|
16
|
+
conn.commit()
|
|
17
|
+
conn.close()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def get_contexts() -> List[Context]:
|
|
21
|
+
contexts = []
|
|
22
|
+
conn = sqlite3.connect("context.db")
|
|
23
|
+
c = conn.cursor()
|
|
24
|
+
for row in c.execute("SELECT * FROM contexts"):
|
|
25
|
+
context_data = json.loads(row[1])
|
|
26
|
+
contexts.append(Context.parse_obj(context_data))
|
|
27
|
+
conn.close()
|
|
28
|
+
return contexts
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def save_context(result: Context):
|
|
32
|
+
conn = sqlite3.connect("context.db")
|
|
33
|
+
c = conn.cursor()
|
|
34
|
+
c.execute(
|
|
35
|
+
"""
|
|
36
|
+
INSERT INTO contexts (context) VALUES (?)
|
|
37
|
+
""",
|
|
38
|
+
(json.dumps(result.dict()),),
|
|
39
|
+
)
|
|
40
|
+
conn.commit()
|
|
41
|
+
conn.close()
|