agenta 0.52.6__py3-none-any.whl → 0.63.2__py3-none-any.whl
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.
- agenta/__init__.py +12 -3
- agenta/client/__init__.py +4 -4
- agenta/client/backend/__init__.py +4 -4
- agenta/client/backend/api_keys/client.py +2 -2
- agenta/client/backend/billing/client.py +2 -2
- agenta/client/backend/billing/raw_client.py +2 -2
- agenta/client/backend/client.py +56 -48
- agenta/client/backend/core/client_wrapper.py +2 -2
- agenta/client/backend/core/file.py +3 -1
- agenta/client/backend/core/http_client.py +3 -3
- agenta/client/backend/core/pydantic_utilities.py +13 -3
- agenta/client/backend/human_evaluations/client.py +2 -2
- agenta/client/backend/human_evaluations/raw_client.py +2 -2
- agenta/client/backend/organization/client.py +46 -34
- agenta/client/backend/organization/raw_client.py +32 -26
- agenta/client/backend/raw_client.py +26 -26
- agenta/client/backend/testsets/client.py +18 -18
- agenta/client/backend/testsets/raw_client.py +30 -30
- agenta/client/backend/types/__init__.py +4 -4
- agenta/client/backend/types/account_request.py +3 -1
- agenta/client/backend/types/account_response.py +3 -1
- agenta/client/backend/types/agenta_node_dto.py +3 -1
- agenta/client/backend/types/agenta_nodes_response.py +3 -1
- agenta/client/backend/types/agenta_root_dto.py +3 -1
- agenta/client/backend/types/agenta_roots_response.py +3 -1
- agenta/client/backend/types/agenta_tree_dto.py +3 -1
- agenta/client/backend/types/agenta_trees_response.py +3 -1
- agenta/client/backend/types/aggregated_result.py +3 -1
- agenta/client/backend/types/analytics_response.py +3 -1
- agenta/client/backend/types/annotation.py +6 -4
- agenta/client/backend/types/annotation_create.py +3 -1
- agenta/client/backend/types/annotation_edit.py +3 -1
- agenta/client/backend/types/annotation_link.py +3 -1
- agenta/client/backend/types/annotation_link_response.py +3 -1
- agenta/client/backend/types/annotation_query.py +3 -1
- agenta/client/backend/types/annotation_query_request.py +3 -1
- agenta/client/backend/types/annotation_reference.py +3 -1
- agenta/client/backend/types/annotation_references.py +3 -1
- agenta/client/backend/types/annotation_response.py +3 -1
- agenta/client/backend/types/annotations_response.py +3 -1
- agenta/client/backend/types/app.py +3 -1
- agenta/client/backend/types/app_variant_response.py +3 -1
- agenta/client/backend/types/app_variant_revision.py +3 -1
- agenta/client/backend/types/artifact.py +6 -4
- agenta/client/backend/types/base_output.py +3 -1
- agenta/client/backend/types/body_fetch_workflow_revision.py +3 -1
- agenta/client/backend/types/body_import_testset.py +3 -1
- agenta/client/backend/types/bucket_dto.py +3 -1
- agenta/client/backend/types/collect_status_response.py +3 -1
- agenta/client/backend/types/config_db.py +3 -1
- agenta/client/backend/types/config_dto.py +3 -1
- agenta/client/backend/types/config_response_model.py +3 -1
- agenta/client/backend/types/correct_answer.py +3 -1
- agenta/client/backend/types/create_app_output.py +3 -1
- agenta/client/backend/types/custom_model_settings_dto.py +3 -1
- agenta/client/backend/types/custom_provider_dto.py +3 -1
- agenta/client/backend/types/custom_provider_kind.py +1 -1
- agenta/client/backend/types/custom_provider_settings_dto.py +3 -1
- agenta/client/backend/types/delete_evaluation.py +3 -1
- agenta/client/backend/types/environment_output.py +3 -1
- agenta/client/backend/types/environment_output_extended.py +3 -1
- agenta/client/backend/types/environment_revision.py +3 -1
- agenta/client/backend/types/error.py +3 -1
- agenta/client/backend/types/evaluation.py +3 -1
- agenta/client/backend/types/evaluation_scenario.py +3 -1
- agenta/client/backend/types/evaluation_scenario_input.py +3 -1
- agenta/client/backend/types/evaluation_scenario_output.py +3 -1
- agenta/client/backend/types/evaluation_scenario_result.py +3 -1
- agenta/client/backend/types/evaluator.py +6 -4
- agenta/client/backend/types/evaluator_config.py +6 -4
- agenta/client/backend/types/evaluator_flags.py +3 -1
- agenta/client/backend/types/evaluator_mapping_output_interface.py +3 -1
- agenta/client/backend/types/evaluator_output_interface.py +3 -1
- agenta/client/backend/types/evaluator_query.py +3 -1
- agenta/client/backend/types/evaluator_query_request.py +3 -1
- agenta/client/backend/types/evaluator_request.py +3 -1
- agenta/client/backend/types/evaluator_response.py +3 -1
- agenta/client/backend/types/evaluators_response.py +3 -1
- agenta/client/backend/types/exception_dto.py +3 -1
- agenta/client/backend/types/extended_o_tel_tracing_response.py +3 -1
- agenta/client/backend/types/get_config_response.py +3 -1
- agenta/client/backend/types/header.py +3 -1
- agenta/client/backend/types/http_validation_error.py +3 -1
- agenta/client/backend/types/human_evaluation.py +3 -1
- agenta/client/backend/types/human_evaluation_scenario.py +3 -1
- agenta/client/backend/types/human_evaluation_scenario_input.py +3 -1
- agenta/client/backend/types/human_evaluation_scenario_output.py +3 -1
- agenta/client/backend/types/invite_request.py +3 -1
- agenta/client/backend/types/legacy_analytics_response.py +3 -1
- agenta/client/backend/types/legacy_data_point.py +3 -1
- agenta/client/backend/types/legacy_evaluator.py +3 -1
- agenta/client/backend/types/legacy_scope_request.py +3 -1
- agenta/client/backend/types/legacy_scopes_response.py +3 -1
- agenta/client/backend/types/legacy_subscription_request.py +3 -1
- agenta/client/backend/types/legacy_user_request.py +3 -1
- agenta/client/backend/types/legacy_user_response.py +3 -1
- agenta/client/backend/types/lifecycle_dto.py +3 -1
- agenta/client/backend/types/link_dto.py +3 -1
- agenta/client/backend/types/list_api_keys_response.py +3 -1
- agenta/client/backend/types/llm_run_rate_limit.py +3 -1
- agenta/client/backend/types/meta_request.py +3 -1
- agenta/client/backend/types/metrics_dto.py +3 -1
- agenta/client/backend/types/new_testset.py +3 -1
- agenta/client/backend/types/node_dto.py +3 -1
- agenta/client/backend/types/o_tel_context_dto.py +3 -1
- agenta/client/backend/types/o_tel_event.py +6 -4
- agenta/client/backend/types/o_tel_event_dto.py +3 -1
- agenta/client/backend/types/o_tel_extra_dto.py +3 -1
- agenta/client/backend/types/o_tel_flat_span.py +6 -4
- agenta/client/backend/types/o_tel_link.py +6 -4
- agenta/client/backend/types/o_tel_link_dto.py +3 -1
- agenta/client/backend/types/o_tel_links_response.py +3 -1
- agenta/client/backend/types/o_tel_span.py +1 -1
- agenta/client/backend/types/o_tel_span_dto.py +3 -1
- agenta/client/backend/types/o_tel_spans_tree.py +3 -1
- agenta/client/backend/types/o_tel_tracing_data_response.py +3 -1
- agenta/client/backend/types/o_tel_tracing_request.py +3 -1
- agenta/client/backend/types/o_tel_tracing_response.py +3 -1
- agenta/client/backend/types/organization.py +3 -1
- agenta/client/backend/types/organization_details.py +3 -1
- agenta/client/backend/types/organization_membership_request.py +3 -1
- agenta/client/backend/types/organization_output.py +3 -1
- agenta/client/backend/types/organization_request.py +3 -1
- agenta/client/backend/types/parent_dto.py +3 -1
- agenta/client/backend/types/project_membership_request.py +3 -1
- agenta/client/backend/types/project_request.py +3 -1
- agenta/client/backend/types/project_scope.py +3 -1
- agenta/client/backend/types/projects_response.py +3 -1
- agenta/client/backend/types/reference.py +6 -4
- agenta/client/backend/types/reference_dto.py +3 -1
- agenta/client/backend/types/reference_request_model.py +3 -1
- agenta/client/backend/types/result.py +3 -1
- agenta/client/backend/types/root_dto.py +3 -1
- agenta/client/backend/types/scopes_response_model.py +3 -1
- agenta/client/backend/types/secret_dto.py +3 -1
- agenta/client/backend/types/secret_response_dto.py +3 -1
- agenta/client/backend/types/simple_evaluation_output.py +3 -1
- agenta/client/backend/types/span_dto.py +6 -4
- agenta/client/backend/types/standard_provider_dto.py +3 -1
- agenta/client/backend/types/standard_provider_settings_dto.py +3 -1
- agenta/client/backend/types/status_dto.py +3 -1
- agenta/client/backend/types/tags_request.py +3 -1
- agenta/client/backend/types/testcase_response.py +6 -4
- agenta/client/backend/types/testset.py +6 -4
- agenta/client/backend/types/{test_set_output_response.py → testset_output_response.py} +4 -2
- agenta/client/backend/types/testset_request.py +3 -1
- agenta/client/backend/types/testset_response.py +3 -1
- agenta/client/backend/types/{test_set_simple_response.py → testset_simple_response.py} +4 -2
- agenta/client/backend/types/testsets_response.py +3 -1
- agenta/client/backend/types/time_dto.py +3 -1
- agenta/client/backend/types/tree_dto.py +3 -1
- agenta/client/backend/types/update_app_output.py +3 -1
- agenta/client/backend/types/user_request.py +3 -1
- agenta/client/backend/types/validation_error.py +3 -1
- agenta/client/backend/types/workflow_artifact.py +6 -4
- agenta/client/backend/types/workflow_data.py +3 -1
- agenta/client/backend/types/workflow_flags.py +3 -1
- agenta/client/backend/types/workflow_request.py +3 -1
- agenta/client/backend/types/workflow_response.py +3 -1
- agenta/client/backend/types/workflow_revision.py +6 -4
- agenta/client/backend/types/workflow_revision_request.py +3 -1
- agenta/client/backend/types/workflow_revision_response.py +3 -1
- agenta/client/backend/types/workflow_revisions_response.py +3 -1
- agenta/client/backend/types/workflow_variant.py +6 -4
- agenta/client/backend/types/workflow_variant_request.py +3 -1
- agenta/client/backend/types/workflow_variant_response.py +3 -1
- agenta/client/backend/types/workflow_variants_response.py +3 -1
- agenta/client/backend/types/workflows_response.py +3 -1
- agenta/client/backend/types/workspace.py +3 -1
- agenta/client/backend/types/workspace_member_response.py +3 -1
- agenta/client/backend/types/workspace_membership_request.py +3 -1
- agenta/client/backend/types/workspace_permission.py +3 -1
- agenta/client/backend/types/workspace_request.py +3 -1
- agenta/client/backend/types/workspace_response.py +3 -1
- agenta/client/backend/vault/raw_client.py +4 -4
- agenta/client/backend/workspace/client.py +2 -2
- agenta/client/client.py +102 -88
- agenta/sdk/__init__.py +52 -3
- agenta/sdk/agenta_init.py +43 -16
- agenta/sdk/assets.py +23 -15
- agenta/sdk/context/serving.py +20 -8
- agenta/sdk/context/tracing.py +40 -22
- agenta/sdk/contexts/__init__.py +0 -0
- agenta/sdk/contexts/routing.py +38 -0
- agenta/sdk/contexts/running.py +57 -0
- agenta/sdk/contexts/tracing.py +86 -0
- agenta/sdk/decorators/__init__.py +1 -0
- agenta/sdk/decorators/routing.py +284 -0
- agenta/sdk/decorators/running.py +692 -98
- agenta/sdk/decorators/serving.py +20 -21
- agenta/sdk/decorators/tracing.py +176 -131
- agenta/sdk/engines/__init__.py +0 -0
- agenta/sdk/engines/running/__init__.py +0 -0
- agenta/sdk/engines/running/utils.py +17 -0
- agenta/sdk/engines/tracing/__init__.py +1 -0
- agenta/sdk/engines/tracing/attributes.py +185 -0
- agenta/sdk/engines/tracing/conventions.py +49 -0
- agenta/sdk/engines/tracing/exporters.py +130 -0
- agenta/sdk/engines/tracing/inline.py +1154 -0
- agenta/sdk/engines/tracing/processors.py +190 -0
- agenta/sdk/engines/tracing/propagation.py +102 -0
- agenta/sdk/engines/tracing/spans.py +136 -0
- agenta/sdk/engines/tracing/tracing.py +324 -0
- agenta/sdk/evaluations/__init__.py +2 -0
- agenta/sdk/evaluations/metrics.py +37 -0
- agenta/sdk/evaluations/preview/__init__.py +0 -0
- agenta/sdk/evaluations/preview/evaluate.py +765 -0
- agenta/sdk/evaluations/preview/utils.py +861 -0
- agenta/sdk/evaluations/results.py +66 -0
- agenta/sdk/evaluations/runs.py +153 -0
- agenta/sdk/evaluations/scenarios.py +48 -0
- agenta/sdk/litellm/litellm.py +12 -0
- agenta/sdk/litellm/mockllm.py +6 -8
- agenta/sdk/litellm/mocks/__init__.py +5 -5
- agenta/sdk/managers/applications.py +304 -0
- agenta/sdk/managers/config.py +2 -2
- agenta/sdk/managers/evaluations.py +0 -0
- agenta/sdk/managers/evaluators.py +303 -0
- agenta/sdk/managers/secrets.py +161 -24
- agenta/sdk/managers/shared.py +3 -1
- agenta/sdk/managers/testsets.py +441 -0
- agenta/sdk/managers/vault.py +3 -3
- agenta/sdk/middleware/auth.py +0 -176
- agenta/sdk/middleware/config.py +27 -9
- agenta/sdk/middleware/vault.py +204 -9
- agenta/sdk/middlewares/__init__.py +0 -0
- agenta/sdk/middlewares/routing/__init__.py +0 -0
- agenta/sdk/middlewares/routing/auth.py +263 -0
- agenta/sdk/middlewares/routing/cors.py +30 -0
- agenta/sdk/middlewares/routing/otel.py +29 -0
- agenta/sdk/middlewares/running/__init__.py +0 -0
- agenta/sdk/middlewares/running/normalizer.py +321 -0
- agenta/sdk/middlewares/running/resolver.py +161 -0
- agenta/sdk/middlewares/running/vault.py +140 -0
- agenta/sdk/models/__init__.py +0 -0
- agenta/sdk/models/blobs.py +33 -0
- agenta/sdk/models/evaluations.py +119 -0
- agenta/sdk/models/git.py +126 -0
- agenta/sdk/models/shared.py +167 -0
- agenta/sdk/models/testsets.py +163 -0
- agenta/sdk/models/tracing.py +202 -0
- agenta/sdk/models/workflows.py +753 -0
- agenta/sdk/tracing/attributes.py +4 -4
- agenta/sdk/tracing/exporters.py +67 -17
- agenta/sdk/tracing/inline.py +37 -45
- agenta/sdk/tracing/processors.py +97 -0
- agenta/sdk/tracing/propagation.py +3 -1
- agenta/sdk/tracing/spans.py +4 -0
- agenta/sdk/tracing/tracing.py +13 -15
- agenta/sdk/types.py +222 -22
- agenta/sdk/utils/cache.py +1 -1
- agenta/sdk/utils/client.py +38 -0
- agenta/sdk/utils/helpers.py +13 -12
- agenta/sdk/utils/logging.py +18 -78
- agenta/sdk/utils/references.py +23 -0
- agenta/sdk/workflows/builtin.py +600 -0
- agenta/sdk/workflows/configurations.py +22 -0
- agenta/sdk/workflows/errors.py +292 -0
- agenta/sdk/workflows/handlers.py +1791 -0
- agenta/sdk/workflows/interfaces.py +948 -0
- agenta/sdk/workflows/sandbox.py +118 -0
- agenta/sdk/workflows/utils.py +303 -6
- {agenta-0.52.6.dist-info → agenta-0.63.2.dist-info}/METADATA +37 -33
- agenta-0.63.2.dist-info/RECORD +421 -0
- {agenta-0.52.6.dist-info → agenta-0.63.2.dist-info}/WHEEL +1 -1
- agenta/sdk/middleware/adapt.py +0 -253
- agenta/sdk/middleware/base.py +0 -40
- agenta/sdk/middleware/flags.py +0 -40
- agenta/sdk/workflows/types.py +0 -472
- agenta-0.52.6.dist-info/RECORD +0 -371
- /agenta/sdk/{workflows → engines/running}/registry.py +0 -0
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
from typing import Optional, Union, Dict
|
|
2
|
+
|
|
3
|
+
from agenta.sdk.models.workflows import Reference
|
|
4
|
+
from agenta.sdk.decorators.running import workflow, Workflow, application, evaluator
|
|
5
|
+
from agenta.sdk.workflows.handlers import SinglePromptConfig
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def echo(
|
|
9
|
+
*,
|
|
10
|
+
slug: Optional[str] = None,
|
|
11
|
+
#
|
|
12
|
+
name: Optional[str] = None,
|
|
13
|
+
description: Optional[str] = None,
|
|
14
|
+
#
|
|
15
|
+
variant_slug: Optional[str] = None,
|
|
16
|
+
) -> Workflow:
|
|
17
|
+
return workflow(
|
|
18
|
+
slug=slug,
|
|
19
|
+
#
|
|
20
|
+
name=name,
|
|
21
|
+
description=description,
|
|
22
|
+
#
|
|
23
|
+
variant_slug=variant_slug,
|
|
24
|
+
#
|
|
25
|
+
uri="echo",
|
|
26
|
+
)()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def auto_exact_match(
|
|
30
|
+
*,
|
|
31
|
+
slug: Optional[str] = None,
|
|
32
|
+
#
|
|
33
|
+
name: Optional[str] = None,
|
|
34
|
+
description: Optional[str] = None,
|
|
35
|
+
#
|
|
36
|
+
variant_slug: Optional[str] = None,
|
|
37
|
+
#
|
|
38
|
+
correct_answer_key: Optional[str] = "correct_answer",
|
|
39
|
+
) -> Workflow:
|
|
40
|
+
parameters = dict(
|
|
41
|
+
correct_answer_key=correct_answer_key,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
return evaluator(
|
|
45
|
+
slug=slug,
|
|
46
|
+
#
|
|
47
|
+
name=name,
|
|
48
|
+
description=description,
|
|
49
|
+
#
|
|
50
|
+
variant_slug=variant_slug,
|
|
51
|
+
#
|
|
52
|
+
uri="auto_exact_match",
|
|
53
|
+
#
|
|
54
|
+
parameters=parameters,
|
|
55
|
+
)()
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def auto_regex_test(
|
|
59
|
+
*,
|
|
60
|
+
slug: Optional[str] = None,
|
|
61
|
+
#
|
|
62
|
+
name: Optional[str] = None,
|
|
63
|
+
description: Optional[str] = None,
|
|
64
|
+
#
|
|
65
|
+
variant_slug: Optional[str] = None,
|
|
66
|
+
#
|
|
67
|
+
regex_pattern: str,
|
|
68
|
+
#
|
|
69
|
+
regex_should_match: Optional[bool] = True,
|
|
70
|
+
case_sensitive: Optional[bool] = True,
|
|
71
|
+
) -> Workflow:
|
|
72
|
+
parameters = dict(
|
|
73
|
+
regex_pattern=regex_pattern,
|
|
74
|
+
regex_should_match=regex_should_match,
|
|
75
|
+
case_sensitive=case_sensitive,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return evaluator(
|
|
79
|
+
slug=slug,
|
|
80
|
+
#
|
|
81
|
+
name=name,
|
|
82
|
+
description=description,
|
|
83
|
+
#
|
|
84
|
+
variant_slug=variant_slug,
|
|
85
|
+
#
|
|
86
|
+
uri="auto_regex_test",
|
|
87
|
+
#
|
|
88
|
+
parameters=parameters,
|
|
89
|
+
)()
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def field_match_test(
|
|
93
|
+
*,
|
|
94
|
+
slug: Optional[str] = None,
|
|
95
|
+
#
|
|
96
|
+
name: Optional[str] = None,
|
|
97
|
+
description: Optional[str] = None,
|
|
98
|
+
#
|
|
99
|
+
variant_slug: Optional[str] = None,
|
|
100
|
+
#
|
|
101
|
+
json_field: str,
|
|
102
|
+
#
|
|
103
|
+
correct_answer_key: Optional[str] = "correct_answer",
|
|
104
|
+
) -> Workflow:
|
|
105
|
+
parameters = dict(
|
|
106
|
+
json_field=json_field,
|
|
107
|
+
correct_answer_key=correct_answer_key,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return evaluator(
|
|
111
|
+
slug=slug,
|
|
112
|
+
#
|
|
113
|
+
name=name,
|
|
114
|
+
description=description,
|
|
115
|
+
#
|
|
116
|
+
variant_slug=variant_slug,
|
|
117
|
+
#
|
|
118
|
+
uri="field_match_test",
|
|
119
|
+
#
|
|
120
|
+
parameters=parameters,
|
|
121
|
+
)()
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def auto_webhook_test(
|
|
125
|
+
*,
|
|
126
|
+
slug: Optional[str] = None,
|
|
127
|
+
#
|
|
128
|
+
name: Optional[str] = None,
|
|
129
|
+
description: Optional[str] = None,
|
|
130
|
+
#
|
|
131
|
+
variant_slug: Optional[str] = None,
|
|
132
|
+
#
|
|
133
|
+
webhook_url: str,
|
|
134
|
+
#
|
|
135
|
+
correct_answer_key: Optional[str] = "correct_answer",
|
|
136
|
+
) -> Workflow:
|
|
137
|
+
parameters = dict(
|
|
138
|
+
webhook_url=webhook_url,
|
|
139
|
+
correct_answer_key=correct_answer_key,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
return evaluator(
|
|
143
|
+
slug=slug,
|
|
144
|
+
#
|
|
145
|
+
name=name,
|
|
146
|
+
description=description,
|
|
147
|
+
#
|
|
148
|
+
variant_slug=variant_slug,
|
|
149
|
+
#
|
|
150
|
+
uri="auto_webhook_test",
|
|
151
|
+
#
|
|
152
|
+
parameters=parameters,
|
|
153
|
+
)()
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def auto_custom_code_run(
|
|
157
|
+
*,
|
|
158
|
+
slug: Optional[str] = None,
|
|
159
|
+
#
|
|
160
|
+
name: Optional[str] = None,
|
|
161
|
+
description: Optional[str] = None,
|
|
162
|
+
#
|
|
163
|
+
variant_slug: Optional[str] = None,
|
|
164
|
+
#
|
|
165
|
+
code: str,
|
|
166
|
+
#
|
|
167
|
+
correct_answer_key: Optional[str] = "correct_answer",
|
|
168
|
+
threshold: Optional[float] = 0.5,
|
|
169
|
+
) -> Workflow:
|
|
170
|
+
parameters = dict(
|
|
171
|
+
code=code,
|
|
172
|
+
correct_answer_key=correct_answer_key,
|
|
173
|
+
threshold=threshold,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
return evaluator(
|
|
177
|
+
slug=slug,
|
|
178
|
+
#
|
|
179
|
+
name=name,
|
|
180
|
+
description=description,
|
|
181
|
+
#
|
|
182
|
+
variant_slug=variant_slug,
|
|
183
|
+
#
|
|
184
|
+
uri="auto_custom_code_run",
|
|
185
|
+
#
|
|
186
|
+
parameters=parameters,
|
|
187
|
+
)()
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def auto_ai_critique(
|
|
191
|
+
*,
|
|
192
|
+
slug: Optional[str] = None,
|
|
193
|
+
#
|
|
194
|
+
name: Optional[str] = None,
|
|
195
|
+
description: Optional[str] = None,
|
|
196
|
+
#
|
|
197
|
+
variant_slug: Optional[str] = None,
|
|
198
|
+
#
|
|
199
|
+
prompt_template: list[dict[str, str]],
|
|
200
|
+
#
|
|
201
|
+
correct_answer_key: Optional[str] = "correct_answer",
|
|
202
|
+
model: Optional[str] = "gpt-3.5-turbo",
|
|
203
|
+
) -> Workflow:
|
|
204
|
+
parameters = dict(
|
|
205
|
+
prompt_template=prompt_template,
|
|
206
|
+
correct_answer_key=correct_answer_key,
|
|
207
|
+
model=model,
|
|
208
|
+
version=3,
|
|
209
|
+
template_format="curly",
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
return evaluator(
|
|
213
|
+
slug=slug,
|
|
214
|
+
#
|
|
215
|
+
name=name,
|
|
216
|
+
description=description,
|
|
217
|
+
#
|
|
218
|
+
variant_slug=variant_slug,
|
|
219
|
+
#
|
|
220
|
+
uri="auto_ai_critique",
|
|
221
|
+
#
|
|
222
|
+
parameters=parameters,
|
|
223
|
+
)()
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def auto_starts_with(
|
|
227
|
+
*,
|
|
228
|
+
slug: Optional[str] = None,
|
|
229
|
+
#
|
|
230
|
+
name: Optional[str] = None,
|
|
231
|
+
description: Optional[str] = None,
|
|
232
|
+
#
|
|
233
|
+
variant_slug: Optional[str] = None,
|
|
234
|
+
#
|
|
235
|
+
prefix: str,
|
|
236
|
+
#
|
|
237
|
+
case_sensitive: Optional[bool] = True,
|
|
238
|
+
) -> Workflow:
|
|
239
|
+
parameters = dict(
|
|
240
|
+
prefix=prefix,
|
|
241
|
+
case_sensitive=case_sensitive,
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
return evaluator(
|
|
245
|
+
slug=slug,
|
|
246
|
+
#
|
|
247
|
+
name=name,
|
|
248
|
+
description=description,
|
|
249
|
+
#
|
|
250
|
+
variant_slug=variant_slug,
|
|
251
|
+
#
|
|
252
|
+
uri="auto_starts_with",
|
|
253
|
+
#
|
|
254
|
+
parameters=parameters,
|
|
255
|
+
)()
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def auto_ends_with(
|
|
259
|
+
*,
|
|
260
|
+
slug: Optional[str] = None,
|
|
261
|
+
#
|
|
262
|
+
name: Optional[str] = None,
|
|
263
|
+
description: Optional[str] = None,
|
|
264
|
+
#
|
|
265
|
+
variant_slug: Optional[str] = None,
|
|
266
|
+
#
|
|
267
|
+
suffix: str,
|
|
268
|
+
#
|
|
269
|
+
case_sensitive: Optional[bool] = True,
|
|
270
|
+
) -> Workflow:
|
|
271
|
+
parameters = dict(
|
|
272
|
+
suffix=suffix,
|
|
273
|
+
case_sensitive=case_sensitive,
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
return evaluator(
|
|
277
|
+
slug=slug,
|
|
278
|
+
#
|
|
279
|
+
name=name,
|
|
280
|
+
description=description,
|
|
281
|
+
#
|
|
282
|
+
variant_slug=variant_slug,
|
|
283
|
+
#
|
|
284
|
+
uri="auto_ends_with",
|
|
285
|
+
#
|
|
286
|
+
parameters=parameters,
|
|
287
|
+
)()
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def auto_contains(
|
|
291
|
+
*,
|
|
292
|
+
slug: Optional[str] = None,
|
|
293
|
+
#
|
|
294
|
+
name: Optional[str] = None,
|
|
295
|
+
description: Optional[str] = None,
|
|
296
|
+
#
|
|
297
|
+
variant_slug: Optional[str] = None,
|
|
298
|
+
#
|
|
299
|
+
substring: str,
|
|
300
|
+
#
|
|
301
|
+
case_sensitive: Optional[bool] = True,
|
|
302
|
+
) -> Workflow:
|
|
303
|
+
parameters = dict(
|
|
304
|
+
substring=substring,
|
|
305
|
+
case_sensitive=case_sensitive,
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
return evaluator(
|
|
309
|
+
slug=slug,
|
|
310
|
+
#
|
|
311
|
+
name=name,
|
|
312
|
+
description=description,
|
|
313
|
+
#
|
|
314
|
+
variant_slug=variant_slug,
|
|
315
|
+
#
|
|
316
|
+
uri="auto_contains",
|
|
317
|
+
#
|
|
318
|
+
parameters=parameters,
|
|
319
|
+
)()
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def auto_contains_any(
|
|
323
|
+
*,
|
|
324
|
+
slug: Optional[str] = None,
|
|
325
|
+
#
|
|
326
|
+
name: Optional[str] = None,
|
|
327
|
+
description: Optional[str] = None,
|
|
328
|
+
#
|
|
329
|
+
variant_slug: Optional[str] = None,
|
|
330
|
+
#
|
|
331
|
+
substrings: list[str],
|
|
332
|
+
#
|
|
333
|
+
case_sensitive: Optional[bool] = True,
|
|
334
|
+
) -> Workflow:
|
|
335
|
+
parameters = dict(
|
|
336
|
+
substrings=substrings,
|
|
337
|
+
case_sensitive=case_sensitive,
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
return evaluator(
|
|
341
|
+
slug=slug,
|
|
342
|
+
#
|
|
343
|
+
name=name,
|
|
344
|
+
description=description,
|
|
345
|
+
#
|
|
346
|
+
variant_slug=variant_slug,
|
|
347
|
+
#
|
|
348
|
+
uri="auto_contains_any",
|
|
349
|
+
#
|
|
350
|
+
parameters=parameters,
|
|
351
|
+
)()
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
def auto_contains_all(
|
|
355
|
+
*,
|
|
356
|
+
slug: Optional[str] = None,
|
|
357
|
+
#
|
|
358
|
+
name: Optional[str] = None,
|
|
359
|
+
description: Optional[str] = None,
|
|
360
|
+
#
|
|
361
|
+
variant_slug: Optional[str] = None,
|
|
362
|
+
#
|
|
363
|
+
substrings: list[str],
|
|
364
|
+
#
|
|
365
|
+
case_sensitive: Optional[bool] = True,
|
|
366
|
+
) -> Workflow:
|
|
367
|
+
parameters = dict(
|
|
368
|
+
substrings=substrings,
|
|
369
|
+
case_sensitive=case_sensitive,
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
return evaluator(
|
|
373
|
+
slug=slug,
|
|
374
|
+
#
|
|
375
|
+
name=name,
|
|
376
|
+
description=description,
|
|
377
|
+
#
|
|
378
|
+
variant_slug=variant_slug,
|
|
379
|
+
#
|
|
380
|
+
uri="auto_contains_all",
|
|
381
|
+
#
|
|
382
|
+
parameters=parameters,
|
|
383
|
+
)()
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
def auto_contains_json(
|
|
387
|
+
*,
|
|
388
|
+
slug: Optional[str] = None,
|
|
389
|
+
#
|
|
390
|
+
name: Optional[str] = None,
|
|
391
|
+
description: Optional[str] = None,
|
|
392
|
+
#
|
|
393
|
+
variant_slug: Optional[str] = None,
|
|
394
|
+
) -> Workflow:
|
|
395
|
+
return evaluator(
|
|
396
|
+
slug=slug,
|
|
397
|
+
#
|
|
398
|
+
name=name,
|
|
399
|
+
description=description,
|
|
400
|
+
#
|
|
401
|
+
variant_slug=variant_slug,
|
|
402
|
+
#
|
|
403
|
+
uri="auto_contains_json",
|
|
404
|
+
)()
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def auto_json_diff(
|
|
408
|
+
*,
|
|
409
|
+
slug: Optional[str] = None,
|
|
410
|
+
#
|
|
411
|
+
name: Optional[str] = None,
|
|
412
|
+
description: Optional[str] = None,
|
|
413
|
+
#
|
|
414
|
+
variant_slug: Optional[str] = None,
|
|
415
|
+
#
|
|
416
|
+
correct_answer_key: Optional[str] = "correct_answer",
|
|
417
|
+
threshold: Optional[float] = 0.5,
|
|
418
|
+
predict_keys: Optional[bool] = False,
|
|
419
|
+
case_insensitive_keys: Optional[bool] = False,
|
|
420
|
+
compare_schema_only: Optional[bool] = False,
|
|
421
|
+
) -> Workflow:
|
|
422
|
+
parameters = dict(
|
|
423
|
+
correct_answer_key=correct_answer_key,
|
|
424
|
+
threshold=threshold,
|
|
425
|
+
predict_keys=predict_keys,
|
|
426
|
+
case_insensitive_keys=case_insensitive_keys,
|
|
427
|
+
compare_schema_only=compare_schema_only,
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
return evaluator(
|
|
431
|
+
slug=slug,
|
|
432
|
+
#
|
|
433
|
+
name=name,
|
|
434
|
+
description=description,
|
|
435
|
+
#
|
|
436
|
+
variant_slug=variant_slug,
|
|
437
|
+
#
|
|
438
|
+
uri="auto_json_diff",
|
|
439
|
+
#
|
|
440
|
+
parameters=parameters,
|
|
441
|
+
)()
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
def auto_levenshtein_distance(
|
|
445
|
+
*,
|
|
446
|
+
slug: Optional[str] = None,
|
|
447
|
+
#
|
|
448
|
+
name: Optional[str] = None,
|
|
449
|
+
description: Optional[str] = None,
|
|
450
|
+
#
|
|
451
|
+
variant_slug: Optional[str] = None,
|
|
452
|
+
#
|
|
453
|
+
correct_answer_key: Optional[str] = "correct_answer",
|
|
454
|
+
case_sensitive: Optional[bool] = True,
|
|
455
|
+
threshold: Optional[float] = 0.5,
|
|
456
|
+
) -> Workflow:
|
|
457
|
+
parameters = dict(
|
|
458
|
+
correct_answer_key=correct_answer_key,
|
|
459
|
+
case_sensitive=case_sensitive,
|
|
460
|
+
threshold=threshold,
|
|
461
|
+
)
|
|
462
|
+
|
|
463
|
+
return evaluator(
|
|
464
|
+
slug=slug,
|
|
465
|
+
#
|
|
466
|
+
name=name,
|
|
467
|
+
description=description,
|
|
468
|
+
#
|
|
469
|
+
variant_slug=variant_slug,
|
|
470
|
+
#
|
|
471
|
+
uri="auto_levenshtein_distance",
|
|
472
|
+
#
|
|
473
|
+
parameters=parameters,
|
|
474
|
+
)()
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
def auto_similarity_match(
|
|
478
|
+
*,
|
|
479
|
+
slug: Optional[str] = None,
|
|
480
|
+
#
|
|
481
|
+
name: Optional[str] = None,
|
|
482
|
+
description: Optional[str] = None,
|
|
483
|
+
#
|
|
484
|
+
variant_slug: Optional[str] = None,
|
|
485
|
+
#
|
|
486
|
+
correct_answer_key: Optional[str] = "correct_answer",
|
|
487
|
+
case_sensitive: Optional[bool] = True,
|
|
488
|
+
threshold: Optional[float] = 0.5,
|
|
489
|
+
) -> Workflow:
|
|
490
|
+
parameters = dict(
|
|
491
|
+
correct_answer_key=correct_answer_key,
|
|
492
|
+
case_sensitive=case_sensitive,
|
|
493
|
+
threshold=threshold,
|
|
494
|
+
)
|
|
495
|
+
|
|
496
|
+
return evaluator(
|
|
497
|
+
slug=slug,
|
|
498
|
+
#
|
|
499
|
+
name=name,
|
|
500
|
+
description=description,
|
|
501
|
+
#
|
|
502
|
+
variant_slug=variant_slug,
|
|
503
|
+
#
|
|
504
|
+
uri="auto_similarity_match",
|
|
505
|
+
#
|
|
506
|
+
parameters=parameters,
|
|
507
|
+
)()
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
def auto_semantic_similarity(
|
|
511
|
+
*,
|
|
512
|
+
slug: Optional[str] = None,
|
|
513
|
+
#
|
|
514
|
+
name: Optional[str] = None,
|
|
515
|
+
description: Optional[str] = None,
|
|
516
|
+
#
|
|
517
|
+
variant_slug: Optional[str] = None,
|
|
518
|
+
#
|
|
519
|
+
correct_answer_key: Optional[str] = "correct_answer",
|
|
520
|
+
threshold: Optional[float] = 0.5,
|
|
521
|
+
embedding_model: Optional[str] = "text-embedding-3-small",
|
|
522
|
+
) -> Workflow:
|
|
523
|
+
parameters = dict(
|
|
524
|
+
correct_answer_key=correct_answer_key,
|
|
525
|
+
threshold=threshold,
|
|
526
|
+
embedding_model=embedding_model,
|
|
527
|
+
)
|
|
528
|
+
|
|
529
|
+
return evaluator(
|
|
530
|
+
slug=slug,
|
|
531
|
+
#
|
|
532
|
+
name=name,
|
|
533
|
+
description=description,
|
|
534
|
+
#
|
|
535
|
+
variant_slug=variant_slug,
|
|
536
|
+
#
|
|
537
|
+
uri="auto_semantic_similarity",
|
|
538
|
+
#
|
|
539
|
+
parameters=parameters,
|
|
540
|
+
)()
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
def completion(
|
|
544
|
+
*,
|
|
545
|
+
slug: Optional[str] = None,
|
|
546
|
+
#
|
|
547
|
+
name: Optional[str] = None,
|
|
548
|
+
description: Optional[str] = None,
|
|
549
|
+
#
|
|
550
|
+
variant_slug: Optional[str] = None,
|
|
551
|
+
#
|
|
552
|
+
config: SinglePromptConfig,
|
|
553
|
+
) -> Workflow:
|
|
554
|
+
parameters = config.model_dump(
|
|
555
|
+
mode="json",
|
|
556
|
+
exclude_none=True,
|
|
557
|
+
)
|
|
558
|
+
|
|
559
|
+
return application(
|
|
560
|
+
slug=slug,
|
|
561
|
+
#
|
|
562
|
+
name=name,
|
|
563
|
+
description=description,
|
|
564
|
+
#
|
|
565
|
+
variant_slug=variant_slug,
|
|
566
|
+
#
|
|
567
|
+
uri="completion",
|
|
568
|
+
#
|
|
569
|
+
parameters=parameters,
|
|
570
|
+
)()
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
def chat(
|
|
574
|
+
*,
|
|
575
|
+
slug: Optional[str] = None,
|
|
576
|
+
#
|
|
577
|
+
name: Optional[str] = None,
|
|
578
|
+
description: Optional[str] = None,
|
|
579
|
+
#
|
|
580
|
+
variant_slug: Optional[str] = None,
|
|
581
|
+
#
|
|
582
|
+
config: SinglePromptConfig,
|
|
583
|
+
) -> Workflow:
|
|
584
|
+
parameters = config.model_dump(
|
|
585
|
+
mode="json",
|
|
586
|
+
exclude_none=True,
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
return application(
|
|
590
|
+
slug=slug,
|
|
591
|
+
#
|
|
592
|
+
name=name,
|
|
593
|
+
description=description,
|
|
594
|
+
#
|
|
595
|
+
variant_slug=variant_slug,
|
|
596
|
+
#
|
|
597
|
+
uri="chat",
|
|
598
|
+
#
|
|
599
|
+
parameters=parameters,
|
|
600
|
+
)()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from agenta.sdk.models.workflows import WorkflowServiceConfiguration
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
echo_v0_configuration = WorkflowServiceConfiguration()
|
|
5
|
+
auto_exact_match_v0_configuration = WorkflowServiceConfiguration()
|
|
6
|
+
auto_regex_test_v0_configuration = WorkflowServiceConfiguration()
|
|
7
|
+
field_match_test_v0_configuration = WorkflowServiceConfiguration()
|
|
8
|
+
auto_webhook_test_v0_configuration = WorkflowServiceConfiguration()
|
|
9
|
+
auto_custom_code_run_v0_configuration = WorkflowServiceConfiguration()
|
|
10
|
+
auto_ai_critique_v0_configuration = WorkflowServiceConfiguration()
|
|
11
|
+
auto_starts_with_v0_configuration = WorkflowServiceConfiguration()
|
|
12
|
+
auto_ends_with_v0_configuration = WorkflowServiceConfiguration()
|
|
13
|
+
auto_contains_v0_configuration = WorkflowServiceConfiguration()
|
|
14
|
+
auto_contains_any_v0_configuration = WorkflowServiceConfiguration()
|
|
15
|
+
auto_contains_all_v0_configuration = WorkflowServiceConfiguration()
|
|
16
|
+
auto_contains_json_v0_configuration = WorkflowServiceConfiguration()
|
|
17
|
+
auto_json_diff_v0_configuration = WorkflowServiceConfiguration()
|
|
18
|
+
auto_levenshtein_distance_v0_configuration = WorkflowServiceConfiguration()
|
|
19
|
+
auto_similarity_match_v0_configuration = WorkflowServiceConfiguration()
|
|
20
|
+
auto_semantic_similarity_v0_configuration = WorkflowServiceConfiguration()
|
|
21
|
+
completion_v0_configuration = WorkflowServiceConfiguration()
|
|
22
|
+
chat_v0_configuration = WorkflowServiceConfiguration()
|