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
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
from .api_keys_create_response import ApiKeysCreateResponse
|
|
6
6
|
from .api_keys_get_response import ApiKeysGetResponse
|
|
7
|
+
from .api_keys_list_all_for_org_response_item import ApiKeysListAllForOrgResponseItem
|
|
7
8
|
from .api_keys_list_response_item import ApiKeysListResponseItem
|
|
8
9
|
|
|
9
|
-
__all__ = [
|
|
10
|
+
__all__ = [
|
|
11
|
+
"ApiKeysCreateResponse",
|
|
12
|
+
"ApiKeysGetResponse",
|
|
13
|
+
"ApiKeysListAllForOrgResponseItem",
|
|
14
|
+
"ApiKeysListResponseItem",
|
|
15
|
+
]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
import typing_extensions
|
|
7
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
8
|
+
from ...core.serialization import FieldMetadata
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ApiKeysListAllForOrgResponseItem(UniversalBaseModel):
|
|
12
|
+
id: str
|
|
13
|
+
name: str
|
|
14
|
+
key_prefix: typing_extensions.Annotated[str, FieldMetadata(alias="keyPrefix")]
|
|
15
|
+
environment_id: typing_extensions.Annotated[
|
|
16
|
+
str, FieldMetadata(alias="environmentId")
|
|
17
|
+
]
|
|
18
|
+
owner_id: typing_extensions.Annotated[str, FieldMetadata(alias="ownerId")]
|
|
19
|
+
created_at: typing_extensions.Annotated[
|
|
20
|
+
typing.Optional[str], FieldMetadata(alias="createdAt")
|
|
21
|
+
] = None
|
|
22
|
+
last_used_at: typing_extensions.Annotated[
|
|
23
|
+
typing.Optional[str], FieldMetadata(alias="lastUsedAt")
|
|
24
|
+
] = None
|
|
25
|
+
project_id: typing_extensions.Annotated[str, FieldMetadata(alias="projectId")]
|
|
26
|
+
project_name: typing_extensions.Annotated[str, FieldMetadata(alias="projectName")]
|
|
27
|
+
environment_name: typing_extensions.Annotated[
|
|
28
|
+
str, FieldMetadata(alias="environmentName")
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
if IS_PYDANTIC_V2:
|
|
32
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
|
|
33
|
+
extra="allow", frozen=True
|
|
34
|
+
) # type: ignore # Pydantic v2
|
|
35
|
+
else:
|
|
36
|
+
|
|
37
|
+
class Config:
|
|
38
|
+
frozen = True
|
|
39
|
+
smart_union = True
|
|
40
|
+
extra = pydantic.Extra.allow
|
|
@@ -11,8 +11,22 @@ from .environment import MirascopeEnvironment
|
|
|
11
11
|
from .environments.client import AsyncEnvironmentsClient, EnvironmentsClient
|
|
12
12
|
from .functions.client import AsyncFunctionsClient, FunctionsClient
|
|
13
13
|
from .health.client import AsyncHealthClient, HealthClient
|
|
14
|
+
from .organization_invitations.client import (
|
|
15
|
+
AsyncOrganizationInvitationsClient,
|
|
16
|
+
OrganizationInvitationsClient,
|
|
17
|
+
)
|
|
18
|
+
from .organization_memberships.client import (
|
|
19
|
+
AsyncOrganizationMembershipsClient,
|
|
20
|
+
OrganizationMembershipsClient,
|
|
21
|
+
)
|
|
14
22
|
from .organizations.client import AsyncOrganizationsClient, OrganizationsClient
|
|
23
|
+
from .project_memberships.client import (
|
|
24
|
+
AsyncProjectMembershipsClient,
|
|
25
|
+
ProjectMembershipsClient,
|
|
26
|
+
)
|
|
15
27
|
from .projects.client import AsyncProjectsClient, ProjectsClient
|
|
28
|
+
from .tags.client import AsyncTagsClient, TagsClient
|
|
29
|
+
from .token_cost.client import AsyncTokenCostClient, TokenCostClient
|
|
16
30
|
from .traces.client import AsyncTracesClient, TracesClient
|
|
17
31
|
|
|
18
32
|
|
|
@@ -81,11 +95,22 @@ class Mirascope:
|
|
|
81
95
|
self.traces = TracesClient(client_wrapper=self._client_wrapper)
|
|
82
96
|
self.docs = DocsClient(client_wrapper=self._client_wrapper)
|
|
83
97
|
self.organizations = OrganizationsClient(client_wrapper=self._client_wrapper)
|
|
98
|
+
self.organization_invitations = OrganizationInvitationsClient(
|
|
99
|
+
client_wrapper=self._client_wrapper
|
|
100
|
+
)
|
|
101
|
+
self.organization_memberships = OrganizationMembershipsClient(
|
|
102
|
+
client_wrapper=self._client_wrapper
|
|
103
|
+
)
|
|
84
104
|
self.projects = ProjectsClient(client_wrapper=self._client_wrapper)
|
|
105
|
+
self.project_memberships = ProjectMembershipsClient(
|
|
106
|
+
client_wrapper=self._client_wrapper
|
|
107
|
+
)
|
|
85
108
|
self.environments = EnvironmentsClient(client_wrapper=self._client_wrapper)
|
|
86
109
|
self.api_keys = ApiKeysClient(client_wrapper=self._client_wrapper)
|
|
87
110
|
self.functions = FunctionsClient(client_wrapper=self._client_wrapper)
|
|
88
111
|
self.annotations = AnnotationsClient(client_wrapper=self._client_wrapper)
|
|
112
|
+
self.tags = TagsClient(client_wrapper=self._client_wrapper)
|
|
113
|
+
self.token_cost = TokenCostClient(client_wrapper=self._client_wrapper)
|
|
89
114
|
|
|
90
115
|
|
|
91
116
|
class AsyncMirascope:
|
|
@@ -155,11 +180,22 @@ class AsyncMirascope:
|
|
|
155
180
|
self.organizations = AsyncOrganizationsClient(
|
|
156
181
|
client_wrapper=self._client_wrapper
|
|
157
182
|
)
|
|
183
|
+
self.organization_invitations = AsyncOrganizationInvitationsClient(
|
|
184
|
+
client_wrapper=self._client_wrapper
|
|
185
|
+
)
|
|
186
|
+
self.organization_memberships = AsyncOrganizationMembershipsClient(
|
|
187
|
+
client_wrapper=self._client_wrapper
|
|
188
|
+
)
|
|
158
189
|
self.projects = AsyncProjectsClient(client_wrapper=self._client_wrapper)
|
|
190
|
+
self.project_memberships = AsyncProjectMembershipsClient(
|
|
191
|
+
client_wrapper=self._client_wrapper
|
|
192
|
+
)
|
|
159
193
|
self.environments = AsyncEnvironmentsClient(client_wrapper=self._client_wrapper)
|
|
160
194
|
self.api_keys = AsyncApiKeysClient(client_wrapper=self._client_wrapper)
|
|
161
195
|
self.functions = AsyncFunctionsClient(client_wrapper=self._client_wrapper)
|
|
162
196
|
self.annotations = AsyncAnnotationsClient(client_wrapper=self._client_wrapper)
|
|
197
|
+
self.tags = AsyncTagsClient(client_wrapper=self._client_wrapper)
|
|
198
|
+
self.token_cost = AsyncTokenCostClient(client_wrapper=self._client_wrapper)
|
|
163
199
|
|
|
164
200
|
|
|
165
201
|
def _get_base_url(
|
|
@@ -9,7 +9,9 @@ from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
|
9
9
|
from ..core.pydantic_utilities import parse_obj_as
|
|
10
10
|
from ..core.request_options import RequestOptions
|
|
11
11
|
from ..errors.bad_request_error import BadRequestError
|
|
12
|
-
from ..
|
|
12
|
+
from ..errors.service_unavailable_error import ServiceUnavailableError
|
|
13
|
+
from ..errors.too_many_requests_error import TooManyRequestsError
|
|
14
|
+
from ..types.rate_limit_error import RateLimitError
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
class RawDocsClient:
|
|
@@ -51,17 +53,47 @@ class RawDocsClient:
|
|
|
51
53
|
raise BadRequestError(
|
|
52
54
|
headers=dict(_response.headers),
|
|
53
55
|
body=typing.cast(
|
|
54
|
-
|
|
56
|
+
typing.Optional[typing.Any],
|
|
55
57
|
parse_obj_as(
|
|
56
|
-
type_=
|
|
58
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
59
|
+
object_=_response.json(),
|
|
60
|
+
),
|
|
61
|
+
),
|
|
62
|
+
)
|
|
63
|
+
if _response.status_code == 429:
|
|
64
|
+
raise TooManyRequestsError(
|
|
65
|
+
headers=dict(_response.headers),
|
|
66
|
+
body=typing.cast(
|
|
67
|
+
RateLimitError,
|
|
68
|
+
parse_obj_as(
|
|
69
|
+
type_=RateLimitError, # type: ignore
|
|
70
|
+
object_=_response.json(),
|
|
71
|
+
),
|
|
72
|
+
),
|
|
73
|
+
)
|
|
74
|
+
if _response.status_code == 503:
|
|
75
|
+
raise ServiceUnavailableError(
|
|
76
|
+
headers=dict(_response.headers),
|
|
77
|
+
body=typing.cast(
|
|
78
|
+
typing.Optional[typing.Any],
|
|
79
|
+
parse_obj_as(
|
|
80
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
57
81
|
object_=_response.json(),
|
|
58
82
|
),
|
|
59
83
|
),
|
|
60
84
|
)
|
|
61
85
|
_response_json = _response.json()
|
|
62
86
|
except JSONDecodeError:
|
|
63
|
-
raise ApiError(
|
|
64
|
-
|
|
87
|
+
raise ApiError(
|
|
88
|
+
status_code=_response.status_code,
|
|
89
|
+
headers=dict(_response.headers),
|
|
90
|
+
body=_response.text,
|
|
91
|
+
)
|
|
92
|
+
raise ApiError(
|
|
93
|
+
status_code=_response.status_code,
|
|
94
|
+
headers=dict(_response.headers),
|
|
95
|
+
body=_response_json,
|
|
96
|
+
)
|
|
65
97
|
|
|
66
98
|
|
|
67
99
|
class AsyncRawDocsClient:
|
|
@@ -103,14 +135,44 @@ class AsyncRawDocsClient:
|
|
|
103
135
|
raise BadRequestError(
|
|
104
136
|
headers=dict(_response.headers),
|
|
105
137
|
body=typing.cast(
|
|
106
|
-
|
|
138
|
+
typing.Optional[typing.Any],
|
|
107
139
|
parse_obj_as(
|
|
108
|
-
type_=
|
|
140
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
141
|
+
object_=_response.json(),
|
|
142
|
+
),
|
|
143
|
+
),
|
|
144
|
+
)
|
|
145
|
+
if _response.status_code == 429:
|
|
146
|
+
raise TooManyRequestsError(
|
|
147
|
+
headers=dict(_response.headers),
|
|
148
|
+
body=typing.cast(
|
|
149
|
+
RateLimitError,
|
|
150
|
+
parse_obj_as(
|
|
151
|
+
type_=RateLimitError, # type: ignore
|
|
152
|
+
object_=_response.json(),
|
|
153
|
+
),
|
|
154
|
+
),
|
|
155
|
+
)
|
|
156
|
+
if _response.status_code == 503:
|
|
157
|
+
raise ServiceUnavailableError(
|
|
158
|
+
headers=dict(_response.headers),
|
|
159
|
+
body=typing.cast(
|
|
160
|
+
typing.Optional[typing.Any],
|
|
161
|
+
parse_obj_as(
|
|
162
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
109
163
|
object_=_response.json(),
|
|
110
164
|
),
|
|
111
165
|
),
|
|
112
166
|
)
|
|
113
167
|
_response_json = _response.json()
|
|
114
168
|
except JSONDecodeError:
|
|
115
|
-
raise ApiError(
|
|
116
|
-
|
|
169
|
+
raise ApiError(
|
|
170
|
+
status_code=_response.status_code,
|
|
171
|
+
headers=dict(_response.headers),
|
|
172
|
+
body=_response.text,
|
|
173
|
+
)
|
|
174
|
+
raise ApiError(
|
|
175
|
+
status_code=_response.status_code,
|
|
176
|
+
headers=dict(_response.headers),
|
|
177
|
+
body=_response_json,
|
|
178
|
+
)
|
|
@@ -4,6 +4,6 @@ import enum
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class MirascopeEnvironment(enum.Enum):
|
|
7
|
-
PRODUCTION = "https://
|
|
8
|
-
STAGING = "https://staging.mirascope.com/api/
|
|
9
|
-
LOCAL = "http://localhost:3000/api/
|
|
7
|
+
PRODUCTION = "https://mirascope.com/api/v2"
|
|
8
|
+
STAGING = "https://staging.mirascope.com/api/v2"
|
|
9
|
+
LOCAL = "http://localhost:3000/api/v2"
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
from .types import (
|
|
6
6
|
EnvironmentsCreateResponse,
|
|
7
|
+
EnvironmentsGetAnalyticsResponse,
|
|
8
|
+
EnvironmentsGetAnalyticsResponseTopFunctionsItem,
|
|
9
|
+
EnvironmentsGetAnalyticsResponseTopModelsItem,
|
|
7
10
|
EnvironmentsGetResponse,
|
|
8
11
|
EnvironmentsListResponseItem,
|
|
9
12
|
EnvironmentsUpdateResponse,
|
|
@@ -11,6 +14,9 @@ from .types import (
|
|
|
11
14
|
|
|
12
15
|
__all__ = [
|
|
13
16
|
"EnvironmentsCreateResponse",
|
|
17
|
+
"EnvironmentsGetAnalyticsResponse",
|
|
18
|
+
"EnvironmentsGetAnalyticsResponseTopFunctionsItem",
|
|
19
|
+
"EnvironmentsGetAnalyticsResponseTopModelsItem",
|
|
14
20
|
"EnvironmentsGetResponse",
|
|
15
21
|
"EnvironmentsListResponseItem",
|
|
16
22
|
"EnvironmentsUpdateResponse",
|
|
@@ -6,6 +6,7 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
7
|
from .raw_client import AsyncRawEnvironmentsClient, RawEnvironmentsClient
|
|
8
8
|
from .types.environments_create_response import EnvironmentsCreateResponse
|
|
9
|
+
from .types.environments_get_analytics_response import EnvironmentsGetAnalyticsResponse
|
|
9
10
|
from .types.environments_get_response import EnvironmentsGetResponse
|
|
10
11
|
from .types.environments_list_response_item import EnvironmentsListResponseItem
|
|
11
12
|
from .types.environments_update_response import EnvironmentsUpdateResponse
|
|
@@ -30,7 +31,11 @@ class EnvironmentsClient:
|
|
|
30
31
|
return self._raw_client
|
|
31
32
|
|
|
32
33
|
def list(
|
|
33
|
-
self,
|
|
34
|
+
self,
|
|
35
|
+
organization_id: str,
|
|
36
|
+
project_id: str,
|
|
37
|
+
*,
|
|
38
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
34
39
|
) -> typing.List[EnvironmentsListResponseItem]:
|
|
35
40
|
"""
|
|
36
41
|
Parameters
|
|
@@ -57,7 +62,9 @@ class EnvironmentsClient:
|
|
|
57
62
|
project_id="projectId",
|
|
58
63
|
)
|
|
59
64
|
"""
|
|
60
|
-
_response = self._raw_client.list(
|
|
65
|
+
_response = self._raw_client.list(
|
|
66
|
+
organization_id, project_id, request_options=request_options
|
|
67
|
+
)
|
|
61
68
|
return _response.data
|
|
62
69
|
|
|
63
70
|
def create(
|
|
@@ -103,7 +110,11 @@ class EnvironmentsClient:
|
|
|
103
110
|
)
|
|
104
111
|
"""
|
|
105
112
|
_response = self._raw_client.create(
|
|
106
|
-
organization_id,
|
|
113
|
+
organization_id,
|
|
114
|
+
project_id,
|
|
115
|
+
name=name,
|
|
116
|
+
slug=slug,
|
|
117
|
+
request_options=request_options,
|
|
107
118
|
)
|
|
108
119
|
return _response.data
|
|
109
120
|
|
|
@@ -143,7 +154,9 @@ class EnvironmentsClient:
|
|
|
143
154
|
environment_id="environmentId",
|
|
144
155
|
)
|
|
145
156
|
"""
|
|
146
|
-
_response = self._raw_client.get(
|
|
157
|
+
_response = self._raw_client.get(
|
|
158
|
+
organization_id, project_id, environment_id, request_options=request_options
|
|
159
|
+
)
|
|
147
160
|
return _response.data
|
|
148
161
|
|
|
149
162
|
def update(
|
|
@@ -191,7 +204,12 @@ class EnvironmentsClient:
|
|
|
191
204
|
)
|
|
192
205
|
"""
|
|
193
206
|
_response = self._raw_client.update(
|
|
194
|
-
organization_id,
|
|
207
|
+
organization_id,
|
|
208
|
+
project_id,
|
|
209
|
+
environment_id,
|
|
210
|
+
name=name,
|
|
211
|
+
slug=slug,
|
|
212
|
+
request_options=request_options,
|
|
195
213
|
)
|
|
196
214
|
return _response.data
|
|
197
215
|
|
|
@@ -235,6 +253,60 @@ class EnvironmentsClient:
|
|
|
235
253
|
)
|
|
236
254
|
return _response.data
|
|
237
255
|
|
|
256
|
+
def getanalytics(
|
|
257
|
+
self,
|
|
258
|
+
organization_id: str,
|
|
259
|
+
project_id: str,
|
|
260
|
+
environment_id: str,
|
|
261
|
+
*,
|
|
262
|
+
start_time: str,
|
|
263
|
+
end_time: str,
|
|
264
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
265
|
+
) -> EnvironmentsGetAnalyticsResponse:
|
|
266
|
+
"""
|
|
267
|
+
Parameters
|
|
268
|
+
----------
|
|
269
|
+
organization_id : str
|
|
270
|
+
|
|
271
|
+
project_id : str
|
|
272
|
+
|
|
273
|
+
environment_id : str
|
|
274
|
+
|
|
275
|
+
start_time : str
|
|
276
|
+
|
|
277
|
+
end_time : str
|
|
278
|
+
|
|
279
|
+
request_options : typing.Optional[RequestOptions]
|
|
280
|
+
Request-specific configuration.
|
|
281
|
+
|
|
282
|
+
Returns
|
|
283
|
+
-------
|
|
284
|
+
EnvironmentsGetAnalyticsResponse
|
|
285
|
+
Success
|
|
286
|
+
|
|
287
|
+
Examples
|
|
288
|
+
--------
|
|
289
|
+
from mirascope.api._generated import Mirascope
|
|
290
|
+
|
|
291
|
+
client = Mirascope()
|
|
292
|
+
client.environments.getanalytics(
|
|
293
|
+
organization_id="organizationId",
|
|
294
|
+
project_id="projectId",
|
|
295
|
+
environment_id="environmentId",
|
|
296
|
+
start_time="startTime",
|
|
297
|
+
end_time="endTime",
|
|
298
|
+
)
|
|
299
|
+
"""
|
|
300
|
+
_response = self._raw_client.getanalytics(
|
|
301
|
+
organization_id,
|
|
302
|
+
project_id,
|
|
303
|
+
environment_id,
|
|
304
|
+
start_time=start_time,
|
|
305
|
+
end_time=end_time,
|
|
306
|
+
request_options=request_options,
|
|
307
|
+
)
|
|
308
|
+
return _response.data
|
|
309
|
+
|
|
238
310
|
|
|
239
311
|
class AsyncEnvironmentsClient:
|
|
240
312
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -252,7 +324,11 @@ class AsyncEnvironmentsClient:
|
|
|
252
324
|
return self._raw_client
|
|
253
325
|
|
|
254
326
|
async def list(
|
|
255
|
-
self,
|
|
327
|
+
self,
|
|
328
|
+
organization_id: str,
|
|
329
|
+
project_id: str,
|
|
330
|
+
*,
|
|
331
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
256
332
|
) -> typing.List[EnvironmentsListResponseItem]:
|
|
257
333
|
"""
|
|
258
334
|
Parameters
|
|
@@ -287,7 +363,9 @@ class AsyncEnvironmentsClient:
|
|
|
287
363
|
|
|
288
364
|
asyncio.run(main())
|
|
289
365
|
"""
|
|
290
|
-
_response = await self._raw_client.list(
|
|
366
|
+
_response = await self._raw_client.list(
|
|
367
|
+
organization_id, project_id, request_options=request_options
|
|
368
|
+
)
|
|
291
369
|
return _response.data
|
|
292
370
|
|
|
293
371
|
async def create(
|
|
@@ -341,7 +419,11 @@ class AsyncEnvironmentsClient:
|
|
|
341
419
|
asyncio.run(main())
|
|
342
420
|
"""
|
|
343
421
|
_response = await self._raw_client.create(
|
|
344
|
-
organization_id,
|
|
422
|
+
organization_id,
|
|
423
|
+
project_id,
|
|
424
|
+
name=name,
|
|
425
|
+
slug=slug,
|
|
426
|
+
request_options=request_options,
|
|
345
427
|
)
|
|
346
428
|
return _response.data
|
|
347
429
|
|
|
@@ -447,7 +529,12 @@ class AsyncEnvironmentsClient:
|
|
|
447
529
|
asyncio.run(main())
|
|
448
530
|
"""
|
|
449
531
|
_response = await self._raw_client.update(
|
|
450
|
-
organization_id,
|
|
532
|
+
organization_id,
|
|
533
|
+
project_id,
|
|
534
|
+
environment_id,
|
|
535
|
+
name=name,
|
|
536
|
+
slug=slug,
|
|
537
|
+
request_options=request_options,
|
|
451
538
|
)
|
|
452
539
|
return _response.data
|
|
453
540
|
|
|
@@ -498,3 +585,65 @@ class AsyncEnvironmentsClient:
|
|
|
498
585
|
organization_id, project_id, environment_id, request_options=request_options
|
|
499
586
|
)
|
|
500
587
|
return _response.data
|
|
588
|
+
|
|
589
|
+
async def getanalytics(
|
|
590
|
+
self,
|
|
591
|
+
organization_id: str,
|
|
592
|
+
project_id: str,
|
|
593
|
+
environment_id: str,
|
|
594
|
+
*,
|
|
595
|
+
start_time: str,
|
|
596
|
+
end_time: str,
|
|
597
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
598
|
+
) -> EnvironmentsGetAnalyticsResponse:
|
|
599
|
+
"""
|
|
600
|
+
Parameters
|
|
601
|
+
----------
|
|
602
|
+
organization_id : str
|
|
603
|
+
|
|
604
|
+
project_id : str
|
|
605
|
+
|
|
606
|
+
environment_id : str
|
|
607
|
+
|
|
608
|
+
start_time : str
|
|
609
|
+
|
|
610
|
+
end_time : str
|
|
611
|
+
|
|
612
|
+
request_options : typing.Optional[RequestOptions]
|
|
613
|
+
Request-specific configuration.
|
|
614
|
+
|
|
615
|
+
Returns
|
|
616
|
+
-------
|
|
617
|
+
EnvironmentsGetAnalyticsResponse
|
|
618
|
+
Success
|
|
619
|
+
|
|
620
|
+
Examples
|
|
621
|
+
--------
|
|
622
|
+
import asyncio
|
|
623
|
+
|
|
624
|
+
from mirascope.api._generated import AsyncMirascope
|
|
625
|
+
|
|
626
|
+
client = AsyncMirascope()
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
async def main() -> None:
|
|
630
|
+
await client.environments.getanalytics(
|
|
631
|
+
organization_id="organizationId",
|
|
632
|
+
project_id="projectId",
|
|
633
|
+
environment_id="environmentId",
|
|
634
|
+
start_time="startTime",
|
|
635
|
+
end_time="endTime",
|
|
636
|
+
)
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
asyncio.run(main())
|
|
640
|
+
"""
|
|
641
|
+
_response = await self._raw_client.getanalytics(
|
|
642
|
+
organization_id,
|
|
643
|
+
project_id,
|
|
644
|
+
environment_id,
|
|
645
|
+
start_time=start_time,
|
|
646
|
+
end_time=end_time,
|
|
647
|
+
request_options=request_options,
|
|
648
|
+
)
|
|
649
|
+
return _response.data
|