agenta 0.57.0__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/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 +22 -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/vault.py +203 -8
- 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/exporters.py +67 -17
- 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 -13
- agenta/sdk/types.py +211 -17
- 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.57.0.dist-info → agenta-0.63.2.dist-info}/METADATA +33 -30
- agenta-0.63.2.dist-info/RECORD +421 -0
- 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.57.0.dist-info/RECORD +0 -371
- /agenta/sdk/{workflows → engines/running}/registry.py +0 -0
- {agenta-0.57.0.dist-info → agenta-0.63.2.dist-info}/WHEEL +0 -0
agenta/__init__.py
CHANGED
|
@@ -27,8 +27,12 @@ from .sdk.utils.costs import calculate_token_usage
|
|
|
27
27
|
from .sdk.tracing import Tracing, get_tracer
|
|
28
28
|
from .sdk.tracing.conventions import Reference
|
|
29
29
|
from .sdk.decorators.tracing import instrument
|
|
30
|
-
from .sdk.decorators.running import
|
|
31
|
-
|
|
30
|
+
from .sdk.decorators.running import (
|
|
31
|
+
workflow,
|
|
32
|
+
application,
|
|
33
|
+
evaluator,
|
|
34
|
+
)
|
|
35
|
+
from .sdk.decorators.serving import route, app
|
|
32
36
|
from .sdk.context.running import workflow_mode_enabled
|
|
33
37
|
from .sdk.litellm import litellm as callbacks
|
|
34
38
|
from .sdk.managers.apps import AppManager
|
|
@@ -40,6 +44,10 @@ from .sdk.managers.deployment import DeploymentManager
|
|
|
40
44
|
from .sdk import assets as assets
|
|
41
45
|
from .sdk import tracer
|
|
42
46
|
|
|
47
|
+
# evaluations
|
|
48
|
+
from .sdk import testsets as testsets
|
|
49
|
+
|
|
50
|
+
|
|
43
51
|
config = PreInitObject("agenta.config", Config)
|
|
44
52
|
DEFAULT_AGENTA_SINGLETON_INSTANCE = AgentaSingleton()
|
|
45
53
|
|
|
@@ -65,7 +73,8 @@ def init(
|
|
|
65
73
|
global api, async_api, tracing, tracer # pylint: disable=global-statement
|
|
66
74
|
|
|
67
75
|
_init(
|
|
68
|
-
host=host
|
|
76
|
+
host=host,
|
|
77
|
+
api_url=api_url,
|
|
69
78
|
api_key=api_key,
|
|
70
79
|
config_fname=config_fname,
|
|
71
80
|
redact=redact,
|
agenta/client/__init__.py
CHANGED
|
@@ -160,8 +160,8 @@ from .backend.types import (
|
|
|
160
160
|
StandardProviderSettingsDto,
|
|
161
161
|
StatusCode,
|
|
162
162
|
StatusDto,
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
TestsetOutputResponse,
|
|
164
|
+
TestsetSimpleResponse,
|
|
165
165
|
TestcaseResponse,
|
|
166
166
|
Testset,
|
|
167
167
|
TestsetRequest,
|
|
@@ -403,8 +403,8 @@ __all__ = [
|
|
|
403
403
|
"StandardProviderSettingsDto",
|
|
404
404
|
"StatusCode",
|
|
405
405
|
"StatusDto",
|
|
406
|
-
"
|
|
407
|
-
"
|
|
406
|
+
"TestsetOutputResponse",
|
|
407
|
+
"TestsetSimpleResponse",
|
|
408
408
|
"TestcaseResponse",
|
|
409
409
|
"Testset",
|
|
410
410
|
"TestsetRequest",
|
|
@@ -155,8 +155,8 @@ from .types import (
|
|
|
155
155
|
StandardProviderSettingsDto,
|
|
156
156
|
StatusCode,
|
|
157
157
|
StatusDto,
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
TestsetOutputResponse,
|
|
159
|
+
TestsetSimpleResponse,
|
|
160
160
|
TestcaseResponse,
|
|
161
161
|
Testset,
|
|
162
162
|
TestsetRequest,
|
|
@@ -398,8 +398,8 @@ __all__ = [
|
|
|
398
398
|
"StandardProviderSettingsDto",
|
|
399
399
|
"StatusCode",
|
|
400
400
|
"StatusDto",
|
|
401
|
-
"
|
|
402
|
-
"
|
|
401
|
+
"TestsetOutputResponse",
|
|
402
|
+
"TestsetSimpleResponse",
|
|
403
403
|
"TestcaseResponse",
|
|
404
404
|
"Testset",
|
|
405
405
|
"TestsetRequest",
|
|
@@ -95,7 +95,7 @@ class ApiKeysClient:
|
|
|
95
95
|
self,
|
|
96
96
|
key_prefix: str,
|
|
97
97
|
*,
|
|
98
|
-
request_options: typing.Optional[RequestOptions] = None
|
|
98
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
99
99
|
) -> typing.Dict[str, typing.Optional[typing.Any]]:
|
|
100
100
|
"""
|
|
101
101
|
Delete an API key with the given key prefix for the authenticated user.
|
|
@@ -246,7 +246,7 @@ class AsyncApiKeysClient:
|
|
|
246
246
|
self,
|
|
247
247
|
key_prefix: str,
|
|
248
248
|
*,
|
|
249
|
-
request_options: typing.Optional[RequestOptions] = None
|
|
249
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
250
250
|
) -> typing.Dict[str, typing.Optional[typing.Any]]:
|
|
251
251
|
"""
|
|
252
252
|
Delete an API key with the given key prefix for the authenticated user.
|
|
@@ -80,7 +80,7 @@ class BillingClient:
|
|
|
80
80
|
*,
|
|
81
81
|
plan: Plan,
|
|
82
82
|
success_url: str,
|
|
83
|
-
request_options: typing.Optional[RequestOptions] = None
|
|
83
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
84
84
|
) -> typing.Optional[typing.Any]:
|
|
85
85
|
"""
|
|
86
86
|
Parameters
|
|
@@ -343,7 +343,7 @@ class AsyncBillingClient:
|
|
|
343
343
|
*,
|
|
344
344
|
plan: Plan,
|
|
345
345
|
success_url: str,
|
|
346
|
-
request_options: typing.Optional[RequestOptions] = None
|
|
346
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
347
347
|
) -> typing.Optional[typing.Any]:
|
|
348
348
|
"""
|
|
349
349
|
Parameters
|
|
@@ -110,7 +110,7 @@ class RawBillingClient:
|
|
|
110
110
|
*,
|
|
111
111
|
plan: Plan,
|
|
112
112
|
success_url: str,
|
|
113
|
-
request_options: typing.Optional[RequestOptions] = None
|
|
113
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
114
114
|
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
115
115
|
"""
|
|
116
116
|
Parameters
|
|
@@ -506,7 +506,7 @@ class AsyncRawBillingClient:
|
|
|
506
506
|
*,
|
|
507
507
|
plan: Plan,
|
|
508
508
|
success_url: str,
|
|
509
|
-
request_options: typing.Optional[RequestOptions] = None
|
|
509
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
510
510
|
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
511
511
|
"""
|
|
512
512
|
Parameters
|
agenta/client/backend/client.py
CHANGED
|
@@ -98,13 +98,17 @@ class AgentaApi:
|
|
|
98
98
|
self._client_wrapper = SyncClientWrapper(
|
|
99
99
|
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
100
100
|
api_key=api_key,
|
|
101
|
-
httpx_client=
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
httpx_client=(
|
|
102
|
+
httpx_client
|
|
103
|
+
if httpx_client is not None
|
|
104
|
+
else (
|
|
105
|
+
httpx.Client(
|
|
106
|
+
timeout=_defaulted_timeout, follow_redirects=follow_redirects
|
|
107
|
+
)
|
|
108
|
+
if follow_redirects is not None
|
|
109
|
+
else httpx.Client(timeout=_defaulted_timeout)
|
|
110
|
+
)
|
|
111
|
+
),
|
|
108
112
|
timeout=_defaulted_timeout,
|
|
109
113
|
)
|
|
110
114
|
self._raw_client = RawAgentaApi(client_wrapper=self._client_wrapper)
|
|
@@ -172,7 +176,7 @@ class AgentaApi:
|
|
|
172
176
|
|
|
173
177
|
def update_organization(
|
|
174
178
|
self,
|
|
175
|
-
|
|
179
|
+
organization_id: str,
|
|
176
180
|
*,
|
|
177
181
|
name: typing.Optional[str] = OMIT,
|
|
178
182
|
description: typing.Optional[str] = OMIT,
|
|
@@ -182,7 +186,7 @@ class AgentaApi:
|
|
|
182
186
|
"""
|
|
183
187
|
Parameters
|
|
184
188
|
----------
|
|
185
|
-
|
|
189
|
+
organization_id : str
|
|
186
190
|
|
|
187
191
|
name : typing.Optional[str]
|
|
188
192
|
|
|
@@ -206,11 +210,11 @@ class AgentaApi:
|
|
|
206
210
|
api_key="YOUR_API_KEY",
|
|
207
211
|
)
|
|
208
212
|
client.update_organization(
|
|
209
|
-
|
|
213
|
+
organization_id="organization_id",
|
|
210
214
|
)
|
|
211
215
|
"""
|
|
212
216
|
_response = self._raw_client.update_organization(
|
|
213
|
-
|
|
217
|
+
organization_id,
|
|
214
218
|
name=name,
|
|
215
219
|
description=description,
|
|
216
220
|
updated_at=updated_at,
|
|
@@ -220,7 +224,7 @@ class AgentaApi:
|
|
|
220
224
|
|
|
221
225
|
def create_workspace(
|
|
222
226
|
self,
|
|
223
|
-
|
|
227
|
+
organization_id: str,
|
|
224
228
|
*,
|
|
225
229
|
name: str,
|
|
226
230
|
description: typing.Optional[str] = OMIT,
|
|
@@ -230,7 +234,7 @@ class AgentaApi:
|
|
|
230
234
|
"""
|
|
231
235
|
Parameters
|
|
232
236
|
----------
|
|
233
|
-
|
|
237
|
+
organization_id : str
|
|
234
238
|
|
|
235
239
|
name : str
|
|
236
240
|
|
|
@@ -254,12 +258,12 @@ class AgentaApi:
|
|
|
254
258
|
api_key="YOUR_API_KEY",
|
|
255
259
|
)
|
|
256
260
|
client.create_workspace(
|
|
257
|
-
|
|
261
|
+
organization_id="organization_id",
|
|
258
262
|
name="name",
|
|
259
263
|
)
|
|
260
264
|
"""
|
|
261
265
|
_response = self._raw_client.create_workspace(
|
|
262
|
-
|
|
266
|
+
organization_id,
|
|
263
267
|
name=name,
|
|
264
268
|
description=description,
|
|
265
269
|
type=type,
|
|
@@ -269,7 +273,7 @@ class AgentaApi:
|
|
|
269
273
|
|
|
270
274
|
def update_workspace(
|
|
271
275
|
self,
|
|
272
|
-
|
|
276
|
+
organization_id: str,
|
|
273
277
|
workspace_id: str,
|
|
274
278
|
*,
|
|
275
279
|
name: typing.Optional[str] = OMIT,
|
|
@@ -280,7 +284,7 @@ class AgentaApi:
|
|
|
280
284
|
"""
|
|
281
285
|
Parameters
|
|
282
286
|
----------
|
|
283
|
-
|
|
287
|
+
organization_id : str
|
|
284
288
|
|
|
285
289
|
workspace_id : str
|
|
286
290
|
|
|
@@ -306,12 +310,12 @@ class AgentaApi:
|
|
|
306
310
|
api_key="YOUR_API_KEY",
|
|
307
311
|
)
|
|
308
312
|
client.update_workspace(
|
|
309
|
-
|
|
313
|
+
organization_id="organization_id",
|
|
310
314
|
workspace_id="workspace_id",
|
|
311
315
|
)
|
|
312
316
|
"""
|
|
313
317
|
_response = self._raw_client.update_workspace(
|
|
314
|
-
|
|
318
|
+
organization_id,
|
|
315
319
|
workspace_id,
|
|
316
320
|
name=name,
|
|
317
321
|
description=description,
|
|
@@ -427,7 +431,7 @@ class AgentaApi:
|
|
|
427
431
|
workspace_id: str,
|
|
428
432
|
*,
|
|
429
433
|
email: str,
|
|
430
|
-
|
|
434
|
+
organization_id: str,
|
|
431
435
|
role: str,
|
|
432
436
|
request_options: typing.Optional[RequestOptions] = None,
|
|
433
437
|
) -> typing.Optional[typing.Any]:
|
|
@@ -437,7 +441,7 @@ class AgentaApi:
|
|
|
437
441
|
Args:
|
|
438
442
|
workspace_id (str): The ID of the workspace.
|
|
439
443
|
email (str): The email of the user to remove the role from.
|
|
440
|
-
|
|
444
|
+
organization_id (str): The ID of the organization.
|
|
441
445
|
role (str): The role to remove from the user.
|
|
442
446
|
request (Request): The FastAPI request object.
|
|
443
447
|
|
|
@@ -454,7 +458,7 @@ class AgentaApi:
|
|
|
454
458
|
|
|
455
459
|
email : str
|
|
456
460
|
|
|
457
|
-
|
|
461
|
+
organization_id : str
|
|
458
462
|
|
|
459
463
|
role : str
|
|
460
464
|
|
|
@@ -476,14 +480,14 @@ class AgentaApi:
|
|
|
476
480
|
client.unassign_role_from_user(
|
|
477
481
|
workspace_id="workspace_id",
|
|
478
482
|
email="email",
|
|
479
|
-
|
|
483
|
+
organization_id="organization_id",
|
|
480
484
|
role="role",
|
|
481
485
|
)
|
|
482
486
|
"""
|
|
483
487
|
_response = self._raw_client.unassign_role_from_user(
|
|
484
488
|
workspace_id,
|
|
485
489
|
email=email,
|
|
486
|
-
|
|
490
|
+
organization_id=organization_id,
|
|
487
491
|
role=role,
|
|
488
492
|
request_options=request_options,
|
|
489
493
|
)
|
|
@@ -657,13 +661,17 @@ class AsyncAgentaApi:
|
|
|
657
661
|
self._client_wrapper = AsyncClientWrapper(
|
|
658
662
|
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
659
663
|
api_key=api_key,
|
|
660
|
-
httpx_client=
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
664
|
+
httpx_client=(
|
|
665
|
+
httpx_client
|
|
666
|
+
if httpx_client is not None
|
|
667
|
+
else (
|
|
668
|
+
httpx.AsyncClient(
|
|
669
|
+
timeout=_defaulted_timeout, follow_redirects=follow_redirects
|
|
670
|
+
)
|
|
671
|
+
if follow_redirects is not None
|
|
672
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout)
|
|
673
|
+
)
|
|
674
|
+
),
|
|
667
675
|
timeout=_defaulted_timeout,
|
|
668
676
|
)
|
|
669
677
|
self._raw_client = AsyncRawAgentaApi(client_wrapper=self._client_wrapper)
|
|
@@ -743,7 +751,7 @@ class AsyncAgentaApi:
|
|
|
743
751
|
|
|
744
752
|
async def update_organization(
|
|
745
753
|
self,
|
|
746
|
-
|
|
754
|
+
organization_id: str,
|
|
747
755
|
*,
|
|
748
756
|
name: typing.Optional[str] = OMIT,
|
|
749
757
|
description: typing.Optional[str] = OMIT,
|
|
@@ -753,7 +761,7 @@ class AsyncAgentaApi:
|
|
|
753
761
|
"""
|
|
754
762
|
Parameters
|
|
755
763
|
----------
|
|
756
|
-
|
|
764
|
+
organization_id : str
|
|
757
765
|
|
|
758
766
|
name : typing.Optional[str]
|
|
759
767
|
|
|
@@ -782,14 +790,14 @@ class AsyncAgentaApi:
|
|
|
782
790
|
|
|
783
791
|
async def main() -> None:
|
|
784
792
|
await client.update_organization(
|
|
785
|
-
|
|
793
|
+
organization_id="organization_id",
|
|
786
794
|
)
|
|
787
795
|
|
|
788
796
|
|
|
789
797
|
asyncio.run(main())
|
|
790
798
|
"""
|
|
791
799
|
_response = await self._raw_client.update_organization(
|
|
792
|
-
|
|
800
|
+
organization_id,
|
|
793
801
|
name=name,
|
|
794
802
|
description=description,
|
|
795
803
|
updated_at=updated_at,
|
|
@@ -799,7 +807,7 @@ class AsyncAgentaApi:
|
|
|
799
807
|
|
|
800
808
|
async def create_workspace(
|
|
801
809
|
self,
|
|
802
|
-
|
|
810
|
+
organization_id: str,
|
|
803
811
|
*,
|
|
804
812
|
name: str,
|
|
805
813
|
description: typing.Optional[str] = OMIT,
|
|
@@ -809,7 +817,7 @@ class AsyncAgentaApi:
|
|
|
809
817
|
"""
|
|
810
818
|
Parameters
|
|
811
819
|
----------
|
|
812
|
-
|
|
820
|
+
organization_id : str
|
|
813
821
|
|
|
814
822
|
name : str
|
|
815
823
|
|
|
@@ -838,7 +846,7 @@ class AsyncAgentaApi:
|
|
|
838
846
|
|
|
839
847
|
async def main() -> None:
|
|
840
848
|
await client.create_workspace(
|
|
841
|
-
|
|
849
|
+
organization_id="organization_id",
|
|
842
850
|
name="name",
|
|
843
851
|
)
|
|
844
852
|
|
|
@@ -846,7 +854,7 @@ class AsyncAgentaApi:
|
|
|
846
854
|
asyncio.run(main())
|
|
847
855
|
"""
|
|
848
856
|
_response = await self._raw_client.create_workspace(
|
|
849
|
-
|
|
857
|
+
organization_id,
|
|
850
858
|
name=name,
|
|
851
859
|
description=description,
|
|
852
860
|
type=type,
|
|
@@ -856,7 +864,7 @@ class AsyncAgentaApi:
|
|
|
856
864
|
|
|
857
865
|
async def update_workspace(
|
|
858
866
|
self,
|
|
859
|
-
|
|
867
|
+
organization_id: str,
|
|
860
868
|
workspace_id: str,
|
|
861
869
|
*,
|
|
862
870
|
name: typing.Optional[str] = OMIT,
|
|
@@ -867,7 +875,7 @@ class AsyncAgentaApi:
|
|
|
867
875
|
"""
|
|
868
876
|
Parameters
|
|
869
877
|
----------
|
|
870
|
-
|
|
878
|
+
organization_id : str
|
|
871
879
|
|
|
872
880
|
workspace_id : str
|
|
873
881
|
|
|
@@ -898,7 +906,7 @@ class AsyncAgentaApi:
|
|
|
898
906
|
|
|
899
907
|
async def main() -> None:
|
|
900
908
|
await client.update_workspace(
|
|
901
|
-
|
|
909
|
+
organization_id="organization_id",
|
|
902
910
|
workspace_id="workspace_id",
|
|
903
911
|
)
|
|
904
912
|
|
|
@@ -906,7 +914,7 @@ class AsyncAgentaApi:
|
|
|
906
914
|
asyncio.run(main())
|
|
907
915
|
"""
|
|
908
916
|
_response = await self._raw_client.update_workspace(
|
|
909
|
-
|
|
917
|
+
organization_id,
|
|
910
918
|
workspace_id,
|
|
911
919
|
name=name,
|
|
912
920
|
description=description,
|
|
@@ -1038,7 +1046,7 @@ class AsyncAgentaApi:
|
|
|
1038
1046
|
workspace_id: str,
|
|
1039
1047
|
*,
|
|
1040
1048
|
email: str,
|
|
1041
|
-
|
|
1049
|
+
organization_id: str,
|
|
1042
1050
|
role: str,
|
|
1043
1051
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1044
1052
|
) -> typing.Optional[typing.Any]:
|
|
@@ -1048,7 +1056,7 @@ class AsyncAgentaApi:
|
|
|
1048
1056
|
Args:
|
|
1049
1057
|
workspace_id (str): The ID of the workspace.
|
|
1050
1058
|
email (str): The email of the user to remove the role from.
|
|
1051
|
-
|
|
1059
|
+
organization_id (str): The ID of the organization.
|
|
1052
1060
|
role (str): The role to remove from the user.
|
|
1053
1061
|
request (Request): The FastAPI request object.
|
|
1054
1062
|
|
|
@@ -1065,7 +1073,7 @@ class AsyncAgentaApi:
|
|
|
1065
1073
|
|
|
1066
1074
|
email : str
|
|
1067
1075
|
|
|
1068
|
-
|
|
1076
|
+
organization_id : str
|
|
1069
1077
|
|
|
1070
1078
|
role : str
|
|
1071
1079
|
|
|
@@ -1092,7 +1100,7 @@ class AsyncAgentaApi:
|
|
|
1092
1100
|
await client.unassign_role_from_user(
|
|
1093
1101
|
workspace_id="workspace_id",
|
|
1094
1102
|
email="email",
|
|
1095
|
-
|
|
1103
|
+
organization_id="organization_id",
|
|
1096
1104
|
role="role",
|
|
1097
1105
|
)
|
|
1098
1106
|
|
|
@@ -1102,7 +1110,7 @@ class AsyncAgentaApi:
|
|
|
1102
1110
|
_response = await self._raw_client.unassign_role_from_user(
|
|
1103
1111
|
workspace_id,
|
|
1104
1112
|
email=email,
|
|
1105
|
-
|
|
1113
|
+
organization_id=organization_id,
|
|
1106
1114
|
role=role,
|
|
1107
1115
|
request_options=request_options,
|
|
1108
1116
|
)
|
|
@@ -35,7 +35,7 @@ class SyncClientWrapper(BaseClientWrapper):
|
|
|
35
35
|
api_key: str,
|
|
36
36
|
base_url: str,
|
|
37
37
|
timeout: typing.Optional[float] = None,
|
|
38
|
-
httpx_client: httpx.Client
|
|
38
|
+
httpx_client: httpx.Client,
|
|
39
39
|
):
|
|
40
40
|
super().__init__(api_key=api_key, base_url=base_url, timeout=timeout)
|
|
41
41
|
self.httpx_client = HttpClient(
|
|
@@ -53,7 +53,7 @@ class AsyncClientWrapper(BaseClientWrapper):
|
|
|
53
53
|
api_key: str,
|
|
54
54
|
base_url: str,
|
|
55
55
|
timeout: typing.Optional[float] = None,
|
|
56
|
-
httpx_client: httpx.AsyncClient
|
|
56
|
+
httpx_client: httpx.AsyncClient,
|
|
57
57
|
):
|
|
58
58
|
super().__init__(api_key=api_key, base_url=base_url, timeout=timeout)
|
|
59
59
|
self.httpx_client = AsyncHttpClient(
|
|
@@ -53,7 +53,9 @@ def with_content_type(*, file: File, default_content_type: str) -> File:
|
|
|
53
53
|
filename, content = cast(Tuple[Optional[str], FileContent], file) # type: ignore
|
|
54
54
|
return (filename, content, default_content_type)
|
|
55
55
|
elif len(file) == 3:
|
|
56
|
-
filename, content, file_content_type = cast(
|
|
56
|
+
filename, content, file_content_type = cast(
|
|
57
|
+
Tuple[Optional[str], FileContent, Optional[str]], file
|
|
58
|
+
) # type: ignore
|
|
57
59
|
out_content_type = file_content_type or default_content_type
|
|
58
60
|
return (filename, content, out_content_type)
|
|
59
61
|
elif len(file) == 4:
|
|
@@ -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 (json_body if json_body != {} else None), (
|
|
152
|
+
data_body if data_body != {} else None
|
|
153
|
+
)
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
class HttpClient:
|
|
@@ -78,7 +78,9 @@ class UniversalBaseModel(pydantic.BaseModel):
|
|
|
78
78
|
)
|
|
79
79
|
|
|
80
80
|
@pydantic.model_serializer(mode="wrap", when_used="json") # type: ignore[attr-defined]
|
|
81
|
-
def serialize_model(
|
|
81
|
+
def serialize_model(
|
|
82
|
+
self, handler: pydantic.SerializerFunctionWrapHandler
|
|
83
|
+
) -> Any: # type: ignore[name-defined]
|
|
82
84
|
serialized = handler(self)
|
|
83
85
|
data = {
|
|
84
86
|
k: serialize_datetime(v) if isinstance(v, dt.datetime) else v
|
|
@@ -260,7 +262,10 @@ def universal_root_validator(
|
|
|
260
262
|
) -> Callable[[AnyCallable], AnyCallable]:
|
|
261
263
|
def decorator(func: AnyCallable) -> AnyCallable:
|
|
262
264
|
if IS_PYDANTIC_V2:
|
|
263
|
-
return cast(
|
|
265
|
+
return cast(
|
|
266
|
+
AnyCallable,
|
|
267
|
+
pydantic.model_validator(mode="before" if pre else "after")(func),
|
|
268
|
+
) # type: ignore[attr-defined]
|
|
264
269
|
return cast(AnyCallable, pydantic.root_validator(pre=pre)(func)) # type: ignore[call-overload]
|
|
265
270
|
|
|
266
271
|
return decorator
|
|
@@ -271,7 +276,12 @@ def universal_field_validator(
|
|
|
271
276
|
) -> Callable[[AnyCallable], AnyCallable]:
|
|
272
277
|
def decorator(func: AnyCallable) -> AnyCallable:
|
|
273
278
|
if IS_PYDANTIC_V2:
|
|
274
|
-
return cast(
|
|
279
|
+
return cast(
|
|
280
|
+
AnyCallable,
|
|
281
|
+
pydantic.field_validator(field_name, mode="before" if pre else "after")(
|
|
282
|
+
func
|
|
283
|
+
),
|
|
284
|
+
) # type: ignore[attr-defined]
|
|
275
285
|
return cast(AnyCallable, pydantic.validator(field_name, pre=pre)(func))
|
|
276
286
|
|
|
277
287
|
return decorator
|
|
@@ -237,7 +237,7 @@ class HumanEvaluationsClient:
|
|
|
237
237
|
Updates an evaluation's status.
|
|
238
238
|
|
|
239
239
|
Raises:
|
|
240
|
-
HTTPException: If the columns in the
|
|
240
|
+
HTTPException: If the columns in the testset do not match with the inputs in the variant.
|
|
241
241
|
|
|
242
242
|
Returns:
|
|
243
243
|
None: A 204 No Content status code, indicating that the update was successful.
|
|
@@ -785,7 +785,7 @@ class AsyncHumanEvaluationsClient:
|
|
|
785
785
|
Updates an evaluation's status.
|
|
786
786
|
|
|
787
787
|
Raises:
|
|
788
|
-
HTTPException: If the columns in the
|
|
788
|
+
HTTPException: If the columns in the testset do not match with the inputs in the variant.
|
|
789
789
|
|
|
790
790
|
Returns:
|
|
791
791
|
None: A 204 No Content status code, indicating that the update was successful.
|
|
@@ -336,7 +336,7 @@ class RawHumanEvaluationsClient:
|
|
|
336
336
|
Updates an evaluation's status.
|
|
337
337
|
|
|
338
338
|
Raises:
|
|
339
|
-
HTTPException: If the columns in the
|
|
339
|
+
HTTPException: If the columns in the testset do not match with the inputs in the variant.
|
|
340
340
|
|
|
341
341
|
Returns:
|
|
342
342
|
None: A 204 No Content status code, indicating that the update was successful.
|
|
@@ -1112,7 +1112,7 @@ class AsyncRawHumanEvaluationsClient:
|
|
|
1112
1112
|
Updates an evaluation's status.
|
|
1113
1113
|
|
|
1114
1114
|
Raises:
|
|
1115
|
-
HTTPException: If the columns in the
|
|
1115
|
+
HTTPException: If the columns in the testset do not match with the inputs in the variant.
|
|
1116
1116
|
|
|
1117
1117
|
Returns:
|
|
1118
1118
|
None: A 204 No Content status code, indicating that the update was successful.
|