mirascope 2.0.0a6__py3-none-any.whl → 2.0.1__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.
- mirascope/api/_generated/__init__.py +186 -5
- mirascope/api/_generated/annotations/client.py +38 -6
- mirascope/api/_generated/annotations/raw_client.py +366 -47
- mirascope/api/_generated/annotations/types/annotations_create_response.py +19 -6
- mirascope/api/_generated/annotations/types/annotations_get_response.py +19 -6
- mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item.py +22 -7
- mirascope/api/_generated/annotations/types/annotations_update_response.py +19 -6
- mirascope/api/_generated/api_keys/__init__.py +12 -2
- mirascope/api/_generated/api_keys/client.py +107 -6
- mirascope/api/_generated/api_keys/raw_client.py +486 -38
- mirascope/api/_generated/api_keys/types/__init__.py +7 -1
- mirascope/api/_generated/api_keys/types/api_keys_list_all_for_org_response_item.py +40 -0
- mirascope/api/_generated/client.py +36 -0
- mirascope/api/_generated/docs/raw_client.py +71 -9
- mirascope/api/_generated/environment.py +3 -3
- mirascope/api/_generated/environments/__init__.py +6 -0
- mirascope/api/_generated/environments/client.py +158 -9
- mirascope/api/_generated/environments/raw_client.py +620 -52
- mirascope/api/_generated/environments/types/__init__.py +10 -0
- mirascope/api/_generated/environments/types/environments_get_analytics_response.py +60 -0
- mirascope/api/_generated/environments/types/environments_get_analytics_response_top_functions_item.py +24 -0
- mirascope/api/_generated/{organizations/types/organizations_credits_response.py → environments/types/environments_get_analytics_response_top_models_item.py} +6 -3
- mirascope/api/_generated/errors/__init__.py +6 -0
- mirascope/api/_generated/errors/bad_request_error.py +5 -2
- mirascope/api/_generated/errors/conflict_error.py +5 -2
- mirascope/api/_generated/errors/payment_required_error.py +15 -0
- mirascope/api/_generated/errors/service_unavailable_error.py +14 -0
- mirascope/api/_generated/errors/too_many_requests_error.py +15 -0
- mirascope/api/_generated/functions/__init__.py +10 -0
- mirascope/api/_generated/functions/client.py +222 -8
- mirascope/api/_generated/functions/raw_client.py +975 -134
- mirascope/api/_generated/functions/types/__init__.py +28 -4
- mirascope/api/_generated/functions/types/functions_get_by_env_response.py +53 -0
- mirascope/api/_generated/functions/types/functions_get_by_env_response_dependencies_value.py +22 -0
- mirascope/api/_generated/functions/types/functions_list_by_env_response.py +25 -0
- mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item.py +56 -0
- mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item_dependencies_value.py +22 -0
- mirascope/api/_generated/health/raw_client.py +74 -10
- mirascope/api/_generated/organization_invitations/__init__.py +33 -0
- mirascope/api/_generated/organization_invitations/client.py +546 -0
- mirascope/api/_generated/organization_invitations/raw_client.py +1519 -0
- mirascope/api/_generated/organization_invitations/types/__init__.py +53 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response.py +34 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_create_request_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response.py +48 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_status.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response.py +48 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_status.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item.py +48 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_status.py +7 -0
- mirascope/api/_generated/organization_memberships/__init__.py +19 -0
- mirascope/api/_generated/organization_memberships/client.py +302 -0
- mirascope/api/_generated/organization_memberships/raw_client.py +736 -0
- mirascope/api/_generated/organization_memberships/types/__init__.py +27 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item.py +33 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item_role.py +7 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_update_request_role.py +7 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response.py +31 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response_role.py +7 -0
- mirascope/api/_generated/organizations/__init__.py +26 -2
- mirascope/api/_generated/organizations/client.py +442 -20
- mirascope/api/_generated/organizations/raw_client.py +1763 -164
- mirascope/api/_generated/organizations/types/__init__.py +48 -2
- mirascope/api/_generated/organizations/types/organizations_create_payment_intent_response.py +24 -0
- mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_request_target_plan.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response.py +47 -0
- mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item.py +33 -0
- mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item_resource.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_router_balance_response.py +24 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response.py +53 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response_current_plan.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response_payment_method.py +26 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change.py +34 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change_target_plan.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_update_subscription_request_target_plan.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_update_subscription_response.py +35 -0
- mirascope/api/_generated/project_memberships/__init__.py +25 -0
- mirascope/api/_generated/project_memberships/client.py +437 -0
- mirascope/api/_generated/project_memberships/raw_client.py +1039 -0
- mirascope/api/_generated/project_memberships/types/__init__.py +29 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_create_request_role.py +7 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_create_response.py +35 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_create_response_role.py +7 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item.py +33 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item_role.py +7 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_update_request_role.py +7 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_update_response.py +35 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_update_response_role.py +7 -0
- mirascope/api/_generated/projects/raw_client.py +415 -58
- mirascope/api/_generated/reference.md +2767 -397
- mirascope/api/_generated/tags/__init__.py +19 -0
- mirascope/api/_generated/tags/client.py +504 -0
- mirascope/api/_generated/tags/raw_client.py +1288 -0
- mirascope/api/_generated/tags/types/__init__.py +17 -0
- mirascope/api/_generated/tags/types/tags_create_response.py +41 -0
- mirascope/api/_generated/tags/types/tags_get_response.py +41 -0
- mirascope/api/_generated/tags/types/tags_list_response.py +23 -0
- mirascope/api/_generated/tags/types/tags_list_response_tags_item.py +41 -0
- mirascope/api/_generated/tags/types/tags_update_response.py +41 -0
- mirascope/api/_generated/token_cost/__init__.py +7 -0
- mirascope/api/_generated/token_cost/client.py +160 -0
- mirascope/api/_generated/token_cost/raw_client.py +264 -0
- mirascope/api/_generated/token_cost/types/__init__.py +8 -0
- mirascope/api/_generated/token_cost/types/token_cost_calculate_request_usage.py +54 -0
- mirascope/api/_generated/token_cost/types/token_cost_calculate_response.py +52 -0
- mirascope/api/_generated/traces/__init__.py +20 -0
- mirascope/api/_generated/traces/client.py +543 -0
- mirascope/api/_generated/traces/raw_client.py +1366 -96
- mirascope/api/_generated/traces/types/__init__.py +28 -0
- mirascope/api/_generated/traces/types/traces_get_analytics_summary_response.py +6 -0
- mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response.py +33 -0
- mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response_spans_item.py +88 -0
- mirascope/api/_generated/traces/types/traces_get_trace_detail_response_spans_item.py +0 -2
- mirascope/api/_generated/traces/types/traces_list_by_function_hash_response.py +25 -0
- mirascope/api/_generated/traces/types/traces_list_by_function_hash_response_traces_item.py +44 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item.py +26 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item_operator.py +7 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_by.py +7 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_order.py +7 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_response.py +26 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_response_spans_item.py +50 -0
- mirascope/api/_generated/traces/types/traces_search_response_spans_item.py +10 -1
- mirascope/api/_generated/types/__init__.py +32 -2
- mirascope/api/_generated/types/bad_request_error_body.py +50 -0
- mirascope/api/_generated/types/date.py +3 -0
- mirascope/api/_generated/types/immutable_resource_error.py +22 -0
- mirascope/api/_generated/types/internal_server_error_body.py +3 -3
- mirascope/api/_generated/types/plan_limit_exceeded_error.py +32 -0
- mirascope/api/_generated/types/plan_limit_exceeded_error_tag.py +7 -0
- mirascope/api/_generated/types/pricing_unavailable_error.py +23 -0
- mirascope/api/_generated/types/rate_limit_error.py +31 -0
- mirascope/api/_generated/types/rate_limit_error_tag.py +5 -0
- mirascope/api/_generated/types/service_unavailable_error_body.py +24 -0
- mirascope/api/_generated/types/service_unavailable_error_tag.py +7 -0
- mirascope/api/_generated/types/subscription_past_due_error.py +31 -0
- mirascope/api/_generated/types/subscription_past_due_error_tag.py +7 -0
- mirascope/api/settings.py +19 -1
- mirascope/llm/__init__.py +53 -10
- mirascope/llm/calls/__init__.py +2 -1
- mirascope/llm/calls/calls.py +3 -1
- mirascope/llm/calls/decorator.py +21 -7
- mirascope/llm/content/tool_output.py +22 -5
- mirascope/llm/exceptions.py +284 -71
- mirascope/llm/formatting/__init__.py +17 -0
- mirascope/llm/formatting/format.py +112 -35
- mirascope/llm/formatting/output_parser.py +178 -0
- mirascope/llm/formatting/partial.py +80 -7
- mirascope/llm/formatting/primitives.py +192 -0
- mirascope/llm/formatting/types.py +20 -8
- mirascope/llm/messages/__init__.py +3 -0
- mirascope/llm/messages/_utils.py +34 -0
- mirascope/llm/models/__init__.py +5 -0
- mirascope/llm/models/models.py +137 -69
- mirascope/llm/{providers/base → models}/params.py +7 -57
- mirascope/llm/models/thinking_config.py +61 -0
- mirascope/llm/prompts/_utils.py +0 -32
- mirascope/llm/prompts/decorator.py +16 -5
- mirascope/llm/prompts/prompts.py +131 -68
- mirascope/llm/providers/__init__.py +1 -4
- mirascope/llm/providers/anthropic/_utils/__init__.py +2 -0
- mirascope/llm/providers/anthropic/_utils/beta_decode.py +18 -9
- mirascope/llm/providers/anthropic/_utils/beta_encode.py +62 -13
- mirascope/llm/providers/anthropic/_utils/decode.py +18 -9
- mirascope/llm/providers/anthropic/_utils/encode.py +26 -7
- mirascope/llm/providers/anthropic/_utils/errors.py +2 -2
- mirascope/llm/providers/anthropic/beta_provider.py +64 -18
- mirascope/llm/providers/anthropic/provider.py +91 -33
- mirascope/llm/providers/base/__init__.py +0 -4
- mirascope/llm/providers/base/_utils.py +55 -6
- mirascope/llm/providers/base/base_provider.py +116 -37
- mirascope/llm/providers/google/_utils/__init__.py +2 -0
- mirascope/llm/providers/google/_utils/decode.py +20 -7
- mirascope/llm/providers/google/_utils/encode.py +26 -7
- mirascope/llm/providers/google/_utils/errors.py +3 -2
- mirascope/llm/providers/google/provider.py +64 -18
- mirascope/llm/providers/mirascope/_utils.py +13 -17
- mirascope/llm/providers/mirascope/provider.py +49 -18
- mirascope/llm/providers/mlx/_utils.py +7 -2
- mirascope/llm/providers/mlx/encoding/base.py +5 -2
- mirascope/llm/providers/mlx/encoding/transformers.py +5 -2
- mirascope/llm/providers/mlx/mlx.py +23 -6
- mirascope/llm/providers/mlx/provider.py +42 -13
- mirascope/llm/providers/openai/_utils/errors.py +2 -2
- mirascope/llm/providers/openai/completions/_utils/encode.py +20 -16
- mirascope/llm/providers/openai/completions/base_provider.py +40 -11
- mirascope/llm/providers/openai/provider.py +40 -10
- mirascope/llm/providers/openai/responses/_utils/__init__.py +2 -0
- mirascope/llm/providers/openai/responses/_utils/decode.py +19 -6
- mirascope/llm/providers/openai/responses/_utils/encode.py +22 -10
- mirascope/llm/providers/openai/responses/provider.py +56 -18
- mirascope/llm/providers/provider_registry.py +93 -19
- mirascope/llm/responses/__init__.py +6 -1
- mirascope/llm/responses/_utils.py +102 -12
- mirascope/llm/responses/base_response.py +5 -2
- mirascope/llm/responses/base_stream_response.py +115 -25
- mirascope/llm/responses/response.py +2 -1
- mirascope/llm/responses/root_response.py +89 -17
- mirascope/llm/responses/stream_response.py +6 -9
- mirascope/llm/tools/decorator.py +9 -4
- mirascope/llm/tools/tool_schema.py +12 -6
- mirascope/llm/tools/toolkit.py +35 -27
- mirascope/llm/tools/tools.py +45 -20
- mirascope/ops/__init__.py +4 -0
- mirascope/ops/_internal/configuration.py +82 -31
- mirascope/ops/_internal/exporters/exporters.py +64 -11
- mirascope/ops/_internal/instrumentation/llm/common.py +530 -0
- mirascope/ops/_internal/instrumentation/llm/cost.py +190 -0
- mirascope/ops/_internal/instrumentation/llm/encode.py +1 -1
- mirascope/ops/_internal/instrumentation/llm/llm.py +116 -1242
- mirascope/ops/_internal/instrumentation/llm/model.py +1798 -0
- mirascope/ops/_internal/instrumentation/llm/response.py +521 -0
- mirascope/ops/_internal/instrumentation/llm/serialize.py +300 -0
- mirascope/ops/_internal/protocols.py +83 -1
- mirascope/ops/_internal/traced_calls.py +4 -0
- mirascope/ops/_internal/traced_functions.py +118 -8
- mirascope/ops/_internal/tracing.py +78 -1
- mirascope/ops/_internal/utils.py +52 -4
- {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/METADATA +12 -11
- mirascope-2.0.1.dist-info/RECORD +423 -0
- {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/licenses/LICENSE +1 -1
- mirascope-2.0.0a6.dist-info/RECORD +0 -316
- {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/WHEEL +0 -0
|
@@ -15,11 +15,15 @@ from ..errors.conflict_error import ConflictError
|
|
|
15
15
|
from ..errors.forbidden_error import ForbiddenError
|
|
16
16
|
from ..errors.internal_server_error import InternalServerError
|
|
17
17
|
from ..errors.not_found_error import NotFoundError
|
|
18
|
+
from ..errors.payment_required_error import PaymentRequiredError
|
|
19
|
+
from ..errors.service_unavailable_error import ServiceUnavailableError
|
|
20
|
+
from ..errors.too_many_requests_error import TooManyRequestsError
|
|
18
21
|
from ..errors.unauthorized_error import UnauthorizedError
|
|
19
|
-
from ..types.already_exists_error import AlreadyExistsError
|
|
20
|
-
from ..types.http_api_decode_error import HttpApiDecodeError
|
|
21
22
|
from ..types.not_found_error_body import NotFoundErrorBody
|
|
23
|
+
from ..types.number_from_string import NumberFromString
|
|
22
24
|
from ..types.permission_denied_error import PermissionDeniedError
|
|
25
|
+
from ..types.plan_limit_exceeded_error import PlanLimitExceededError
|
|
26
|
+
from ..types.rate_limit_error import RateLimitError
|
|
23
27
|
from ..types.unauthorized_error_body import UnauthorizedErrorBody
|
|
24
28
|
from .types.traces_create_request_resource_spans_item import (
|
|
25
29
|
TracesCreateRequestResourceSpansItem,
|
|
@@ -28,7 +32,21 @@ from .types.traces_create_response import TracesCreateResponse
|
|
|
28
32
|
from .types.traces_get_analytics_summary_response import (
|
|
29
33
|
TracesGetAnalyticsSummaryResponse,
|
|
30
34
|
)
|
|
35
|
+
from .types.traces_get_trace_detail_by_env_response import (
|
|
36
|
+
TracesGetTraceDetailByEnvResponse,
|
|
37
|
+
)
|
|
31
38
|
from .types.traces_get_trace_detail_response import TracesGetTraceDetailResponse
|
|
39
|
+
from .types.traces_list_by_function_hash_response import (
|
|
40
|
+
TracesListByFunctionHashResponse,
|
|
41
|
+
)
|
|
42
|
+
from .types.traces_search_by_env_request_attribute_filters_item import (
|
|
43
|
+
TracesSearchByEnvRequestAttributeFiltersItem,
|
|
44
|
+
)
|
|
45
|
+
from .types.traces_search_by_env_request_sort_by import TracesSearchByEnvRequestSortBy
|
|
46
|
+
from .types.traces_search_by_env_request_sort_order import (
|
|
47
|
+
TracesSearchByEnvRequestSortOrder,
|
|
48
|
+
)
|
|
49
|
+
from .types.traces_search_by_env_response import TracesSearchByEnvResponse
|
|
32
50
|
from .types.traces_search_request_attribute_filters_item import (
|
|
33
51
|
TracesSearchRequestAttributeFiltersItem,
|
|
34
52
|
)
|
|
@@ -93,9 +111,9 @@ class RawTracesClient:
|
|
|
93
111
|
raise BadRequestError(
|
|
94
112
|
headers=dict(_response.headers),
|
|
95
113
|
body=typing.cast(
|
|
96
|
-
|
|
114
|
+
typing.Optional[typing.Any],
|
|
97
115
|
parse_obj_as(
|
|
98
|
-
type_=
|
|
116
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
99
117
|
object_=_response.json(),
|
|
100
118
|
),
|
|
101
119
|
),
|
|
@@ -111,6 +129,17 @@ class RawTracesClient:
|
|
|
111
129
|
),
|
|
112
130
|
),
|
|
113
131
|
)
|
|
132
|
+
if _response.status_code == 402:
|
|
133
|
+
raise PaymentRequiredError(
|
|
134
|
+
headers=dict(_response.headers),
|
|
135
|
+
body=typing.cast(
|
|
136
|
+
PlanLimitExceededError,
|
|
137
|
+
parse_obj_as(
|
|
138
|
+
type_=PlanLimitExceededError, # type: ignore
|
|
139
|
+
object_=_response.json(),
|
|
140
|
+
),
|
|
141
|
+
),
|
|
142
|
+
)
|
|
114
143
|
if _response.status_code == 403:
|
|
115
144
|
raise ForbiddenError(
|
|
116
145
|
headers=dict(_response.headers),
|
|
@@ -137,9 +166,20 @@ class RawTracesClient:
|
|
|
137
166
|
raise ConflictError(
|
|
138
167
|
headers=dict(_response.headers),
|
|
139
168
|
body=typing.cast(
|
|
140
|
-
|
|
169
|
+
typing.Optional[typing.Any],
|
|
170
|
+
parse_obj_as(
|
|
171
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
172
|
+
object_=_response.json(),
|
|
173
|
+
),
|
|
174
|
+
),
|
|
175
|
+
)
|
|
176
|
+
if _response.status_code == 429:
|
|
177
|
+
raise TooManyRequestsError(
|
|
178
|
+
headers=dict(_response.headers),
|
|
179
|
+
body=typing.cast(
|
|
180
|
+
RateLimitError,
|
|
141
181
|
parse_obj_as(
|
|
142
|
-
type_=
|
|
182
|
+
type_=RateLimitError, # type: ignore
|
|
143
183
|
object_=_response.json(),
|
|
144
184
|
),
|
|
145
185
|
),
|
|
@@ -155,6 +195,17 @@ class RawTracesClient:
|
|
|
155
195
|
),
|
|
156
196
|
),
|
|
157
197
|
)
|
|
198
|
+
if _response.status_code == 503:
|
|
199
|
+
raise ServiceUnavailableError(
|
|
200
|
+
headers=dict(_response.headers),
|
|
201
|
+
body=typing.cast(
|
|
202
|
+
typing.Optional[typing.Any],
|
|
203
|
+
parse_obj_as(
|
|
204
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
205
|
+
object_=_response.json(),
|
|
206
|
+
),
|
|
207
|
+
),
|
|
208
|
+
)
|
|
158
209
|
_response_json = _response.json()
|
|
159
210
|
except JSONDecodeError:
|
|
160
211
|
raise ApiError(
|
|
@@ -174,12 +225,16 @@ class RawTracesClient:
|
|
|
174
225
|
start_time: str,
|
|
175
226
|
end_time: str,
|
|
176
227
|
query: typing.Optional[str] = OMIT,
|
|
228
|
+
input_messages_query: typing.Optional[str] = OMIT,
|
|
229
|
+
output_messages_query: typing.Optional[str] = OMIT,
|
|
230
|
+
fuzzy_search: typing.Optional[bool] = OMIT,
|
|
177
231
|
trace_id: typing.Optional[str] = OMIT,
|
|
178
232
|
span_id: typing.Optional[str] = OMIT,
|
|
179
233
|
model: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
180
234
|
provider: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
181
235
|
function_id: typing.Optional[str] = OMIT,
|
|
182
236
|
function_name: typing.Optional[str] = OMIT,
|
|
237
|
+
span_name_prefix: typing.Optional[str] = OMIT,
|
|
183
238
|
has_error: typing.Optional[bool] = OMIT,
|
|
184
239
|
min_tokens: typing.Optional[float] = OMIT,
|
|
185
240
|
max_tokens: typing.Optional[float] = OMIT,
|
|
@@ -192,6 +247,7 @@ class RawTracesClient:
|
|
|
192
247
|
offset: typing.Optional[float] = OMIT,
|
|
193
248
|
sort_by: typing.Optional[TracesSearchRequestSortBy] = OMIT,
|
|
194
249
|
sort_order: typing.Optional[TracesSearchRequestSortOrder] = OMIT,
|
|
250
|
+
root_spans_only: typing.Optional[bool] = OMIT,
|
|
195
251
|
request_options: typing.Optional[RequestOptions] = None,
|
|
196
252
|
) -> HttpResponse[TracesSearchResponse]:
|
|
197
253
|
"""
|
|
@@ -203,6 +259,12 @@ class RawTracesClient:
|
|
|
203
259
|
|
|
204
260
|
query : typing.Optional[str]
|
|
205
261
|
|
|
262
|
+
input_messages_query : typing.Optional[str]
|
|
263
|
+
|
|
264
|
+
output_messages_query : typing.Optional[str]
|
|
265
|
+
|
|
266
|
+
fuzzy_search : typing.Optional[bool]
|
|
267
|
+
|
|
206
268
|
trace_id : typing.Optional[str]
|
|
207
269
|
|
|
208
270
|
span_id : typing.Optional[str]
|
|
@@ -215,6 +277,8 @@ class RawTracesClient:
|
|
|
215
277
|
|
|
216
278
|
function_name : typing.Optional[str]
|
|
217
279
|
|
|
280
|
+
span_name_prefix : typing.Optional[str]
|
|
281
|
+
|
|
218
282
|
has_error : typing.Optional[bool]
|
|
219
283
|
|
|
220
284
|
min_tokens : typing.Optional[float]
|
|
@@ -235,6 +299,8 @@ class RawTracesClient:
|
|
|
235
299
|
|
|
236
300
|
sort_order : typing.Optional[TracesSearchRequestSortOrder]
|
|
237
301
|
|
|
302
|
+
root_spans_only : typing.Optional[bool]
|
|
303
|
+
|
|
238
304
|
request_options : typing.Optional[RequestOptions]
|
|
239
305
|
Request-specific configuration.
|
|
240
306
|
|
|
@@ -250,12 +316,16 @@ class RawTracesClient:
|
|
|
250
316
|
"startTime": start_time,
|
|
251
317
|
"endTime": end_time,
|
|
252
318
|
"query": query,
|
|
319
|
+
"inputMessagesQuery": input_messages_query,
|
|
320
|
+
"outputMessagesQuery": output_messages_query,
|
|
321
|
+
"fuzzySearch": fuzzy_search,
|
|
253
322
|
"traceId": trace_id,
|
|
254
323
|
"spanId": span_id,
|
|
255
324
|
"model": model,
|
|
256
325
|
"provider": provider,
|
|
257
326
|
"functionId": function_id,
|
|
258
327
|
"functionName": function_name,
|
|
328
|
+
"spanNamePrefix": span_name_prefix,
|
|
259
329
|
"hasError": has_error,
|
|
260
330
|
"minTokens": min_tokens,
|
|
261
331
|
"maxTokens": max_tokens,
|
|
@@ -270,6 +340,7 @@ class RawTracesClient:
|
|
|
270
340
|
"offset": offset,
|
|
271
341
|
"sortBy": sort_by,
|
|
272
342
|
"sortOrder": sort_order,
|
|
343
|
+
"rootSpansOnly": root_spans_only,
|
|
273
344
|
},
|
|
274
345
|
headers={
|
|
275
346
|
"content-type": "application/json",
|
|
@@ -291,9 +362,9 @@ class RawTracesClient:
|
|
|
291
362
|
raise BadRequestError(
|
|
292
363
|
headers=dict(_response.headers),
|
|
293
364
|
body=typing.cast(
|
|
294
|
-
|
|
365
|
+
typing.Optional[typing.Any],
|
|
295
366
|
parse_obj_as(
|
|
296
|
-
type_=
|
|
367
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
297
368
|
object_=_response.json(),
|
|
298
369
|
),
|
|
299
370
|
),
|
|
@@ -320,6 +391,17 @@ class RawTracesClient:
|
|
|
320
391
|
),
|
|
321
392
|
),
|
|
322
393
|
)
|
|
394
|
+
if _response.status_code == 429:
|
|
395
|
+
raise TooManyRequestsError(
|
|
396
|
+
headers=dict(_response.headers),
|
|
397
|
+
body=typing.cast(
|
|
398
|
+
RateLimitError,
|
|
399
|
+
parse_obj_as(
|
|
400
|
+
type_=RateLimitError, # type: ignore
|
|
401
|
+
object_=_response.json(),
|
|
402
|
+
),
|
|
403
|
+
),
|
|
404
|
+
)
|
|
323
405
|
if _response.status_code == 500:
|
|
324
406
|
raise InternalServerError(
|
|
325
407
|
headers=dict(_response.headers),
|
|
@@ -331,6 +413,17 @@ class RawTracesClient:
|
|
|
331
413
|
),
|
|
332
414
|
),
|
|
333
415
|
)
|
|
416
|
+
if _response.status_code == 503:
|
|
417
|
+
raise ServiceUnavailableError(
|
|
418
|
+
headers=dict(_response.headers),
|
|
419
|
+
body=typing.cast(
|
|
420
|
+
typing.Optional[typing.Any],
|
|
421
|
+
parse_obj_as(
|
|
422
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
423
|
+
object_=_response.json(),
|
|
424
|
+
),
|
|
425
|
+
),
|
|
426
|
+
)
|
|
334
427
|
_response_json = _response.json()
|
|
335
428
|
except JSONDecodeError:
|
|
336
429
|
raise ApiError(
|
|
@@ -379,9 +472,9 @@ class RawTracesClient:
|
|
|
379
472
|
raise BadRequestError(
|
|
380
473
|
headers=dict(_response.headers),
|
|
381
474
|
body=typing.cast(
|
|
382
|
-
|
|
475
|
+
typing.Optional[typing.Any],
|
|
383
476
|
parse_obj_as(
|
|
384
|
-
type_=
|
|
477
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
385
478
|
object_=_response.json(),
|
|
386
479
|
),
|
|
387
480
|
),
|
|
@@ -419,6 +512,17 @@ class RawTracesClient:
|
|
|
419
512
|
),
|
|
420
513
|
),
|
|
421
514
|
)
|
|
515
|
+
if _response.status_code == 429:
|
|
516
|
+
raise TooManyRequestsError(
|
|
517
|
+
headers=dict(_response.headers),
|
|
518
|
+
body=typing.cast(
|
|
519
|
+
RateLimitError,
|
|
520
|
+
parse_obj_as(
|
|
521
|
+
type_=RateLimitError, # type: ignore
|
|
522
|
+
object_=_response.json(),
|
|
523
|
+
),
|
|
524
|
+
),
|
|
525
|
+
)
|
|
422
526
|
if _response.status_code == 500:
|
|
423
527
|
raise InternalServerError(
|
|
424
528
|
headers=dict(_response.headers),
|
|
@@ -430,6 +534,17 @@ class RawTracesClient:
|
|
|
430
534
|
),
|
|
431
535
|
),
|
|
432
536
|
)
|
|
537
|
+
if _response.status_code == 503:
|
|
538
|
+
raise ServiceUnavailableError(
|
|
539
|
+
headers=dict(_response.headers),
|
|
540
|
+
body=typing.cast(
|
|
541
|
+
typing.Optional[typing.Any],
|
|
542
|
+
parse_obj_as(
|
|
543
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
544
|
+
object_=_response.json(),
|
|
545
|
+
),
|
|
546
|
+
),
|
|
547
|
+
)
|
|
433
548
|
_response_json = _response.json()
|
|
434
549
|
except JSONDecodeError:
|
|
435
550
|
raise ApiError(
|
|
@@ -492,9 +607,9 @@ class RawTracesClient:
|
|
|
492
607
|
raise BadRequestError(
|
|
493
608
|
headers=dict(_response.headers),
|
|
494
609
|
body=typing.cast(
|
|
495
|
-
|
|
610
|
+
typing.Optional[typing.Any],
|
|
496
611
|
parse_obj_as(
|
|
497
|
-
type_=
|
|
612
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
498
613
|
object_=_response.json(),
|
|
499
614
|
),
|
|
500
615
|
),
|
|
@@ -521,6 +636,17 @@ class RawTracesClient:
|
|
|
521
636
|
),
|
|
522
637
|
),
|
|
523
638
|
)
|
|
639
|
+
if _response.status_code == 429:
|
|
640
|
+
raise TooManyRequestsError(
|
|
641
|
+
headers=dict(_response.headers),
|
|
642
|
+
body=typing.cast(
|
|
643
|
+
RateLimitError,
|
|
644
|
+
parse_obj_as(
|
|
645
|
+
type_=RateLimitError, # type: ignore
|
|
646
|
+
object_=_response.json(),
|
|
647
|
+
),
|
|
648
|
+
),
|
|
649
|
+
)
|
|
524
650
|
if _response.status_code == 500:
|
|
525
651
|
raise InternalServerError(
|
|
526
652
|
headers=dict(_response.headers),
|
|
@@ -532,6 +658,17 @@ class RawTracesClient:
|
|
|
532
658
|
),
|
|
533
659
|
),
|
|
534
660
|
)
|
|
661
|
+
if _response.status_code == 503:
|
|
662
|
+
raise ServiceUnavailableError(
|
|
663
|
+
headers=dict(_response.headers),
|
|
664
|
+
body=typing.cast(
|
|
665
|
+
typing.Optional[typing.Any],
|
|
666
|
+
parse_obj_as(
|
|
667
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
668
|
+
object_=_response.json(),
|
|
669
|
+
),
|
|
670
|
+
),
|
|
671
|
+
)
|
|
535
672
|
_response_json = _response.json()
|
|
536
673
|
except JSONDecodeError:
|
|
537
674
|
raise ApiError(
|
|
@@ -545,63 +682,57 @@ class RawTracesClient:
|
|
|
545
682
|
body=_response_json,
|
|
546
683
|
)
|
|
547
684
|
|
|
548
|
-
|
|
549
|
-
class AsyncRawTracesClient:
|
|
550
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
551
|
-
self._client_wrapper = client_wrapper
|
|
552
|
-
|
|
553
|
-
async def create(
|
|
685
|
+
def listbyfunctionhash(
|
|
554
686
|
self,
|
|
687
|
+
hash: str,
|
|
555
688
|
*,
|
|
556
|
-
|
|
689
|
+
limit: typing.Optional[NumberFromString] = None,
|
|
690
|
+
offset: typing.Optional[NumberFromString] = None,
|
|
557
691
|
request_options: typing.Optional[RequestOptions] = None,
|
|
558
|
-
) ->
|
|
692
|
+
) -> HttpResponse[TracesListByFunctionHashResponse]:
|
|
559
693
|
"""
|
|
560
694
|
Parameters
|
|
561
695
|
----------
|
|
562
|
-
|
|
696
|
+
hash : str
|
|
697
|
+
|
|
698
|
+
limit : typing.Optional[NumberFromString]
|
|
699
|
+
|
|
700
|
+
offset : typing.Optional[NumberFromString]
|
|
563
701
|
|
|
564
702
|
request_options : typing.Optional[RequestOptions]
|
|
565
703
|
Request-specific configuration.
|
|
566
704
|
|
|
567
705
|
Returns
|
|
568
706
|
-------
|
|
569
|
-
|
|
707
|
+
HttpResponse[TracesListByFunctionHashResponse]
|
|
570
708
|
Success
|
|
571
709
|
"""
|
|
572
|
-
_response =
|
|
573
|
-
"traces",
|
|
574
|
-
method="
|
|
575
|
-
|
|
576
|
-
"
|
|
577
|
-
|
|
578
|
-
annotation=typing.Sequence[TracesCreateRequestResourceSpansItem],
|
|
579
|
-
direction="write",
|
|
580
|
-
),
|
|
581
|
-
},
|
|
582
|
-
headers={
|
|
583
|
-
"content-type": "application/json",
|
|
710
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
711
|
+
f"traces/function/hash/{jsonable_encoder(hash)}",
|
|
712
|
+
method="GET",
|
|
713
|
+
params={
|
|
714
|
+
"limit": limit,
|
|
715
|
+
"offset": offset,
|
|
584
716
|
},
|
|
585
717
|
request_options=request_options,
|
|
586
|
-
omit=OMIT,
|
|
587
718
|
)
|
|
588
719
|
try:
|
|
589
720
|
if 200 <= _response.status_code < 300:
|
|
590
721
|
_data = typing.cast(
|
|
591
|
-
|
|
722
|
+
TracesListByFunctionHashResponse,
|
|
592
723
|
parse_obj_as(
|
|
593
|
-
type_=
|
|
724
|
+
type_=TracesListByFunctionHashResponse, # type: ignore
|
|
594
725
|
object_=_response.json(),
|
|
595
726
|
),
|
|
596
727
|
)
|
|
597
|
-
return
|
|
728
|
+
return HttpResponse(response=_response, data=_data)
|
|
598
729
|
if _response.status_code == 400:
|
|
599
730
|
raise BadRequestError(
|
|
600
731
|
headers=dict(_response.headers),
|
|
601
732
|
body=typing.cast(
|
|
602
|
-
|
|
733
|
+
typing.Optional[typing.Any],
|
|
603
734
|
parse_obj_as(
|
|
604
|
-
type_=
|
|
735
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
605
736
|
object_=_response.json(),
|
|
606
737
|
),
|
|
607
738
|
),
|
|
@@ -639,13 +770,13 @@ class AsyncRawTracesClient:
|
|
|
639
770
|
),
|
|
640
771
|
),
|
|
641
772
|
)
|
|
642
|
-
if _response.status_code ==
|
|
643
|
-
raise
|
|
773
|
+
if _response.status_code == 429:
|
|
774
|
+
raise TooManyRequestsError(
|
|
644
775
|
headers=dict(_response.headers),
|
|
645
776
|
body=typing.cast(
|
|
646
|
-
|
|
777
|
+
RateLimitError,
|
|
647
778
|
parse_obj_as(
|
|
648
|
-
type_=
|
|
779
|
+
type_=RateLimitError, # type: ignore
|
|
649
780
|
object_=_response.json(),
|
|
650
781
|
),
|
|
651
782
|
),
|
|
@@ -661,6 +792,17 @@ class AsyncRawTracesClient:
|
|
|
661
792
|
),
|
|
662
793
|
),
|
|
663
794
|
)
|
|
795
|
+
if _response.status_code == 503:
|
|
796
|
+
raise ServiceUnavailableError(
|
|
797
|
+
headers=dict(_response.headers),
|
|
798
|
+
body=typing.cast(
|
|
799
|
+
typing.Optional[typing.Any],
|
|
800
|
+
parse_obj_as(
|
|
801
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
802
|
+
object_=_response.json(),
|
|
803
|
+
),
|
|
804
|
+
),
|
|
805
|
+
)
|
|
664
806
|
_response_json = _response.json()
|
|
665
807
|
except JSONDecodeError:
|
|
666
808
|
raise ApiError(
|
|
@@ -674,41 +816,61 @@ class AsyncRawTracesClient:
|
|
|
674
816
|
body=_response_json,
|
|
675
817
|
)
|
|
676
818
|
|
|
677
|
-
|
|
819
|
+
def searchbyenv(
|
|
678
820
|
self,
|
|
821
|
+
organization_id: str,
|
|
822
|
+
project_id: str,
|
|
823
|
+
environment_id: str,
|
|
679
824
|
*,
|
|
680
825
|
start_time: str,
|
|
681
826
|
end_time: str,
|
|
682
827
|
query: typing.Optional[str] = OMIT,
|
|
828
|
+
input_messages_query: typing.Optional[str] = OMIT,
|
|
829
|
+
output_messages_query: typing.Optional[str] = OMIT,
|
|
830
|
+
fuzzy_search: typing.Optional[bool] = OMIT,
|
|
683
831
|
trace_id: typing.Optional[str] = OMIT,
|
|
684
832
|
span_id: typing.Optional[str] = OMIT,
|
|
685
833
|
model: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
686
834
|
provider: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
687
835
|
function_id: typing.Optional[str] = OMIT,
|
|
688
836
|
function_name: typing.Optional[str] = OMIT,
|
|
837
|
+
span_name_prefix: typing.Optional[str] = OMIT,
|
|
689
838
|
has_error: typing.Optional[bool] = OMIT,
|
|
690
839
|
min_tokens: typing.Optional[float] = OMIT,
|
|
691
840
|
max_tokens: typing.Optional[float] = OMIT,
|
|
692
841
|
min_duration: typing.Optional[float] = OMIT,
|
|
693
842
|
max_duration: typing.Optional[float] = OMIT,
|
|
694
843
|
attribute_filters: typing.Optional[
|
|
695
|
-
typing.Sequence[
|
|
844
|
+
typing.Sequence[TracesSearchByEnvRequestAttributeFiltersItem]
|
|
696
845
|
] = OMIT,
|
|
697
846
|
limit: typing.Optional[float] = OMIT,
|
|
698
847
|
offset: typing.Optional[float] = OMIT,
|
|
699
|
-
sort_by: typing.Optional[
|
|
700
|
-
sort_order: typing.Optional[
|
|
848
|
+
sort_by: typing.Optional[TracesSearchByEnvRequestSortBy] = OMIT,
|
|
849
|
+
sort_order: typing.Optional[TracesSearchByEnvRequestSortOrder] = OMIT,
|
|
850
|
+
root_spans_only: typing.Optional[bool] = OMIT,
|
|
701
851
|
request_options: typing.Optional[RequestOptions] = None,
|
|
702
|
-
) ->
|
|
852
|
+
) -> HttpResponse[TracesSearchByEnvResponse]:
|
|
703
853
|
"""
|
|
704
854
|
Parameters
|
|
705
855
|
----------
|
|
856
|
+
organization_id : str
|
|
857
|
+
|
|
858
|
+
project_id : str
|
|
859
|
+
|
|
860
|
+
environment_id : str
|
|
861
|
+
|
|
706
862
|
start_time : str
|
|
707
863
|
|
|
708
864
|
end_time : str
|
|
709
865
|
|
|
710
866
|
query : typing.Optional[str]
|
|
711
867
|
|
|
868
|
+
input_messages_query : typing.Optional[str]
|
|
869
|
+
|
|
870
|
+
output_messages_query : typing.Optional[str]
|
|
871
|
+
|
|
872
|
+
fuzzy_search : typing.Optional[bool]
|
|
873
|
+
|
|
712
874
|
trace_id : typing.Optional[str]
|
|
713
875
|
|
|
714
876
|
span_id : typing.Optional[str]
|
|
@@ -721,6 +883,8 @@ class AsyncRawTracesClient:
|
|
|
721
883
|
|
|
722
884
|
function_name : typing.Optional[str]
|
|
723
885
|
|
|
886
|
+
span_name_prefix : typing.Optional[str]
|
|
887
|
+
|
|
724
888
|
has_error : typing.Optional[bool]
|
|
725
889
|
|
|
726
890
|
min_tokens : typing.Optional[float]
|
|
@@ -731,37 +895,43 @@ class AsyncRawTracesClient:
|
|
|
731
895
|
|
|
732
896
|
max_duration : typing.Optional[float]
|
|
733
897
|
|
|
734
|
-
attribute_filters : typing.Optional[typing.Sequence[
|
|
898
|
+
attribute_filters : typing.Optional[typing.Sequence[TracesSearchByEnvRequestAttributeFiltersItem]]
|
|
735
899
|
|
|
736
900
|
limit : typing.Optional[float]
|
|
737
901
|
|
|
738
902
|
offset : typing.Optional[float]
|
|
739
903
|
|
|
740
|
-
sort_by : typing.Optional[
|
|
904
|
+
sort_by : typing.Optional[TracesSearchByEnvRequestSortBy]
|
|
741
905
|
|
|
742
|
-
sort_order : typing.Optional[
|
|
906
|
+
sort_order : typing.Optional[TracesSearchByEnvRequestSortOrder]
|
|
907
|
+
|
|
908
|
+
root_spans_only : typing.Optional[bool]
|
|
743
909
|
|
|
744
910
|
request_options : typing.Optional[RequestOptions]
|
|
745
911
|
Request-specific configuration.
|
|
746
912
|
|
|
747
913
|
Returns
|
|
748
914
|
-------
|
|
749
|
-
|
|
915
|
+
HttpResponse[TracesSearchByEnvResponse]
|
|
750
916
|
Success
|
|
751
917
|
"""
|
|
752
|
-
_response =
|
|
753
|
-
"traces/search",
|
|
918
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
919
|
+
f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/traces/search",
|
|
754
920
|
method="POST",
|
|
755
921
|
json={
|
|
756
922
|
"startTime": start_time,
|
|
757
923
|
"endTime": end_time,
|
|
758
924
|
"query": query,
|
|
925
|
+
"inputMessagesQuery": input_messages_query,
|
|
926
|
+
"outputMessagesQuery": output_messages_query,
|
|
927
|
+
"fuzzySearch": fuzzy_search,
|
|
759
928
|
"traceId": trace_id,
|
|
760
929
|
"spanId": span_id,
|
|
761
930
|
"model": model,
|
|
762
931
|
"provider": provider,
|
|
763
932
|
"functionId": function_id,
|
|
764
933
|
"functionName": function_name,
|
|
934
|
+
"spanNamePrefix": span_name_prefix,
|
|
765
935
|
"hasError": has_error,
|
|
766
936
|
"minTokens": min_tokens,
|
|
767
937
|
"maxTokens": max_tokens,
|
|
@@ -769,13 +939,16 @@ class AsyncRawTracesClient:
|
|
|
769
939
|
"maxDuration": max_duration,
|
|
770
940
|
"attributeFilters": convert_and_respect_annotation_metadata(
|
|
771
941
|
object_=attribute_filters,
|
|
772
|
-
annotation=typing.Sequence[
|
|
942
|
+
annotation=typing.Sequence[
|
|
943
|
+
TracesSearchByEnvRequestAttributeFiltersItem
|
|
944
|
+
],
|
|
773
945
|
direction="write",
|
|
774
946
|
),
|
|
775
947
|
"limit": limit,
|
|
776
948
|
"offset": offset,
|
|
777
949
|
"sortBy": sort_by,
|
|
778
950
|
"sortOrder": sort_order,
|
|
951
|
+
"rootSpansOnly": root_spans_only,
|
|
779
952
|
},
|
|
780
953
|
headers={
|
|
781
954
|
"content-type": "application/json",
|
|
@@ -786,20 +959,20 @@ class AsyncRawTracesClient:
|
|
|
786
959
|
try:
|
|
787
960
|
if 200 <= _response.status_code < 300:
|
|
788
961
|
_data = typing.cast(
|
|
789
|
-
|
|
962
|
+
TracesSearchByEnvResponse,
|
|
790
963
|
parse_obj_as(
|
|
791
|
-
type_=
|
|
964
|
+
type_=TracesSearchByEnvResponse, # type: ignore
|
|
792
965
|
object_=_response.json(),
|
|
793
966
|
),
|
|
794
967
|
)
|
|
795
|
-
return
|
|
968
|
+
return HttpResponse(response=_response, data=_data)
|
|
796
969
|
if _response.status_code == 400:
|
|
797
970
|
raise BadRequestError(
|
|
798
971
|
headers=dict(_response.headers),
|
|
799
972
|
body=typing.cast(
|
|
800
|
-
|
|
973
|
+
typing.Optional[typing.Any],
|
|
801
974
|
parse_obj_as(
|
|
802
|
-
type_=
|
|
975
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
803
976
|
object_=_response.json(),
|
|
804
977
|
),
|
|
805
978
|
),
|
|
@@ -826,6 +999,28 @@ class AsyncRawTracesClient:
|
|
|
826
999
|
),
|
|
827
1000
|
),
|
|
828
1001
|
)
|
|
1002
|
+
if _response.status_code == 404:
|
|
1003
|
+
raise NotFoundError(
|
|
1004
|
+
headers=dict(_response.headers),
|
|
1005
|
+
body=typing.cast(
|
|
1006
|
+
NotFoundErrorBody,
|
|
1007
|
+
parse_obj_as(
|
|
1008
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
1009
|
+
object_=_response.json(),
|
|
1010
|
+
),
|
|
1011
|
+
),
|
|
1012
|
+
)
|
|
1013
|
+
if _response.status_code == 429:
|
|
1014
|
+
raise TooManyRequestsError(
|
|
1015
|
+
headers=dict(_response.headers),
|
|
1016
|
+
body=typing.cast(
|
|
1017
|
+
RateLimitError,
|
|
1018
|
+
parse_obj_as(
|
|
1019
|
+
type_=RateLimitError, # type: ignore
|
|
1020
|
+
object_=_response.json(),
|
|
1021
|
+
),
|
|
1022
|
+
),
|
|
1023
|
+
)
|
|
829
1024
|
if _response.status_code == 500:
|
|
830
1025
|
raise InternalServerError(
|
|
831
1026
|
headers=dict(_response.headers),
|
|
@@ -837,6 +1032,17 @@ class AsyncRawTracesClient:
|
|
|
837
1032
|
),
|
|
838
1033
|
),
|
|
839
1034
|
)
|
|
1035
|
+
if _response.status_code == 503:
|
|
1036
|
+
raise ServiceUnavailableError(
|
|
1037
|
+
headers=dict(_response.headers),
|
|
1038
|
+
body=typing.cast(
|
|
1039
|
+
typing.Optional[typing.Any],
|
|
1040
|
+
parse_obj_as(
|
|
1041
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1042
|
+
object_=_response.json(),
|
|
1043
|
+
),
|
|
1044
|
+
),
|
|
1045
|
+
)
|
|
840
1046
|
_response_json = _response.json()
|
|
841
1047
|
except JSONDecodeError:
|
|
842
1048
|
raise ApiError(
|
|
@@ -850,12 +1056,24 @@ class AsyncRawTracesClient:
|
|
|
850
1056
|
body=_response_json,
|
|
851
1057
|
)
|
|
852
1058
|
|
|
853
|
-
|
|
854
|
-
self,
|
|
855
|
-
|
|
1059
|
+
def gettracedetailbyenv(
|
|
1060
|
+
self,
|
|
1061
|
+
organization_id: str,
|
|
1062
|
+
project_id: str,
|
|
1063
|
+
environment_id: str,
|
|
1064
|
+
trace_id: str,
|
|
1065
|
+
*,
|
|
1066
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1067
|
+
) -> HttpResponse[TracesGetTraceDetailByEnvResponse]:
|
|
856
1068
|
"""
|
|
857
1069
|
Parameters
|
|
858
1070
|
----------
|
|
1071
|
+
organization_id : str
|
|
1072
|
+
|
|
1073
|
+
project_id : str
|
|
1074
|
+
|
|
1075
|
+
environment_id : str
|
|
1076
|
+
|
|
859
1077
|
trace_id : str
|
|
860
1078
|
|
|
861
1079
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -863,31 +1081,31 @@ class AsyncRawTracesClient:
|
|
|
863
1081
|
|
|
864
1082
|
Returns
|
|
865
1083
|
-------
|
|
866
|
-
|
|
1084
|
+
HttpResponse[TracesGetTraceDetailByEnvResponse]
|
|
867
1085
|
Success
|
|
868
1086
|
"""
|
|
869
|
-
_response =
|
|
870
|
-
f"traces/{jsonable_encoder(trace_id)}",
|
|
1087
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1088
|
+
f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/traces/{jsonable_encoder(trace_id)}",
|
|
871
1089
|
method="GET",
|
|
872
1090
|
request_options=request_options,
|
|
873
1091
|
)
|
|
874
1092
|
try:
|
|
875
1093
|
if 200 <= _response.status_code < 300:
|
|
876
1094
|
_data = typing.cast(
|
|
877
|
-
|
|
1095
|
+
TracesGetTraceDetailByEnvResponse,
|
|
878
1096
|
parse_obj_as(
|
|
879
|
-
type_=
|
|
1097
|
+
type_=TracesGetTraceDetailByEnvResponse, # type: ignore
|
|
880
1098
|
object_=_response.json(),
|
|
881
1099
|
),
|
|
882
1100
|
)
|
|
883
|
-
return
|
|
1101
|
+
return HttpResponse(response=_response, data=_data)
|
|
884
1102
|
if _response.status_code == 400:
|
|
885
1103
|
raise BadRequestError(
|
|
886
1104
|
headers=dict(_response.headers),
|
|
887
1105
|
body=typing.cast(
|
|
888
|
-
|
|
1106
|
+
typing.Optional[typing.Any],
|
|
889
1107
|
parse_obj_as(
|
|
890
|
-
type_=
|
|
1108
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
891
1109
|
object_=_response.json(),
|
|
892
1110
|
),
|
|
893
1111
|
),
|
|
@@ -925,6 +1143,17 @@ class AsyncRawTracesClient:
|
|
|
925
1143
|
),
|
|
926
1144
|
),
|
|
927
1145
|
)
|
|
1146
|
+
if _response.status_code == 429:
|
|
1147
|
+
raise TooManyRequestsError(
|
|
1148
|
+
headers=dict(_response.headers),
|
|
1149
|
+
body=typing.cast(
|
|
1150
|
+
RateLimitError,
|
|
1151
|
+
parse_obj_as(
|
|
1152
|
+
type_=RateLimitError, # type: ignore
|
|
1153
|
+
object_=_response.json(),
|
|
1154
|
+
),
|
|
1155
|
+
),
|
|
1156
|
+
)
|
|
928
1157
|
if _response.status_code == 500:
|
|
929
1158
|
raise InternalServerError(
|
|
930
1159
|
headers=dict(_response.headers),
|
|
@@ -936,6 +1165,17 @@ class AsyncRawTracesClient:
|
|
|
936
1165
|
),
|
|
937
1166
|
),
|
|
938
1167
|
)
|
|
1168
|
+
if _response.status_code == 503:
|
|
1169
|
+
raise ServiceUnavailableError(
|
|
1170
|
+
headers=dict(_response.headers),
|
|
1171
|
+
body=typing.cast(
|
|
1172
|
+
typing.Optional[typing.Any],
|
|
1173
|
+
parse_obj_as(
|
|
1174
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1175
|
+
object_=_response.json(),
|
|
1176
|
+
),
|
|
1177
|
+
),
|
|
1178
|
+
)
|
|
939
1179
|
_response_json = _response.json()
|
|
940
1180
|
except JSONDecodeError:
|
|
941
1181
|
raise ApiError(
|
|
@@ -949,47 +1189,1044 @@ class AsyncRawTracesClient:
|
|
|
949
1189
|
body=_response_json,
|
|
950
1190
|
)
|
|
951
1191
|
|
|
952
|
-
|
|
1192
|
+
|
|
1193
|
+
class AsyncRawTracesClient:
|
|
1194
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
1195
|
+
self._client_wrapper = client_wrapper
|
|
1196
|
+
|
|
1197
|
+
async def create(
|
|
953
1198
|
self,
|
|
954
1199
|
*,
|
|
955
|
-
|
|
956
|
-
end_time: str,
|
|
957
|
-
function_id: typing.Optional[str] = None,
|
|
1200
|
+
resource_spans: typing.Sequence[TracesCreateRequestResourceSpansItem],
|
|
958
1201
|
request_options: typing.Optional[RequestOptions] = None,
|
|
959
|
-
) -> AsyncHttpResponse[
|
|
1202
|
+
) -> AsyncHttpResponse[TracesCreateResponse]:
|
|
960
1203
|
"""
|
|
961
1204
|
Parameters
|
|
962
1205
|
----------
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
end_time : str
|
|
966
|
-
|
|
967
|
-
function_id : typing.Optional[str]
|
|
1206
|
+
resource_spans : typing.Sequence[TracesCreateRequestResourceSpansItem]
|
|
968
1207
|
|
|
969
1208
|
request_options : typing.Optional[RequestOptions]
|
|
970
1209
|
Request-specific configuration.
|
|
971
1210
|
|
|
972
1211
|
Returns
|
|
973
1212
|
-------
|
|
974
|
-
AsyncHttpResponse[
|
|
1213
|
+
AsyncHttpResponse[TracesCreateResponse]
|
|
975
1214
|
Success
|
|
976
1215
|
"""
|
|
977
1216
|
_response = await self._client_wrapper.httpx_client.request(
|
|
978
|
-
"traces
|
|
979
|
-
method="
|
|
980
|
-
|
|
981
|
-
"
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1217
|
+
"traces",
|
|
1218
|
+
method="POST",
|
|
1219
|
+
json={
|
|
1220
|
+
"resourceSpans": convert_and_respect_annotation_metadata(
|
|
1221
|
+
object_=resource_spans,
|
|
1222
|
+
annotation=typing.Sequence[TracesCreateRequestResourceSpansItem],
|
|
1223
|
+
direction="write",
|
|
1224
|
+
),
|
|
1225
|
+
},
|
|
1226
|
+
headers={
|
|
1227
|
+
"content-type": "application/json",
|
|
1228
|
+
},
|
|
1229
|
+
request_options=request_options,
|
|
1230
|
+
omit=OMIT,
|
|
1231
|
+
)
|
|
1232
|
+
try:
|
|
1233
|
+
if 200 <= _response.status_code < 300:
|
|
1234
|
+
_data = typing.cast(
|
|
1235
|
+
TracesCreateResponse,
|
|
1236
|
+
parse_obj_as(
|
|
1237
|
+
type_=TracesCreateResponse, # type: ignore
|
|
1238
|
+
object_=_response.json(),
|
|
1239
|
+
),
|
|
1240
|
+
)
|
|
1241
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1242
|
+
if _response.status_code == 400:
|
|
1243
|
+
raise BadRequestError(
|
|
1244
|
+
headers=dict(_response.headers),
|
|
1245
|
+
body=typing.cast(
|
|
1246
|
+
typing.Optional[typing.Any],
|
|
1247
|
+
parse_obj_as(
|
|
1248
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1249
|
+
object_=_response.json(),
|
|
1250
|
+
),
|
|
1251
|
+
),
|
|
1252
|
+
)
|
|
1253
|
+
if _response.status_code == 401:
|
|
1254
|
+
raise UnauthorizedError(
|
|
1255
|
+
headers=dict(_response.headers),
|
|
1256
|
+
body=typing.cast(
|
|
1257
|
+
UnauthorizedErrorBody,
|
|
1258
|
+
parse_obj_as(
|
|
1259
|
+
type_=UnauthorizedErrorBody, # type: ignore
|
|
1260
|
+
object_=_response.json(),
|
|
1261
|
+
),
|
|
1262
|
+
),
|
|
1263
|
+
)
|
|
1264
|
+
if _response.status_code == 402:
|
|
1265
|
+
raise PaymentRequiredError(
|
|
1266
|
+
headers=dict(_response.headers),
|
|
1267
|
+
body=typing.cast(
|
|
1268
|
+
PlanLimitExceededError,
|
|
1269
|
+
parse_obj_as(
|
|
1270
|
+
type_=PlanLimitExceededError, # type: ignore
|
|
1271
|
+
object_=_response.json(),
|
|
1272
|
+
),
|
|
1273
|
+
),
|
|
1274
|
+
)
|
|
1275
|
+
if _response.status_code == 403:
|
|
1276
|
+
raise ForbiddenError(
|
|
1277
|
+
headers=dict(_response.headers),
|
|
1278
|
+
body=typing.cast(
|
|
1279
|
+
PermissionDeniedError,
|
|
1280
|
+
parse_obj_as(
|
|
1281
|
+
type_=PermissionDeniedError, # type: ignore
|
|
1282
|
+
object_=_response.json(),
|
|
1283
|
+
),
|
|
1284
|
+
),
|
|
1285
|
+
)
|
|
1286
|
+
if _response.status_code == 404:
|
|
1287
|
+
raise NotFoundError(
|
|
1288
|
+
headers=dict(_response.headers),
|
|
1289
|
+
body=typing.cast(
|
|
1290
|
+
NotFoundErrorBody,
|
|
1291
|
+
parse_obj_as(
|
|
1292
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
1293
|
+
object_=_response.json(),
|
|
1294
|
+
),
|
|
1295
|
+
),
|
|
1296
|
+
)
|
|
1297
|
+
if _response.status_code == 409:
|
|
1298
|
+
raise ConflictError(
|
|
1299
|
+
headers=dict(_response.headers),
|
|
1300
|
+
body=typing.cast(
|
|
1301
|
+
typing.Optional[typing.Any],
|
|
1302
|
+
parse_obj_as(
|
|
1303
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1304
|
+
object_=_response.json(),
|
|
1305
|
+
),
|
|
1306
|
+
),
|
|
1307
|
+
)
|
|
1308
|
+
if _response.status_code == 429:
|
|
1309
|
+
raise TooManyRequestsError(
|
|
1310
|
+
headers=dict(_response.headers),
|
|
1311
|
+
body=typing.cast(
|
|
1312
|
+
RateLimitError,
|
|
1313
|
+
parse_obj_as(
|
|
1314
|
+
type_=RateLimitError, # type: ignore
|
|
1315
|
+
object_=_response.json(),
|
|
1316
|
+
),
|
|
1317
|
+
),
|
|
1318
|
+
)
|
|
1319
|
+
if _response.status_code == 500:
|
|
1320
|
+
raise InternalServerError(
|
|
1321
|
+
headers=dict(_response.headers),
|
|
1322
|
+
body=typing.cast(
|
|
1323
|
+
typing.Optional[typing.Any],
|
|
1324
|
+
parse_obj_as(
|
|
1325
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1326
|
+
object_=_response.json(),
|
|
1327
|
+
),
|
|
1328
|
+
),
|
|
1329
|
+
)
|
|
1330
|
+
if _response.status_code == 503:
|
|
1331
|
+
raise ServiceUnavailableError(
|
|
1332
|
+
headers=dict(_response.headers),
|
|
1333
|
+
body=typing.cast(
|
|
1334
|
+
typing.Optional[typing.Any],
|
|
1335
|
+
parse_obj_as(
|
|
1336
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1337
|
+
object_=_response.json(),
|
|
1338
|
+
),
|
|
1339
|
+
),
|
|
1340
|
+
)
|
|
1341
|
+
_response_json = _response.json()
|
|
1342
|
+
except JSONDecodeError:
|
|
1343
|
+
raise ApiError(
|
|
1344
|
+
status_code=_response.status_code,
|
|
1345
|
+
headers=dict(_response.headers),
|
|
1346
|
+
body=_response.text,
|
|
1347
|
+
)
|
|
1348
|
+
raise ApiError(
|
|
1349
|
+
status_code=_response.status_code,
|
|
1350
|
+
headers=dict(_response.headers),
|
|
1351
|
+
body=_response_json,
|
|
1352
|
+
)
|
|
1353
|
+
|
|
1354
|
+
async def search(
|
|
1355
|
+
self,
|
|
1356
|
+
*,
|
|
1357
|
+
start_time: str,
|
|
1358
|
+
end_time: str,
|
|
1359
|
+
query: typing.Optional[str] = OMIT,
|
|
1360
|
+
input_messages_query: typing.Optional[str] = OMIT,
|
|
1361
|
+
output_messages_query: typing.Optional[str] = OMIT,
|
|
1362
|
+
fuzzy_search: typing.Optional[bool] = OMIT,
|
|
1363
|
+
trace_id: typing.Optional[str] = OMIT,
|
|
1364
|
+
span_id: typing.Optional[str] = OMIT,
|
|
1365
|
+
model: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1366
|
+
provider: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1367
|
+
function_id: typing.Optional[str] = OMIT,
|
|
1368
|
+
function_name: typing.Optional[str] = OMIT,
|
|
1369
|
+
span_name_prefix: typing.Optional[str] = OMIT,
|
|
1370
|
+
has_error: typing.Optional[bool] = OMIT,
|
|
1371
|
+
min_tokens: typing.Optional[float] = OMIT,
|
|
1372
|
+
max_tokens: typing.Optional[float] = OMIT,
|
|
1373
|
+
min_duration: typing.Optional[float] = OMIT,
|
|
1374
|
+
max_duration: typing.Optional[float] = OMIT,
|
|
1375
|
+
attribute_filters: typing.Optional[
|
|
1376
|
+
typing.Sequence[TracesSearchRequestAttributeFiltersItem]
|
|
1377
|
+
] = OMIT,
|
|
1378
|
+
limit: typing.Optional[float] = OMIT,
|
|
1379
|
+
offset: typing.Optional[float] = OMIT,
|
|
1380
|
+
sort_by: typing.Optional[TracesSearchRequestSortBy] = OMIT,
|
|
1381
|
+
sort_order: typing.Optional[TracesSearchRequestSortOrder] = OMIT,
|
|
1382
|
+
root_spans_only: typing.Optional[bool] = OMIT,
|
|
1383
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1384
|
+
) -> AsyncHttpResponse[TracesSearchResponse]:
|
|
1385
|
+
"""
|
|
1386
|
+
Parameters
|
|
1387
|
+
----------
|
|
1388
|
+
start_time : str
|
|
1389
|
+
|
|
1390
|
+
end_time : str
|
|
1391
|
+
|
|
1392
|
+
query : typing.Optional[str]
|
|
1393
|
+
|
|
1394
|
+
input_messages_query : typing.Optional[str]
|
|
1395
|
+
|
|
1396
|
+
output_messages_query : typing.Optional[str]
|
|
1397
|
+
|
|
1398
|
+
fuzzy_search : typing.Optional[bool]
|
|
1399
|
+
|
|
1400
|
+
trace_id : typing.Optional[str]
|
|
1401
|
+
|
|
1402
|
+
span_id : typing.Optional[str]
|
|
1403
|
+
|
|
1404
|
+
model : typing.Optional[typing.Sequence[str]]
|
|
1405
|
+
|
|
1406
|
+
provider : typing.Optional[typing.Sequence[str]]
|
|
1407
|
+
|
|
1408
|
+
function_id : typing.Optional[str]
|
|
1409
|
+
|
|
1410
|
+
function_name : typing.Optional[str]
|
|
1411
|
+
|
|
1412
|
+
span_name_prefix : typing.Optional[str]
|
|
1413
|
+
|
|
1414
|
+
has_error : typing.Optional[bool]
|
|
1415
|
+
|
|
1416
|
+
min_tokens : typing.Optional[float]
|
|
1417
|
+
|
|
1418
|
+
max_tokens : typing.Optional[float]
|
|
1419
|
+
|
|
1420
|
+
min_duration : typing.Optional[float]
|
|
1421
|
+
|
|
1422
|
+
max_duration : typing.Optional[float]
|
|
1423
|
+
|
|
1424
|
+
attribute_filters : typing.Optional[typing.Sequence[TracesSearchRequestAttributeFiltersItem]]
|
|
1425
|
+
|
|
1426
|
+
limit : typing.Optional[float]
|
|
1427
|
+
|
|
1428
|
+
offset : typing.Optional[float]
|
|
1429
|
+
|
|
1430
|
+
sort_by : typing.Optional[TracesSearchRequestSortBy]
|
|
1431
|
+
|
|
1432
|
+
sort_order : typing.Optional[TracesSearchRequestSortOrder]
|
|
1433
|
+
|
|
1434
|
+
root_spans_only : typing.Optional[bool]
|
|
1435
|
+
|
|
1436
|
+
request_options : typing.Optional[RequestOptions]
|
|
1437
|
+
Request-specific configuration.
|
|
1438
|
+
|
|
1439
|
+
Returns
|
|
1440
|
+
-------
|
|
1441
|
+
AsyncHttpResponse[TracesSearchResponse]
|
|
1442
|
+
Success
|
|
1443
|
+
"""
|
|
1444
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1445
|
+
"traces/search",
|
|
1446
|
+
method="POST",
|
|
1447
|
+
json={
|
|
1448
|
+
"startTime": start_time,
|
|
1449
|
+
"endTime": end_time,
|
|
1450
|
+
"query": query,
|
|
1451
|
+
"inputMessagesQuery": input_messages_query,
|
|
1452
|
+
"outputMessagesQuery": output_messages_query,
|
|
1453
|
+
"fuzzySearch": fuzzy_search,
|
|
1454
|
+
"traceId": trace_id,
|
|
1455
|
+
"spanId": span_id,
|
|
1456
|
+
"model": model,
|
|
1457
|
+
"provider": provider,
|
|
1458
|
+
"functionId": function_id,
|
|
1459
|
+
"functionName": function_name,
|
|
1460
|
+
"spanNamePrefix": span_name_prefix,
|
|
1461
|
+
"hasError": has_error,
|
|
1462
|
+
"minTokens": min_tokens,
|
|
1463
|
+
"maxTokens": max_tokens,
|
|
1464
|
+
"minDuration": min_duration,
|
|
1465
|
+
"maxDuration": max_duration,
|
|
1466
|
+
"attributeFilters": convert_and_respect_annotation_metadata(
|
|
1467
|
+
object_=attribute_filters,
|
|
1468
|
+
annotation=typing.Sequence[TracesSearchRequestAttributeFiltersItem],
|
|
1469
|
+
direction="write",
|
|
1470
|
+
),
|
|
1471
|
+
"limit": limit,
|
|
1472
|
+
"offset": offset,
|
|
1473
|
+
"sortBy": sort_by,
|
|
1474
|
+
"sortOrder": sort_order,
|
|
1475
|
+
"rootSpansOnly": root_spans_only,
|
|
1476
|
+
},
|
|
1477
|
+
headers={
|
|
1478
|
+
"content-type": "application/json",
|
|
1479
|
+
},
|
|
1480
|
+
request_options=request_options,
|
|
1481
|
+
omit=OMIT,
|
|
1482
|
+
)
|
|
1483
|
+
try:
|
|
1484
|
+
if 200 <= _response.status_code < 300:
|
|
1485
|
+
_data = typing.cast(
|
|
1486
|
+
TracesSearchResponse,
|
|
1487
|
+
parse_obj_as(
|
|
1488
|
+
type_=TracesSearchResponse, # type: ignore
|
|
1489
|
+
object_=_response.json(),
|
|
1490
|
+
),
|
|
1491
|
+
)
|
|
1492
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1493
|
+
if _response.status_code == 400:
|
|
1494
|
+
raise BadRequestError(
|
|
1495
|
+
headers=dict(_response.headers),
|
|
1496
|
+
body=typing.cast(
|
|
1497
|
+
typing.Optional[typing.Any],
|
|
1498
|
+
parse_obj_as(
|
|
1499
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1500
|
+
object_=_response.json(),
|
|
1501
|
+
),
|
|
1502
|
+
),
|
|
1503
|
+
)
|
|
1504
|
+
if _response.status_code == 401:
|
|
1505
|
+
raise UnauthorizedError(
|
|
1506
|
+
headers=dict(_response.headers),
|
|
1507
|
+
body=typing.cast(
|
|
1508
|
+
UnauthorizedErrorBody,
|
|
1509
|
+
parse_obj_as(
|
|
1510
|
+
type_=UnauthorizedErrorBody, # type: ignore
|
|
1511
|
+
object_=_response.json(),
|
|
1512
|
+
),
|
|
1513
|
+
),
|
|
1514
|
+
)
|
|
1515
|
+
if _response.status_code == 403:
|
|
1516
|
+
raise ForbiddenError(
|
|
1517
|
+
headers=dict(_response.headers),
|
|
1518
|
+
body=typing.cast(
|
|
1519
|
+
PermissionDeniedError,
|
|
1520
|
+
parse_obj_as(
|
|
1521
|
+
type_=PermissionDeniedError, # type: ignore
|
|
1522
|
+
object_=_response.json(),
|
|
1523
|
+
),
|
|
1524
|
+
),
|
|
1525
|
+
)
|
|
1526
|
+
if _response.status_code == 429:
|
|
1527
|
+
raise TooManyRequestsError(
|
|
1528
|
+
headers=dict(_response.headers),
|
|
1529
|
+
body=typing.cast(
|
|
1530
|
+
RateLimitError,
|
|
1531
|
+
parse_obj_as(
|
|
1532
|
+
type_=RateLimitError, # type: ignore
|
|
1533
|
+
object_=_response.json(),
|
|
1534
|
+
),
|
|
1535
|
+
),
|
|
1536
|
+
)
|
|
1537
|
+
if _response.status_code == 500:
|
|
1538
|
+
raise InternalServerError(
|
|
1539
|
+
headers=dict(_response.headers),
|
|
1540
|
+
body=typing.cast(
|
|
1541
|
+
typing.Optional[typing.Any],
|
|
1542
|
+
parse_obj_as(
|
|
1543
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1544
|
+
object_=_response.json(),
|
|
1545
|
+
),
|
|
1546
|
+
),
|
|
1547
|
+
)
|
|
1548
|
+
if _response.status_code == 503:
|
|
1549
|
+
raise ServiceUnavailableError(
|
|
1550
|
+
headers=dict(_response.headers),
|
|
1551
|
+
body=typing.cast(
|
|
1552
|
+
typing.Optional[typing.Any],
|
|
1553
|
+
parse_obj_as(
|
|
1554
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1555
|
+
object_=_response.json(),
|
|
1556
|
+
),
|
|
1557
|
+
),
|
|
1558
|
+
)
|
|
1559
|
+
_response_json = _response.json()
|
|
1560
|
+
except JSONDecodeError:
|
|
1561
|
+
raise ApiError(
|
|
1562
|
+
status_code=_response.status_code,
|
|
1563
|
+
headers=dict(_response.headers),
|
|
1564
|
+
body=_response.text,
|
|
1565
|
+
)
|
|
1566
|
+
raise ApiError(
|
|
1567
|
+
status_code=_response.status_code,
|
|
1568
|
+
headers=dict(_response.headers),
|
|
1569
|
+
body=_response_json,
|
|
1570
|
+
)
|
|
1571
|
+
|
|
1572
|
+
async def gettracedetail(
|
|
1573
|
+
self, trace_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1574
|
+
) -> AsyncHttpResponse[TracesGetTraceDetailResponse]:
|
|
1575
|
+
"""
|
|
1576
|
+
Parameters
|
|
1577
|
+
----------
|
|
1578
|
+
trace_id : str
|
|
1579
|
+
|
|
1580
|
+
request_options : typing.Optional[RequestOptions]
|
|
1581
|
+
Request-specific configuration.
|
|
1582
|
+
|
|
1583
|
+
Returns
|
|
1584
|
+
-------
|
|
1585
|
+
AsyncHttpResponse[TracesGetTraceDetailResponse]
|
|
1586
|
+
Success
|
|
1587
|
+
"""
|
|
1588
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1589
|
+
f"traces/{jsonable_encoder(trace_id)}",
|
|
1590
|
+
method="GET",
|
|
1591
|
+
request_options=request_options,
|
|
1592
|
+
)
|
|
1593
|
+
try:
|
|
1594
|
+
if 200 <= _response.status_code < 300:
|
|
1595
|
+
_data = typing.cast(
|
|
1596
|
+
TracesGetTraceDetailResponse,
|
|
1597
|
+
parse_obj_as(
|
|
1598
|
+
type_=TracesGetTraceDetailResponse, # type: ignore
|
|
1599
|
+
object_=_response.json(),
|
|
1600
|
+
),
|
|
1601
|
+
)
|
|
1602
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1603
|
+
if _response.status_code == 400:
|
|
1604
|
+
raise BadRequestError(
|
|
1605
|
+
headers=dict(_response.headers),
|
|
1606
|
+
body=typing.cast(
|
|
1607
|
+
typing.Optional[typing.Any],
|
|
1608
|
+
parse_obj_as(
|
|
1609
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1610
|
+
object_=_response.json(),
|
|
1611
|
+
),
|
|
1612
|
+
),
|
|
1613
|
+
)
|
|
1614
|
+
if _response.status_code == 401:
|
|
1615
|
+
raise UnauthorizedError(
|
|
1616
|
+
headers=dict(_response.headers),
|
|
1617
|
+
body=typing.cast(
|
|
1618
|
+
UnauthorizedErrorBody,
|
|
1619
|
+
parse_obj_as(
|
|
1620
|
+
type_=UnauthorizedErrorBody, # type: ignore
|
|
1621
|
+
object_=_response.json(),
|
|
1622
|
+
),
|
|
1623
|
+
),
|
|
1624
|
+
)
|
|
1625
|
+
if _response.status_code == 403:
|
|
1626
|
+
raise ForbiddenError(
|
|
1627
|
+
headers=dict(_response.headers),
|
|
1628
|
+
body=typing.cast(
|
|
1629
|
+
PermissionDeniedError,
|
|
1630
|
+
parse_obj_as(
|
|
1631
|
+
type_=PermissionDeniedError, # type: ignore
|
|
1632
|
+
object_=_response.json(),
|
|
1633
|
+
),
|
|
1634
|
+
),
|
|
1635
|
+
)
|
|
1636
|
+
if _response.status_code == 404:
|
|
1637
|
+
raise NotFoundError(
|
|
1638
|
+
headers=dict(_response.headers),
|
|
1639
|
+
body=typing.cast(
|
|
1640
|
+
NotFoundErrorBody,
|
|
1641
|
+
parse_obj_as(
|
|
1642
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
1643
|
+
object_=_response.json(),
|
|
1644
|
+
),
|
|
1645
|
+
),
|
|
1646
|
+
)
|
|
1647
|
+
if _response.status_code == 429:
|
|
1648
|
+
raise TooManyRequestsError(
|
|
1649
|
+
headers=dict(_response.headers),
|
|
1650
|
+
body=typing.cast(
|
|
1651
|
+
RateLimitError,
|
|
1652
|
+
parse_obj_as(
|
|
1653
|
+
type_=RateLimitError, # type: ignore
|
|
1654
|
+
object_=_response.json(),
|
|
1655
|
+
),
|
|
1656
|
+
),
|
|
1657
|
+
)
|
|
1658
|
+
if _response.status_code == 500:
|
|
1659
|
+
raise InternalServerError(
|
|
1660
|
+
headers=dict(_response.headers),
|
|
1661
|
+
body=typing.cast(
|
|
1662
|
+
typing.Optional[typing.Any],
|
|
1663
|
+
parse_obj_as(
|
|
1664
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1665
|
+
object_=_response.json(),
|
|
1666
|
+
),
|
|
1667
|
+
),
|
|
1668
|
+
)
|
|
1669
|
+
if _response.status_code == 503:
|
|
1670
|
+
raise ServiceUnavailableError(
|
|
1671
|
+
headers=dict(_response.headers),
|
|
1672
|
+
body=typing.cast(
|
|
1673
|
+
typing.Optional[typing.Any],
|
|
1674
|
+
parse_obj_as(
|
|
1675
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1676
|
+
object_=_response.json(),
|
|
1677
|
+
),
|
|
1678
|
+
),
|
|
1679
|
+
)
|
|
1680
|
+
_response_json = _response.json()
|
|
1681
|
+
except JSONDecodeError:
|
|
1682
|
+
raise ApiError(
|
|
1683
|
+
status_code=_response.status_code,
|
|
1684
|
+
headers=dict(_response.headers),
|
|
1685
|
+
body=_response.text,
|
|
1686
|
+
)
|
|
1687
|
+
raise ApiError(
|
|
1688
|
+
status_code=_response.status_code,
|
|
1689
|
+
headers=dict(_response.headers),
|
|
1690
|
+
body=_response_json,
|
|
1691
|
+
)
|
|
1692
|
+
|
|
1693
|
+
async def getanalyticssummary(
|
|
1694
|
+
self,
|
|
1695
|
+
*,
|
|
1696
|
+
start_time: str,
|
|
1697
|
+
end_time: str,
|
|
1698
|
+
function_id: typing.Optional[str] = None,
|
|
1699
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1700
|
+
) -> AsyncHttpResponse[TracesGetAnalyticsSummaryResponse]:
|
|
1701
|
+
"""
|
|
1702
|
+
Parameters
|
|
1703
|
+
----------
|
|
1704
|
+
start_time : str
|
|
1705
|
+
|
|
1706
|
+
end_time : str
|
|
1707
|
+
|
|
1708
|
+
function_id : typing.Optional[str]
|
|
1709
|
+
|
|
1710
|
+
request_options : typing.Optional[RequestOptions]
|
|
1711
|
+
Request-specific configuration.
|
|
1712
|
+
|
|
1713
|
+
Returns
|
|
1714
|
+
-------
|
|
1715
|
+
AsyncHttpResponse[TracesGetAnalyticsSummaryResponse]
|
|
1716
|
+
Success
|
|
1717
|
+
"""
|
|
1718
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1719
|
+
"traces/analytics",
|
|
1720
|
+
method="GET",
|
|
1721
|
+
params={
|
|
1722
|
+
"startTime": start_time,
|
|
1723
|
+
"endTime": end_time,
|
|
1724
|
+
"functionId": function_id,
|
|
1725
|
+
},
|
|
1726
|
+
request_options=request_options,
|
|
1727
|
+
)
|
|
1728
|
+
try:
|
|
1729
|
+
if 200 <= _response.status_code < 300:
|
|
1730
|
+
_data = typing.cast(
|
|
1731
|
+
TracesGetAnalyticsSummaryResponse,
|
|
1732
|
+
parse_obj_as(
|
|
1733
|
+
type_=TracesGetAnalyticsSummaryResponse, # type: ignore
|
|
1734
|
+
object_=_response.json(),
|
|
1735
|
+
),
|
|
1736
|
+
)
|
|
1737
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1738
|
+
if _response.status_code == 400:
|
|
1739
|
+
raise BadRequestError(
|
|
1740
|
+
headers=dict(_response.headers),
|
|
1741
|
+
body=typing.cast(
|
|
1742
|
+
typing.Optional[typing.Any],
|
|
1743
|
+
parse_obj_as(
|
|
1744
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1745
|
+
object_=_response.json(),
|
|
1746
|
+
),
|
|
1747
|
+
),
|
|
1748
|
+
)
|
|
1749
|
+
if _response.status_code == 401:
|
|
1750
|
+
raise UnauthorizedError(
|
|
1751
|
+
headers=dict(_response.headers),
|
|
1752
|
+
body=typing.cast(
|
|
1753
|
+
UnauthorizedErrorBody,
|
|
1754
|
+
parse_obj_as(
|
|
1755
|
+
type_=UnauthorizedErrorBody, # type: ignore
|
|
1756
|
+
object_=_response.json(),
|
|
1757
|
+
),
|
|
1758
|
+
),
|
|
1759
|
+
)
|
|
1760
|
+
if _response.status_code == 403:
|
|
1761
|
+
raise ForbiddenError(
|
|
1762
|
+
headers=dict(_response.headers),
|
|
1763
|
+
body=typing.cast(
|
|
1764
|
+
PermissionDeniedError,
|
|
1765
|
+
parse_obj_as(
|
|
1766
|
+
type_=PermissionDeniedError, # type: ignore
|
|
1767
|
+
object_=_response.json(),
|
|
1768
|
+
),
|
|
1769
|
+
),
|
|
1770
|
+
)
|
|
1771
|
+
if _response.status_code == 429:
|
|
1772
|
+
raise TooManyRequestsError(
|
|
1773
|
+
headers=dict(_response.headers),
|
|
1774
|
+
body=typing.cast(
|
|
1775
|
+
RateLimitError,
|
|
1776
|
+
parse_obj_as(
|
|
1777
|
+
type_=RateLimitError, # type: ignore
|
|
1778
|
+
object_=_response.json(),
|
|
1779
|
+
),
|
|
1780
|
+
),
|
|
1781
|
+
)
|
|
1782
|
+
if _response.status_code == 500:
|
|
1783
|
+
raise InternalServerError(
|
|
1784
|
+
headers=dict(_response.headers),
|
|
1785
|
+
body=typing.cast(
|
|
1786
|
+
typing.Optional[typing.Any],
|
|
1787
|
+
parse_obj_as(
|
|
1788
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1789
|
+
object_=_response.json(),
|
|
1790
|
+
),
|
|
1791
|
+
),
|
|
1792
|
+
)
|
|
1793
|
+
if _response.status_code == 503:
|
|
1794
|
+
raise ServiceUnavailableError(
|
|
1795
|
+
headers=dict(_response.headers),
|
|
1796
|
+
body=typing.cast(
|
|
1797
|
+
typing.Optional[typing.Any],
|
|
1798
|
+
parse_obj_as(
|
|
1799
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1800
|
+
object_=_response.json(),
|
|
1801
|
+
),
|
|
1802
|
+
),
|
|
1803
|
+
)
|
|
1804
|
+
_response_json = _response.json()
|
|
1805
|
+
except JSONDecodeError:
|
|
1806
|
+
raise ApiError(
|
|
1807
|
+
status_code=_response.status_code,
|
|
1808
|
+
headers=dict(_response.headers),
|
|
1809
|
+
body=_response.text,
|
|
1810
|
+
)
|
|
1811
|
+
raise ApiError(
|
|
1812
|
+
status_code=_response.status_code,
|
|
1813
|
+
headers=dict(_response.headers),
|
|
1814
|
+
body=_response_json,
|
|
1815
|
+
)
|
|
1816
|
+
|
|
1817
|
+
async def listbyfunctionhash(
|
|
1818
|
+
self,
|
|
1819
|
+
hash: str,
|
|
1820
|
+
*,
|
|
1821
|
+
limit: typing.Optional[NumberFromString] = None,
|
|
1822
|
+
offset: typing.Optional[NumberFromString] = None,
|
|
1823
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1824
|
+
) -> AsyncHttpResponse[TracesListByFunctionHashResponse]:
|
|
1825
|
+
"""
|
|
1826
|
+
Parameters
|
|
1827
|
+
----------
|
|
1828
|
+
hash : str
|
|
1829
|
+
|
|
1830
|
+
limit : typing.Optional[NumberFromString]
|
|
1831
|
+
|
|
1832
|
+
offset : typing.Optional[NumberFromString]
|
|
1833
|
+
|
|
1834
|
+
request_options : typing.Optional[RequestOptions]
|
|
1835
|
+
Request-specific configuration.
|
|
1836
|
+
|
|
1837
|
+
Returns
|
|
1838
|
+
-------
|
|
1839
|
+
AsyncHttpResponse[TracesListByFunctionHashResponse]
|
|
1840
|
+
Success
|
|
1841
|
+
"""
|
|
1842
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1843
|
+
f"traces/function/hash/{jsonable_encoder(hash)}",
|
|
1844
|
+
method="GET",
|
|
1845
|
+
params={
|
|
1846
|
+
"limit": limit,
|
|
1847
|
+
"offset": offset,
|
|
1848
|
+
},
|
|
1849
|
+
request_options=request_options,
|
|
1850
|
+
)
|
|
1851
|
+
try:
|
|
1852
|
+
if 200 <= _response.status_code < 300:
|
|
1853
|
+
_data = typing.cast(
|
|
1854
|
+
TracesListByFunctionHashResponse,
|
|
1855
|
+
parse_obj_as(
|
|
1856
|
+
type_=TracesListByFunctionHashResponse, # type: ignore
|
|
1857
|
+
object_=_response.json(),
|
|
1858
|
+
),
|
|
1859
|
+
)
|
|
1860
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1861
|
+
if _response.status_code == 400:
|
|
1862
|
+
raise BadRequestError(
|
|
1863
|
+
headers=dict(_response.headers),
|
|
1864
|
+
body=typing.cast(
|
|
1865
|
+
typing.Optional[typing.Any],
|
|
1866
|
+
parse_obj_as(
|
|
1867
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1868
|
+
object_=_response.json(),
|
|
1869
|
+
),
|
|
1870
|
+
),
|
|
1871
|
+
)
|
|
1872
|
+
if _response.status_code == 401:
|
|
1873
|
+
raise UnauthorizedError(
|
|
1874
|
+
headers=dict(_response.headers),
|
|
1875
|
+
body=typing.cast(
|
|
1876
|
+
UnauthorizedErrorBody,
|
|
1877
|
+
parse_obj_as(
|
|
1878
|
+
type_=UnauthorizedErrorBody, # type: ignore
|
|
1879
|
+
object_=_response.json(),
|
|
1880
|
+
),
|
|
1881
|
+
),
|
|
1882
|
+
)
|
|
1883
|
+
if _response.status_code == 403:
|
|
1884
|
+
raise ForbiddenError(
|
|
1885
|
+
headers=dict(_response.headers),
|
|
1886
|
+
body=typing.cast(
|
|
1887
|
+
PermissionDeniedError,
|
|
1888
|
+
parse_obj_as(
|
|
1889
|
+
type_=PermissionDeniedError, # type: ignore
|
|
1890
|
+
object_=_response.json(),
|
|
1891
|
+
),
|
|
1892
|
+
),
|
|
1893
|
+
)
|
|
1894
|
+
if _response.status_code == 404:
|
|
1895
|
+
raise NotFoundError(
|
|
1896
|
+
headers=dict(_response.headers),
|
|
1897
|
+
body=typing.cast(
|
|
1898
|
+
NotFoundErrorBody,
|
|
1899
|
+
parse_obj_as(
|
|
1900
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
1901
|
+
object_=_response.json(),
|
|
1902
|
+
),
|
|
1903
|
+
),
|
|
1904
|
+
)
|
|
1905
|
+
if _response.status_code == 429:
|
|
1906
|
+
raise TooManyRequestsError(
|
|
1907
|
+
headers=dict(_response.headers),
|
|
1908
|
+
body=typing.cast(
|
|
1909
|
+
RateLimitError,
|
|
1910
|
+
parse_obj_as(
|
|
1911
|
+
type_=RateLimitError, # type: ignore
|
|
1912
|
+
object_=_response.json(),
|
|
1913
|
+
),
|
|
1914
|
+
),
|
|
1915
|
+
)
|
|
1916
|
+
if _response.status_code == 500:
|
|
1917
|
+
raise InternalServerError(
|
|
1918
|
+
headers=dict(_response.headers),
|
|
1919
|
+
body=typing.cast(
|
|
1920
|
+
typing.Optional[typing.Any],
|
|
1921
|
+
parse_obj_as(
|
|
1922
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1923
|
+
object_=_response.json(),
|
|
1924
|
+
),
|
|
1925
|
+
),
|
|
1926
|
+
)
|
|
1927
|
+
if _response.status_code == 503:
|
|
1928
|
+
raise ServiceUnavailableError(
|
|
1929
|
+
headers=dict(_response.headers),
|
|
1930
|
+
body=typing.cast(
|
|
1931
|
+
typing.Optional[typing.Any],
|
|
1932
|
+
parse_obj_as(
|
|
1933
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1934
|
+
object_=_response.json(),
|
|
1935
|
+
),
|
|
1936
|
+
),
|
|
1937
|
+
)
|
|
1938
|
+
_response_json = _response.json()
|
|
1939
|
+
except JSONDecodeError:
|
|
1940
|
+
raise ApiError(
|
|
1941
|
+
status_code=_response.status_code,
|
|
1942
|
+
headers=dict(_response.headers),
|
|
1943
|
+
body=_response.text,
|
|
1944
|
+
)
|
|
1945
|
+
raise ApiError(
|
|
1946
|
+
status_code=_response.status_code,
|
|
1947
|
+
headers=dict(_response.headers),
|
|
1948
|
+
body=_response_json,
|
|
1949
|
+
)
|
|
1950
|
+
|
|
1951
|
+
async def searchbyenv(
|
|
1952
|
+
self,
|
|
1953
|
+
organization_id: str,
|
|
1954
|
+
project_id: str,
|
|
1955
|
+
environment_id: str,
|
|
1956
|
+
*,
|
|
1957
|
+
start_time: str,
|
|
1958
|
+
end_time: str,
|
|
1959
|
+
query: typing.Optional[str] = OMIT,
|
|
1960
|
+
input_messages_query: typing.Optional[str] = OMIT,
|
|
1961
|
+
output_messages_query: typing.Optional[str] = OMIT,
|
|
1962
|
+
fuzzy_search: typing.Optional[bool] = OMIT,
|
|
1963
|
+
trace_id: typing.Optional[str] = OMIT,
|
|
1964
|
+
span_id: typing.Optional[str] = OMIT,
|
|
1965
|
+
model: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1966
|
+
provider: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1967
|
+
function_id: typing.Optional[str] = OMIT,
|
|
1968
|
+
function_name: typing.Optional[str] = OMIT,
|
|
1969
|
+
span_name_prefix: typing.Optional[str] = OMIT,
|
|
1970
|
+
has_error: typing.Optional[bool] = OMIT,
|
|
1971
|
+
min_tokens: typing.Optional[float] = OMIT,
|
|
1972
|
+
max_tokens: typing.Optional[float] = OMIT,
|
|
1973
|
+
min_duration: typing.Optional[float] = OMIT,
|
|
1974
|
+
max_duration: typing.Optional[float] = OMIT,
|
|
1975
|
+
attribute_filters: typing.Optional[
|
|
1976
|
+
typing.Sequence[TracesSearchByEnvRequestAttributeFiltersItem]
|
|
1977
|
+
] = OMIT,
|
|
1978
|
+
limit: typing.Optional[float] = OMIT,
|
|
1979
|
+
offset: typing.Optional[float] = OMIT,
|
|
1980
|
+
sort_by: typing.Optional[TracesSearchByEnvRequestSortBy] = OMIT,
|
|
1981
|
+
sort_order: typing.Optional[TracesSearchByEnvRequestSortOrder] = OMIT,
|
|
1982
|
+
root_spans_only: typing.Optional[bool] = OMIT,
|
|
1983
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1984
|
+
) -> AsyncHttpResponse[TracesSearchByEnvResponse]:
|
|
1985
|
+
"""
|
|
1986
|
+
Parameters
|
|
1987
|
+
----------
|
|
1988
|
+
organization_id : str
|
|
1989
|
+
|
|
1990
|
+
project_id : str
|
|
1991
|
+
|
|
1992
|
+
environment_id : str
|
|
1993
|
+
|
|
1994
|
+
start_time : str
|
|
1995
|
+
|
|
1996
|
+
end_time : str
|
|
1997
|
+
|
|
1998
|
+
query : typing.Optional[str]
|
|
1999
|
+
|
|
2000
|
+
input_messages_query : typing.Optional[str]
|
|
2001
|
+
|
|
2002
|
+
output_messages_query : typing.Optional[str]
|
|
2003
|
+
|
|
2004
|
+
fuzzy_search : typing.Optional[bool]
|
|
2005
|
+
|
|
2006
|
+
trace_id : typing.Optional[str]
|
|
2007
|
+
|
|
2008
|
+
span_id : typing.Optional[str]
|
|
2009
|
+
|
|
2010
|
+
model : typing.Optional[typing.Sequence[str]]
|
|
2011
|
+
|
|
2012
|
+
provider : typing.Optional[typing.Sequence[str]]
|
|
2013
|
+
|
|
2014
|
+
function_id : typing.Optional[str]
|
|
2015
|
+
|
|
2016
|
+
function_name : typing.Optional[str]
|
|
2017
|
+
|
|
2018
|
+
span_name_prefix : typing.Optional[str]
|
|
2019
|
+
|
|
2020
|
+
has_error : typing.Optional[bool]
|
|
2021
|
+
|
|
2022
|
+
min_tokens : typing.Optional[float]
|
|
2023
|
+
|
|
2024
|
+
max_tokens : typing.Optional[float]
|
|
2025
|
+
|
|
2026
|
+
min_duration : typing.Optional[float]
|
|
2027
|
+
|
|
2028
|
+
max_duration : typing.Optional[float]
|
|
2029
|
+
|
|
2030
|
+
attribute_filters : typing.Optional[typing.Sequence[TracesSearchByEnvRequestAttributeFiltersItem]]
|
|
2031
|
+
|
|
2032
|
+
limit : typing.Optional[float]
|
|
2033
|
+
|
|
2034
|
+
offset : typing.Optional[float]
|
|
2035
|
+
|
|
2036
|
+
sort_by : typing.Optional[TracesSearchByEnvRequestSortBy]
|
|
2037
|
+
|
|
2038
|
+
sort_order : typing.Optional[TracesSearchByEnvRequestSortOrder]
|
|
2039
|
+
|
|
2040
|
+
root_spans_only : typing.Optional[bool]
|
|
2041
|
+
|
|
2042
|
+
request_options : typing.Optional[RequestOptions]
|
|
2043
|
+
Request-specific configuration.
|
|
2044
|
+
|
|
2045
|
+
Returns
|
|
2046
|
+
-------
|
|
2047
|
+
AsyncHttpResponse[TracesSearchByEnvResponse]
|
|
2048
|
+
Success
|
|
2049
|
+
"""
|
|
2050
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2051
|
+
f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/traces/search",
|
|
2052
|
+
method="POST",
|
|
2053
|
+
json={
|
|
2054
|
+
"startTime": start_time,
|
|
2055
|
+
"endTime": end_time,
|
|
2056
|
+
"query": query,
|
|
2057
|
+
"inputMessagesQuery": input_messages_query,
|
|
2058
|
+
"outputMessagesQuery": output_messages_query,
|
|
2059
|
+
"fuzzySearch": fuzzy_search,
|
|
2060
|
+
"traceId": trace_id,
|
|
2061
|
+
"spanId": span_id,
|
|
2062
|
+
"model": model,
|
|
2063
|
+
"provider": provider,
|
|
2064
|
+
"functionId": function_id,
|
|
2065
|
+
"functionName": function_name,
|
|
2066
|
+
"spanNamePrefix": span_name_prefix,
|
|
2067
|
+
"hasError": has_error,
|
|
2068
|
+
"minTokens": min_tokens,
|
|
2069
|
+
"maxTokens": max_tokens,
|
|
2070
|
+
"minDuration": min_duration,
|
|
2071
|
+
"maxDuration": max_duration,
|
|
2072
|
+
"attributeFilters": convert_and_respect_annotation_metadata(
|
|
2073
|
+
object_=attribute_filters,
|
|
2074
|
+
annotation=typing.Sequence[
|
|
2075
|
+
TracesSearchByEnvRequestAttributeFiltersItem
|
|
2076
|
+
],
|
|
2077
|
+
direction="write",
|
|
2078
|
+
),
|
|
2079
|
+
"limit": limit,
|
|
2080
|
+
"offset": offset,
|
|
2081
|
+
"sortBy": sort_by,
|
|
2082
|
+
"sortOrder": sort_order,
|
|
2083
|
+
"rootSpansOnly": root_spans_only,
|
|
2084
|
+
},
|
|
2085
|
+
headers={
|
|
2086
|
+
"content-type": "application/json",
|
|
2087
|
+
},
|
|
2088
|
+
request_options=request_options,
|
|
2089
|
+
omit=OMIT,
|
|
2090
|
+
)
|
|
987
2091
|
try:
|
|
988
2092
|
if 200 <= _response.status_code < 300:
|
|
989
2093
|
_data = typing.cast(
|
|
990
|
-
|
|
2094
|
+
TracesSearchByEnvResponse,
|
|
991
2095
|
parse_obj_as(
|
|
992
|
-
type_=
|
|
2096
|
+
type_=TracesSearchByEnvResponse, # type: ignore
|
|
2097
|
+
object_=_response.json(),
|
|
2098
|
+
),
|
|
2099
|
+
)
|
|
2100
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2101
|
+
if _response.status_code == 400:
|
|
2102
|
+
raise BadRequestError(
|
|
2103
|
+
headers=dict(_response.headers),
|
|
2104
|
+
body=typing.cast(
|
|
2105
|
+
typing.Optional[typing.Any],
|
|
2106
|
+
parse_obj_as(
|
|
2107
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2108
|
+
object_=_response.json(),
|
|
2109
|
+
),
|
|
2110
|
+
),
|
|
2111
|
+
)
|
|
2112
|
+
if _response.status_code == 401:
|
|
2113
|
+
raise UnauthorizedError(
|
|
2114
|
+
headers=dict(_response.headers),
|
|
2115
|
+
body=typing.cast(
|
|
2116
|
+
UnauthorizedErrorBody,
|
|
2117
|
+
parse_obj_as(
|
|
2118
|
+
type_=UnauthorizedErrorBody, # type: ignore
|
|
2119
|
+
object_=_response.json(),
|
|
2120
|
+
),
|
|
2121
|
+
),
|
|
2122
|
+
)
|
|
2123
|
+
if _response.status_code == 403:
|
|
2124
|
+
raise ForbiddenError(
|
|
2125
|
+
headers=dict(_response.headers),
|
|
2126
|
+
body=typing.cast(
|
|
2127
|
+
PermissionDeniedError,
|
|
2128
|
+
parse_obj_as(
|
|
2129
|
+
type_=PermissionDeniedError, # type: ignore
|
|
2130
|
+
object_=_response.json(),
|
|
2131
|
+
),
|
|
2132
|
+
),
|
|
2133
|
+
)
|
|
2134
|
+
if _response.status_code == 404:
|
|
2135
|
+
raise NotFoundError(
|
|
2136
|
+
headers=dict(_response.headers),
|
|
2137
|
+
body=typing.cast(
|
|
2138
|
+
NotFoundErrorBody,
|
|
2139
|
+
parse_obj_as(
|
|
2140
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
2141
|
+
object_=_response.json(),
|
|
2142
|
+
),
|
|
2143
|
+
),
|
|
2144
|
+
)
|
|
2145
|
+
if _response.status_code == 429:
|
|
2146
|
+
raise TooManyRequestsError(
|
|
2147
|
+
headers=dict(_response.headers),
|
|
2148
|
+
body=typing.cast(
|
|
2149
|
+
RateLimitError,
|
|
2150
|
+
parse_obj_as(
|
|
2151
|
+
type_=RateLimitError, # type: ignore
|
|
2152
|
+
object_=_response.json(),
|
|
2153
|
+
),
|
|
2154
|
+
),
|
|
2155
|
+
)
|
|
2156
|
+
if _response.status_code == 500:
|
|
2157
|
+
raise InternalServerError(
|
|
2158
|
+
headers=dict(_response.headers),
|
|
2159
|
+
body=typing.cast(
|
|
2160
|
+
typing.Optional[typing.Any],
|
|
2161
|
+
parse_obj_as(
|
|
2162
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2163
|
+
object_=_response.json(),
|
|
2164
|
+
),
|
|
2165
|
+
),
|
|
2166
|
+
)
|
|
2167
|
+
if _response.status_code == 503:
|
|
2168
|
+
raise ServiceUnavailableError(
|
|
2169
|
+
headers=dict(_response.headers),
|
|
2170
|
+
body=typing.cast(
|
|
2171
|
+
typing.Optional[typing.Any],
|
|
2172
|
+
parse_obj_as(
|
|
2173
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2174
|
+
object_=_response.json(),
|
|
2175
|
+
),
|
|
2176
|
+
),
|
|
2177
|
+
)
|
|
2178
|
+
_response_json = _response.json()
|
|
2179
|
+
except JSONDecodeError:
|
|
2180
|
+
raise ApiError(
|
|
2181
|
+
status_code=_response.status_code,
|
|
2182
|
+
headers=dict(_response.headers),
|
|
2183
|
+
body=_response.text,
|
|
2184
|
+
)
|
|
2185
|
+
raise ApiError(
|
|
2186
|
+
status_code=_response.status_code,
|
|
2187
|
+
headers=dict(_response.headers),
|
|
2188
|
+
body=_response_json,
|
|
2189
|
+
)
|
|
2190
|
+
|
|
2191
|
+
async def gettracedetailbyenv(
|
|
2192
|
+
self,
|
|
2193
|
+
organization_id: str,
|
|
2194
|
+
project_id: str,
|
|
2195
|
+
environment_id: str,
|
|
2196
|
+
trace_id: str,
|
|
2197
|
+
*,
|
|
2198
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2199
|
+
) -> AsyncHttpResponse[TracesGetTraceDetailByEnvResponse]:
|
|
2200
|
+
"""
|
|
2201
|
+
Parameters
|
|
2202
|
+
----------
|
|
2203
|
+
organization_id : str
|
|
2204
|
+
|
|
2205
|
+
project_id : str
|
|
2206
|
+
|
|
2207
|
+
environment_id : str
|
|
2208
|
+
|
|
2209
|
+
trace_id : str
|
|
2210
|
+
|
|
2211
|
+
request_options : typing.Optional[RequestOptions]
|
|
2212
|
+
Request-specific configuration.
|
|
2213
|
+
|
|
2214
|
+
Returns
|
|
2215
|
+
-------
|
|
2216
|
+
AsyncHttpResponse[TracesGetTraceDetailByEnvResponse]
|
|
2217
|
+
Success
|
|
2218
|
+
"""
|
|
2219
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2220
|
+
f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/traces/{jsonable_encoder(trace_id)}",
|
|
2221
|
+
method="GET",
|
|
2222
|
+
request_options=request_options,
|
|
2223
|
+
)
|
|
2224
|
+
try:
|
|
2225
|
+
if 200 <= _response.status_code < 300:
|
|
2226
|
+
_data = typing.cast(
|
|
2227
|
+
TracesGetTraceDetailByEnvResponse,
|
|
2228
|
+
parse_obj_as(
|
|
2229
|
+
type_=TracesGetTraceDetailByEnvResponse, # type: ignore
|
|
993
2230
|
object_=_response.json(),
|
|
994
2231
|
),
|
|
995
2232
|
)
|
|
@@ -998,9 +2235,9 @@ class AsyncRawTracesClient:
|
|
|
998
2235
|
raise BadRequestError(
|
|
999
2236
|
headers=dict(_response.headers),
|
|
1000
2237
|
body=typing.cast(
|
|
1001
|
-
|
|
2238
|
+
typing.Optional[typing.Any],
|
|
1002
2239
|
parse_obj_as(
|
|
1003
|
-
type_=
|
|
2240
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1004
2241
|
object_=_response.json(),
|
|
1005
2242
|
),
|
|
1006
2243
|
),
|
|
@@ -1027,6 +2264,28 @@ class AsyncRawTracesClient:
|
|
|
1027
2264
|
),
|
|
1028
2265
|
),
|
|
1029
2266
|
)
|
|
2267
|
+
if _response.status_code == 404:
|
|
2268
|
+
raise NotFoundError(
|
|
2269
|
+
headers=dict(_response.headers),
|
|
2270
|
+
body=typing.cast(
|
|
2271
|
+
NotFoundErrorBody,
|
|
2272
|
+
parse_obj_as(
|
|
2273
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
2274
|
+
object_=_response.json(),
|
|
2275
|
+
),
|
|
2276
|
+
),
|
|
2277
|
+
)
|
|
2278
|
+
if _response.status_code == 429:
|
|
2279
|
+
raise TooManyRequestsError(
|
|
2280
|
+
headers=dict(_response.headers),
|
|
2281
|
+
body=typing.cast(
|
|
2282
|
+
RateLimitError,
|
|
2283
|
+
parse_obj_as(
|
|
2284
|
+
type_=RateLimitError, # type: ignore
|
|
2285
|
+
object_=_response.json(),
|
|
2286
|
+
),
|
|
2287
|
+
),
|
|
2288
|
+
)
|
|
1030
2289
|
if _response.status_code == 500:
|
|
1031
2290
|
raise InternalServerError(
|
|
1032
2291
|
headers=dict(_response.headers),
|
|
@@ -1038,6 +2297,17 @@ class AsyncRawTracesClient:
|
|
|
1038
2297
|
),
|
|
1039
2298
|
),
|
|
1040
2299
|
)
|
|
2300
|
+
if _response.status_code == 503:
|
|
2301
|
+
raise ServiceUnavailableError(
|
|
2302
|
+
headers=dict(_response.headers),
|
|
2303
|
+
body=typing.cast(
|
|
2304
|
+
typing.Optional[typing.Any],
|
|
2305
|
+
parse_obj_as(
|
|
2306
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2307
|
+
object_=_response.json(),
|
|
2308
|
+
),
|
|
2309
|
+
),
|
|
2310
|
+
)
|
|
1041
2311
|
_response_json = _response.json()
|
|
1042
2312
|
except JSONDecodeError:
|
|
1043
2313
|
raise ApiError(
|