agenta 0.14.7a1__tar.gz → 0.14.8__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.14.7a1 → agenta-0.14.8}/PKG-INFO +1 -2
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/__init__.py +0 -1
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/cli/variant_commands.py +7 -7
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/__init__.py +0 -1
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/agenta_decorator.py +8 -22
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/tracing/llm_tracing.py +10 -37
- {agenta-0.14.7a1 → agenta-0.14.8}/pyproject.toml +1 -2
- agenta-0.14.7a1/agenta/sdk/tracing/callbacks.py +0 -129
- {agenta-0.14.7a1 → agenta-0.14.8}/README.md +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/cli/evaluation_commands.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/cli/helper.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/cli/main.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/cli/telemetry.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/cli/variant_configs.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/Readme.md +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/api.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/api_models.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/core/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/core/api_error.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/core/client_wrapper.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/core/datetime_utils.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/core/jsonable_encoder.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/core/remove_none_from_dict.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/errors/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/errors/unprocessable_entity_error.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/apps/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/apps/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/bases/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/bases/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/configs/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/configs/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/containers/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/containers/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/containers/types/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/containers/types/container_templates_response.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/environments/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/environments/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/evaluations/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/evaluations/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/evaluators/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/evaluators/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/observability/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/observability/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/testsets/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/testsets/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/variants/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/variants/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/variants/types/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/variants/types/add_variant_from_base_and_config_response.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/__init__.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/aggregated_result.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/aggregated_result_evaluator_config.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/app.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/app_variant_response.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/app_variant_revision.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/base_output.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/body_import_testset.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/config_db.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/create_app_output.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/create_span.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/create_trace_response.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/docker_env_vars.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/environment_output.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/environment_output_extended.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/environment_revision.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/error.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/evaluation.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/evaluation_scenario.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/evaluation_scenario_input.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/evaluation_scenario_output.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/evaluation_scenario_result.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/evaluation_scenario_score_update.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/evaluation_status_enum.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/evaluation_type.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/evaluation_webhook.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/evaluator.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/evaluator_config.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/feedback.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/get_config_response.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/http_validation_error.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/human_evaluation.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/human_evaluation_scenario.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/human_evaluation_scenario_input.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/human_evaluation_scenario_output.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/human_evaluation_scenario_update.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/human_evaluation_update.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/image.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/invite_request.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/list_api_keys_response.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/llm_run_rate_limit.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/llm_tokens.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/new_human_evaluation.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/new_testset.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/organization.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/organization_output.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/permission.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/result.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/score.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/simple_evaluation_output.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/span.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/span_detail.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/span_kind.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/span_status_code.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/span_variant.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/template.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/template_image_info.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/test_set_output_response.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/test_set_simple_response.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/trace_detail.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/uri.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/validation_error.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/validation_error_loc_item.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/variant_action.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/variant_action_enum.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/with_pagination.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/workspace_member_response.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/workspace_permission.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/workspace_response.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/workspace_role.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/workspace_role_response.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/exceptions.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/config.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/config.toml +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/docker/docker-assets/Dockerfile.cloud.template +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/docker/docker-assets/Dockerfile.template +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/docker/docker-assets/README.md +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/docker/docker-assets/entrypoint.sh +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/docker/docker-assets/lambda_function.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/docker/docker-assets/main.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/docker/docker_utils.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/agenta_init.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/client.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/context.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/router.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/tracing/context_manager.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/tracing/decorators.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/tracing/logger.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/tracing/tasks_manager.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/types.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/utils/globals.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/utils/helper/openai_cost.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/sdk/utils/preinit.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/compose_email/README.md +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/compose_email/app.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/compose_email/env.example +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/compose_email/requirements.txt +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/compose_email/template.toml +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/extract_data_to_json/README.md +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/extract_data_to_json/app.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/extract_data_to_json/env.example +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/extract_data_to_json/requirements.txt +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/extract_data_to_json/template.toml +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/simple_prompt/README.md +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/simple_prompt/app.py +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/simple_prompt/env.example +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/agenta/templates/simple_prompt/requirements.txt +0 -0
- {agenta-0.14.7a1 → agenta-0.14.8}/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.14.
|
|
3
|
+
Version: 0.14.8
|
|
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
|
|
@@ -22,7 +22,6 @@ Requires-Dist: fastapi (>=0.96.1)
|
|
|
22
22
|
Requires-Dist: httpx (>=0.24,<0.28)
|
|
23
23
|
Requires-Dist: importlib-metadata (>=6.7.0,<7.0.0)
|
|
24
24
|
Requires-Dist: ipdb (>=0.13)
|
|
25
|
-
Requires-Dist: litellm (>=1.35.33,<2.0.0)
|
|
26
25
|
Requires-Dist: posthog (>=3.1.0,<4.0.0)
|
|
27
26
|
Requires-Dist: pydantic (==1.10.13)
|
|
28
27
|
Requires-Dist: pymongo (>=4.6.3,<5.0.0)
|
|
@@ -16,7 +16,6 @@ from .sdk.types import (
|
|
|
16
16
|
)
|
|
17
17
|
from .sdk.tracing.decorators import span
|
|
18
18
|
from .sdk.agenta_init import Config, init, llm_tracing
|
|
19
|
-
from .sdk.tracing.callbacks import agenta_litellm_handler
|
|
20
19
|
from .sdk.utils.helper.openai_cost import calculate_token_usage
|
|
21
20
|
from .sdk.client import Agenta
|
|
22
21
|
|
|
@@ -104,12 +104,13 @@ def add_variant(
|
|
|
104
104
|
)
|
|
105
105
|
|
|
106
106
|
if variant_name in config["variants"] and not overwrite:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
if not overwrite:
|
|
108
|
+
overwrite = questionary.confirm(
|
|
109
|
+
"This variant already exists. Do you want to overwrite it?"
|
|
110
|
+
).ask()
|
|
111
|
+
if not overwrite:
|
|
112
|
+
click.echo("Operation cancelled.")
|
|
113
|
+
return
|
|
113
114
|
|
|
114
115
|
try:
|
|
115
116
|
click.echo(
|
|
@@ -445,7 +446,6 @@ def remove_variant_cli(variant_name: str, app_folder: str):
|
|
|
445
446
|
@click.option(
|
|
446
447
|
"--overwrite",
|
|
447
448
|
is_flag=True,
|
|
448
|
-
default=False,
|
|
449
449
|
help="Overwrite the existing variant if it exists",
|
|
450
450
|
)
|
|
451
451
|
@click.pass_context
|
|
@@ -17,7 +17,6 @@ from fastapi import Body, FastAPI, UploadFile, HTTPException
|
|
|
17
17
|
|
|
18
18
|
import agenta
|
|
19
19
|
from .context import save_context
|
|
20
|
-
from .tracing.llm_tracing import Tracing
|
|
21
20
|
from .router import router as router
|
|
22
21
|
from .types import (
|
|
23
22
|
Context,
|
|
@@ -156,7 +155,10 @@ def entrypoint(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
|
156
155
|
|
|
157
156
|
if is_main_script(func):
|
|
158
157
|
handle_terminal_run(
|
|
159
|
-
func,
|
|
158
|
+
func,
|
|
159
|
+
func_signature.parameters,
|
|
160
|
+
config_params,
|
|
161
|
+
ingestible_files,
|
|
160
162
|
)
|
|
161
163
|
return None
|
|
162
164
|
|
|
@@ -348,7 +350,6 @@ def handle_terminal_run(
|
|
|
348
350
|
func_params: Dict[str, Any],
|
|
349
351
|
config_params: Dict[str, Any],
|
|
350
352
|
ingestible_files: Dict,
|
|
351
|
-
tracing: Tracing,
|
|
352
353
|
) -> None:
|
|
353
354
|
"""
|
|
354
355
|
Parses command line arguments and sets configuration when script is run from the terminal.
|
|
@@ -356,8 +357,9 @@ def handle_terminal_run(
|
|
|
356
357
|
Args:
|
|
357
358
|
func_params (dict): A dictionary containing the function parameters and their annotations.
|
|
358
359
|
config_params (dict): A dictionary containing the configuration parameters.
|
|
359
|
-
|
|
360
|
-
|
|
360
|
+
|
|
361
|
+
Example:
|
|
362
|
+
handle_terminal_run(func_params=inspect.signature(my_function).parameters, config_params=config.all())
|
|
361
363
|
"""
|
|
362
364
|
|
|
363
365
|
# For required parameters, we add them as arguments
|
|
@@ -396,29 +398,13 @@ def handle_terminal_run(
|
|
|
396
398
|
)
|
|
397
399
|
agenta.config.set(**args_config_params)
|
|
398
400
|
|
|
399
|
-
# Start tracing
|
|
400
|
-
tracing.start_parent_span(
|
|
401
|
-
name=func.__name__,
|
|
402
|
-
inputs=args_func_params,
|
|
403
|
-
config=args_config_params,
|
|
404
|
-
environment="shell", # type: ignore
|
|
405
|
-
)
|
|
406
|
-
|
|
407
401
|
loop = asyncio.get_event_loop()
|
|
408
402
|
result = loop.run_until_complete(
|
|
409
403
|
execute_function(
|
|
410
404
|
func, **{"params": args_func_params, "config_params": args_config_params}
|
|
411
405
|
)
|
|
412
406
|
)
|
|
413
|
-
|
|
414
|
-
# End trace recording
|
|
415
|
-
tracing.end_recording(
|
|
416
|
-
outputs=result.dict(),
|
|
417
|
-
span=tracing.active_trace, # type: ignore
|
|
418
|
-
)
|
|
419
|
-
print(
|
|
420
|
-
f"\n========== Result ==========\n\nMessage: {result.message}\nCost: {result.cost}\nToken Usage: {result.usage}"
|
|
421
|
-
)
|
|
407
|
+
print(result)
|
|
422
408
|
|
|
423
409
|
|
|
424
410
|
def override_schema(openapi_schema: dict, func_name: str, endpoint: str, params: dict):
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# Stdlib Imports
|
|
2
|
-
from threading import Lock
|
|
3
2
|
from datetime import datetime, timezone
|
|
4
3
|
from typing import Optional, Dict, Any, List, Union
|
|
5
4
|
|
|
@@ -14,43 +13,10 @@ from agenta.client.backend.types.create_span import CreateSpan, SpanKind, SpanSt
|
|
|
14
13
|
from bson.objectid import ObjectId
|
|
15
14
|
|
|
16
15
|
|
|
17
|
-
class
|
|
18
|
-
"""
|
|
19
|
-
Thread-safe implementation of Singleton.
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
_instances = {}
|
|
23
|
-
|
|
24
|
-
# We need the lock mechanism to synchronize threads \
|
|
25
|
-
# during the initial access to the Singleton object.
|
|
26
|
-
_lock: Lock = Lock()
|
|
16
|
+
class Tracing(object):
|
|
17
|
+
"""Agenta llm tracing object.
|
|
27
18
|
|
|
28
|
-
|
|
29
|
-
"""
|
|
30
|
-
Possible changes to the value of the `__init__` argument do not affect
|
|
31
|
-
the returned instance.
|
|
32
|
-
"""
|
|
33
|
-
# Now, imagine that the program has just been launched. Since there's no
|
|
34
|
-
# Singleton instance yet, multiple threads can simultaneously pass the
|
|
35
|
-
# previous conditional and reach this point almost at the same time. The
|
|
36
|
-
# first of them will acquire lock and will proceed further, while the
|
|
37
|
-
# rest will wait here.
|
|
38
|
-
with cls._lock:
|
|
39
|
-
# The first thread to acquire the lock, reaches this conditional,
|
|
40
|
-
# goes inside and creates the Singleton instance. Once it leaves the
|
|
41
|
-
# lock block, a thread that might have been waiting for the lock
|
|
42
|
-
# release may then enter this section. But since the Singleton field
|
|
43
|
-
# is already initialized, the thread won't create a new object.
|
|
44
|
-
if cls not in cls._instances:
|
|
45
|
-
instance = super().__call__(*args, **kwargs)
|
|
46
|
-
cls._instances[cls] = instance
|
|
47
|
-
return cls._instances[cls]
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
class Tracing(metaclass=SingletonMeta):
|
|
51
|
-
"""The `Tracing` class is an agent for LLM tracing with specific initialization arguments.
|
|
52
|
-
|
|
53
|
-
__init__ args:
|
|
19
|
+
Args:
|
|
54
20
|
base_url (str): The URL of the backend host
|
|
55
21
|
api_key (str): The API Key of the backend host
|
|
56
22
|
tasks_manager (TaskQueue): The tasks manager dedicated to handling asynchronous tasks
|
|
@@ -58,6 +24,13 @@ class Tracing(metaclass=SingletonMeta):
|
|
|
58
24
|
max_workers (int): The maximum number of workers to run tracing
|
|
59
25
|
"""
|
|
60
26
|
|
|
27
|
+
_instance = None
|
|
28
|
+
|
|
29
|
+
def __new__(cls, *args, **kwargs):
|
|
30
|
+
if not cls._instance:
|
|
31
|
+
cls._instance = super().__new__(cls)
|
|
32
|
+
return cls._instance
|
|
33
|
+
|
|
61
34
|
def __init__(
|
|
62
35
|
self,
|
|
63
36
|
base_url: str,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "agenta"
|
|
3
|
-
version = "0.14.
|
|
3
|
+
version = "0.14.8"
|
|
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>"]
|
|
@@ -30,7 +30,6 @@ posthog = "^3.1.0"
|
|
|
30
30
|
pydantic = "1.10.13"
|
|
31
31
|
httpx = ">=0.24, <0.28"
|
|
32
32
|
pymongo = "^4.6.3"
|
|
33
|
-
litellm = "^1.35.33"
|
|
34
33
|
cachetools = "^5.3.3"
|
|
35
34
|
|
|
36
35
|
[tool.poetry.dev-dependencies]
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
# Own Imports
|
|
2
|
-
from agenta.sdk import llm_tracing
|
|
3
|
-
|
|
4
|
-
# Third Party Imports
|
|
5
|
-
from litellm.utils import ModelResponse
|
|
6
|
-
from litellm.integrations.custom_logger import CustomLogger as LitellmCustomLogger
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class AgentaLiteLLMHandler(LitellmCustomLogger):
|
|
10
|
-
"""This handler is responsible for logging certain events when using litellm to call LLMs.
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
LitellmCustomLogger (object): custom logger that allows us to override the events to capture.
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
@property
|
|
17
|
-
def _trace(self):
|
|
18
|
-
return llm_tracing()
|
|
19
|
-
|
|
20
|
-
def log_pre_api_call(self, model, messages, kwargs):
|
|
21
|
-
self._trace.start_span(
|
|
22
|
-
name="pre_api_call",
|
|
23
|
-
input=(
|
|
24
|
-
{"messages": messages}
|
|
25
|
-
if isinstance(messages, list)
|
|
26
|
-
else {"inputs": messages}
|
|
27
|
-
),
|
|
28
|
-
spankind=(
|
|
29
|
-
"llm"
|
|
30
|
-
if kwargs.get("call_type") in ["completion", "acompletion"]
|
|
31
|
-
else (
|
|
32
|
-
"embedding"
|
|
33
|
-
if kwargs.get("call_type") in ["embedding", "aembedding"]
|
|
34
|
-
else "unset"
|
|
35
|
-
)
|
|
36
|
-
),
|
|
37
|
-
)
|
|
38
|
-
self._trace.set_span_attribute(
|
|
39
|
-
"model_config",
|
|
40
|
-
{
|
|
41
|
-
"model": kwargs.get("model"),
|
|
42
|
-
"temperature": kwargs["optional_params"]["temperature"],
|
|
43
|
-
},
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
def log_stream_event(self, kwargs, response_obj, start_time, end_time):
|
|
47
|
-
self._trace.update_span_status(span=self._trace.active_span, value="OK")
|
|
48
|
-
self._trace.end_span(
|
|
49
|
-
outputs={
|
|
50
|
-
"message": kwargs("complete_streaming_response"),
|
|
51
|
-
"usage": kwargs.get("usage"),
|
|
52
|
-
"cost": kwargs.get("response_cost"),
|
|
53
|
-
},
|
|
54
|
-
span=self._trace.active_span,
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
def log_success_event(
|
|
58
|
-
self, kwargs, response_obj: ModelResponse, start_time, end_time
|
|
59
|
-
):
|
|
60
|
-
self._trace.update_span_status(span=self._trace.active_span, value="OK")
|
|
61
|
-
self._trace.end_span(
|
|
62
|
-
outputs={
|
|
63
|
-
"message": kwargs["message"],
|
|
64
|
-
"usage": kwargs.get("usage"),
|
|
65
|
-
"cost": kwargs.get("response_cost"),
|
|
66
|
-
},
|
|
67
|
-
span=self._trace.active_span,
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
def log_failure_event(
|
|
71
|
-
self, kwargs, response_obj: ModelResponse, start_time, end_time
|
|
72
|
-
):
|
|
73
|
-
self._trace.update_span_status(span=self._trace.active_span, value="ERROR")
|
|
74
|
-
self._trace.set_span_attribute(
|
|
75
|
-
attributes={
|
|
76
|
-
"traceback_exception": kwargs["traceback_exception"],
|
|
77
|
-
"call_end_time": kwargs["end_time"],
|
|
78
|
-
},
|
|
79
|
-
)
|
|
80
|
-
self._trace.end_span(
|
|
81
|
-
outputs={
|
|
82
|
-
"message": kwargs["exception"],
|
|
83
|
-
"usage": kwargs.get("usage"),
|
|
84
|
-
"cost": kwargs.get("response_cost"),
|
|
85
|
-
},
|
|
86
|
-
span=self._trace.active_span,
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
async def async_log_stream_event(self, kwargs, response_obj, start_time, end_time):
|
|
90
|
-
self._trace.update_span_status(span=self._trace.active_span, value="OK")
|
|
91
|
-
self._trace.end_span(
|
|
92
|
-
outputs={
|
|
93
|
-
"message": kwargs("complete_streaming_response"),
|
|
94
|
-
"usage": kwargs.get("usage"),
|
|
95
|
-
"cost": kwargs.get("response_cost"),
|
|
96
|
-
},
|
|
97
|
-
span=self._trace.active_span,
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):
|
|
101
|
-
self._trace.update_span_status(span=self._trace.active_span, value="OK")
|
|
102
|
-
self._trace.end_span(
|
|
103
|
-
outputs={
|
|
104
|
-
"message": kwargs["message"],
|
|
105
|
-
"usage": kwargs.get("usage"),
|
|
106
|
-
"cost": kwargs.get("response_cost"),
|
|
107
|
-
},
|
|
108
|
-
span=self._trace.active_span,
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
async def async_log_failure_event(self, kwargs, response_obj, start_time, end_time):
|
|
112
|
-
self._trace.update_span_status(span=self._trace.active_span, value="ERROR")
|
|
113
|
-
self._trace.set_span_attribute(
|
|
114
|
-
attributes={
|
|
115
|
-
"traceback_exception": kwargs["traceback_exception"],
|
|
116
|
-
"call_end_time": kwargs["end_time"],
|
|
117
|
-
},
|
|
118
|
-
)
|
|
119
|
-
self._trace.end_span(
|
|
120
|
-
outputs={
|
|
121
|
-
"message": kwargs["exception"],
|
|
122
|
-
"usage": kwargs.get("usage"),
|
|
123
|
-
"cost": kwargs.get("response_cost"),
|
|
124
|
-
},
|
|
125
|
-
span=self._trace.active_span,
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
agenta_litellm_handler = AgentaLiteLLMHandler()
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/errors/unprocessable_entity_error.py
RENAMED
|
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
|
{agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/containers/types/__init__.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
{agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/resources/variants/types/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/aggregated_result_evaluator_config.py
RENAMED
|
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
|
{agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/environment_output_extended.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/evaluation_scenario_score_update.py
RENAMED
|
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
|
{agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/human_evaluation_scenario_input.py
RENAMED
|
File without changes
|
{agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/human_evaluation_scenario_output.py
RENAMED
|
File without changes
|
{agenta-0.14.7a1 → agenta-0.14.8}/agenta/client/backend/types/human_evaluation_scenario_update.py
RENAMED
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|