mirascope 2.0.0a2__py3-none-any.whl → 2.0.0a4__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.
Files changed (252) hide show
  1. mirascope/__init__.py +2 -2
  2. mirascope/api/__init__.py +6 -0
  3. mirascope/api/_generated/README.md +207 -0
  4. mirascope/api/_generated/__init__.py +141 -0
  5. mirascope/api/_generated/client.py +163 -0
  6. mirascope/api/_generated/core/__init__.py +52 -0
  7. mirascope/api/_generated/core/api_error.py +23 -0
  8. mirascope/api/_generated/core/client_wrapper.py +58 -0
  9. mirascope/api/_generated/core/datetime_utils.py +30 -0
  10. mirascope/api/_generated/core/file.py +70 -0
  11. mirascope/api/_generated/core/force_multipart.py +16 -0
  12. mirascope/api/_generated/core/http_client.py +619 -0
  13. mirascope/api/_generated/core/http_response.py +55 -0
  14. mirascope/api/_generated/core/jsonable_encoder.py +102 -0
  15. mirascope/api/_generated/core/pydantic_utilities.py +310 -0
  16. mirascope/api/_generated/core/query_encoder.py +60 -0
  17. mirascope/api/_generated/core/remove_none_from_dict.py +11 -0
  18. mirascope/api/_generated/core/request_options.py +35 -0
  19. mirascope/api/_generated/core/serialization.py +282 -0
  20. mirascope/api/_generated/docs/__init__.py +4 -0
  21. mirascope/api/_generated/docs/client.py +95 -0
  22. mirascope/api/_generated/docs/raw_client.py +132 -0
  23. mirascope/api/_generated/environment.py +9 -0
  24. mirascope/api/_generated/errors/__init__.py +17 -0
  25. mirascope/api/_generated/errors/bad_request_error.py +15 -0
  26. mirascope/api/_generated/errors/conflict_error.py +15 -0
  27. mirascope/api/_generated/errors/forbidden_error.py +15 -0
  28. mirascope/api/_generated/errors/internal_server_error.py +15 -0
  29. mirascope/api/_generated/errors/not_found_error.py +15 -0
  30. mirascope/api/_generated/health/__init__.py +7 -0
  31. mirascope/api/_generated/health/client.py +96 -0
  32. mirascope/api/_generated/health/raw_client.py +129 -0
  33. mirascope/api/_generated/health/types/__init__.py +8 -0
  34. mirascope/api/_generated/health/types/health_check_response.py +24 -0
  35. mirascope/api/_generated/health/types/health_check_response_status.py +5 -0
  36. mirascope/api/_generated/organizations/__init__.py +25 -0
  37. mirascope/api/_generated/organizations/client.py +380 -0
  38. mirascope/api/_generated/organizations/raw_client.py +876 -0
  39. mirascope/api/_generated/organizations/types/__init__.py +23 -0
  40. mirascope/api/_generated/organizations/types/organizations_create_response.py +24 -0
  41. mirascope/api/_generated/organizations/types/organizations_create_response_role.py +7 -0
  42. mirascope/api/_generated/organizations/types/organizations_get_response.py +24 -0
  43. mirascope/api/_generated/organizations/types/organizations_get_response_role.py +7 -0
  44. mirascope/api/_generated/organizations/types/organizations_list_response_item.py +24 -0
  45. mirascope/api/_generated/organizations/types/organizations_list_response_item_role.py +7 -0
  46. mirascope/api/_generated/organizations/types/organizations_update_response.py +24 -0
  47. mirascope/api/_generated/organizations/types/organizations_update_response_role.py +7 -0
  48. mirascope/api/_generated/projects/__init__.py +17 -0
  49. mirascope/api/_generated/projects/client.py +458 -0
  50. mirascope/api/_generated/projects/raw_client.py +1016 -0
  51. mirascope/api/_generated/projects/types/__init__.py +15 -0
  52. mirascope/api/_generated/projects/types/projects_create_response.py +30 -0
  53. mirascope/api/_generated/projects/types/projects_get_response.py +30 -0
  54. mirascope/api/_generated/projects/types/projects_list_response_item.py +30 -0
  55. mirascope/api/_generated/projects/types/projects_update_response.py +30 -0
  56. mirascope/api/_generated/reference.md +753 -0
  57. mirascope/api/_generated/traces/__init__.py +55 -0
  58. mirascope/api/_generated/traces/client.py +162 -0
  59. mirascope/api/_generated/traces/raw_client.py +168 -0
  60. mirascope/api/_generated/traces/types/__init__.py +95 -0
  61. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item.py +36 -0
  62. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource.py +31 -0
  63. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item.py +25 -0
  64. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value.py +54 -0
  65. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_array_value.py +23 -0
  66. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_kvlist_value.py +28 -0
  67. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_kvlist_value_values_item.py +24 -0
  68. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item.py +35 -0
  69. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope.py +35 -0
  70. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item.py +27 -0
  71. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value.py +54 -0
  72. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_array_value.py +23 -0
  73. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_kvlist_value.py +28 -0
  74. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_kvlist_value_values_item.py +24 -0
  75. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item.py +60 -0
  76. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item.py +29 -0
  77. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value.py +54 -0
  78. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_array_value.py +23 -0
  79. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_kvlist_value.py +28 -0
  80. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_kvlist_value_values_item.py +24 -0
  81. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_status.py +24 -0
  82. mirascope/api/_generated/traces/types/traces_create_response.py +27 -0
  83. mirascope/api/_generated/traces/types/traces_create_response_partial_success.py +28 -0
  84. mirascope/api/_generated/types/__init__.py +37 -0
  85. mirascope/api/_generated/types/already_exists_error.py +24 -0
  86. mirascope/api/_generated/types/already_exists_error_tag.py +5 -0
  87. mirascope/api/_generated/types/database_error.py +24 -0
  88. mirascope/api/_generated/types/database_error_tag.py +5 -0
  89. mirascope/api/_generated/types/http_api_decode_error.py +29 -0
  90. mirascope/api/_generated/types/http_api_decode_error_tag.py +5 -0
  91. mirascope/api/_generated/types/issue.py +40 -0
  92. mirascope/api/_generated/types/issue_tag.py +17 -0
  93. mirascope/api/_generated/types/not_found_error_body.py +24 -0
  94. mirascope/api/_generated/types/not_found_error_tag.py +5 -0
  95. mirascope/api/_generated/types/permission_denied_error.py +24 -0
  96. mirascope/api/_generated/types/permission_denied_error_tag.py +7 -0
  97. mirascope/api/_generated/types/property_key.py +7 -0
  98. mirascope/api/_generated/types/property_key_key.py +27 -0
  99. mirascope/api/_generated/types/property_key_key_tag.py +5 -0
  100. mirascope/api/client.py +255 -0
  101. mirascope/api/settings.py +81 -0
  102. mirascope/llm/__init__.py +45 -11
  103. mirascope/llm/calls/calls.py +81 -57
  104. mirascope/llm/calls/decorator.py +121 -115
  105. mirascope/llm/content/__init__.py +3 -2
  106. mirascope/llm/context/_utils.py +19 -6
  107. mirascope/llm/exceptions.py +30 -16
  108. mirascope/llm/formatting/_utils.py +9 -5
  109. mirascope/llm/formatting/format.py +2 -2
  110. mirascope/llm/formatting/from_call_args.py +2 -2
  111. mirascope/llm/messages/message.py +13 -5
  112. mirascope/llm/models/__init__.py +2 -2
  113. mirascope/llm/models/models.py +189 -81
  114. mirascope/llm/prompts/__init__.py +13 -12
  115. mirascope/llm/prompts/_utils.py +27 -24
  116. mirascope/llm/prompts/decorator.py +133 -204
  117. mirascope/llm/prompts/prompts.py +424 -0
  118. mirascope/llm/prompts/protocols.py +25 -59
  119. mirascope/llm/providers/__init__.py +44 -0
  120. mirascope/llm/{clients → providers}/_missing_import_stubs.py +8 -6
  121. mirascope/llm/providers/anthropic/__init__.py +29 -0
  122. mirascope/llm/providers/anthropic/_utils/__init__.py +23 -0
  123. mirascope/llm/providers/anthropic/_utils/beta_decode.py +271 -0
  124. mirascope/llm/providers/anthropic/_utils/beta_encode.py +216 -0
  125. mirascope/llm/{clients → providers}/anthropic/_utils/decode.py +44 -11
  126. mirascope/llm/providers/anthropic/_utils/encode.py +356 -0
  127. mirascope/llm/providers/anthropic/beta_provider.py +322 -0
  128. mirascope/llm/providers/anthropic/model_id.py +23 -0
  129. mirascope/llm/providers/anthropic/model_info.py +87 -0
  130. mirascope/llm/providers/anthropic/provider.py +416 -0
  131. mirascope/llm/{clients → providers}/base/__init__.py +3 -3
  132. mirascope/llm/{clients → providers}/base/_utils.py +25 -8
  133. mirascope/llm/{clients/base/client.py → providers/base/base_provider.py} +255 -126
  134. mirascope/llm/providers/google/__init__.py +21 -0
  135. mirascope/llm/{clients → providers}/google/_utils/decode.py +61 -7
  136. mirascope/llm/{clients → providers}/google/_utils/encode.py +44 -30
  137. mirascope/llm/providers/google/model_id.py +22 -0
  138. mirascope/llm/providers/google/model_info.py +62 -0
  139. mirascope/llm/providers/google/provider.py +442 -0
  140. mirascope/llm/providers/load_provider.py +54 -0
  141. mirascope/llm/providers/mlx/__init__.py +24 -0
  142. mirascope/llm/providers/mlx/_utils.py +129 -0
  143. mirascope/llm/providers/mlx/encoding/__init__.py +8 -0
  144. mirascope/llm/providers/mlx/encoding/base.py +69 -0
  145. mirascope/llm/providers/mlx/encoding/transformers.py +147 -0
  146. mirascope/llm/providers/mlx/mlx.py +237 -0
  147. mirascope/llm/providers/mlx/model_id.py +17 -0
  148. mirascope/llm/providers/mlx/provider.py +415 -0
  149. mirascope/llm/providers/model_id.py +16 -0
  150. mirascope/llm/providers/ollama/__init__.py +19 -0
  151. mirascope/llm/providers/ollama/provider.py +71 -0
  152. mirascope/llm/providers/openai/__init__.py +6 -0
  153. mirascope/llm/providers/openai/completions/__init__.py +25 -0
  154. mirascope/llm/{clients → providers}/openai/completions/_utils/__init__.py +2 -0
  155. mirascope/llm/{clients → providers}/openai/completions/_utils/decode.py +60 -6
  156. mirascope/llm/{clients → providers}/openai/completions/_utils/encode.py +37 -26
  157. mirascope/llm/providers/openai/completions/base_provider.py +513 -0
  158. mirascope/llm/providers/openai/completions/provider.py +22 -0
  159. mirascope/llm/providers/openai/model_id.py +31 -0
  160. mirascope/llm/providers/openai/model_info.py +303 -0
  161. mirascope/llm/providers/openai/provider.py +398 -0
  162. mirascope/llm/providers/openai/responses/__init__.py +21 -0
  163. mirascope/llm/{clients → providers}/openai/responses/_utils/decode.py +59 -6
  164. mirascope/llm/{clients → providers}/openai/responses/_utils/encode.py +34 -23
  165. mirascope/llm/providers/openai/responses/provider.py +469 -0
  166. mirascope/llm/providers/provider_id.py +23 -0
  167. mirascope/llm/providers/provider_registry.py +169 -0
  168. mirascope/llm/providers/together/__init__.py +19 -0
  169. mirascope/llm/providers/together/provider.py +40 -0
  170. mirascope/llm/responses/__init__.py +3 -0
  171. mirascope/llm/responses/base_response.py +14 -5
  172. mirascope/llm/responses/base_stream_response.py +35 -6
  173. mirascope/llm/responses/finish_reason.py +1 -0
  174. mirascope/llm/responses/response.py +33 -13
  175. mirascope/llm/responses/root_response.py +12 -13
  176. mirascope/llm/responses/stream_response.py +35 -23
  177. mirascope/llm/responses/usage.py +95 -0
  178. mirascope/llm/tools/__init__.py +9 -2
  179. mirascope/llm/tools/_utils.py +12 -3
  180. mirascope/llm/tools/protocols.py +4 -4
  181. mirascope/llm/tools/tool_schema.py +44 -9
  182. mirascope/llm/tools/tools.py +10 -9
  183. mirascope/ops/__init__.py +156 -0
  184. mirascope/ops/_internal/__init__.py +5 -0
  185. mirascope/ops/_internal/closure.py +1118 -0
  186. mirascope/ops/_internal/configuration.py +126 -0
  187. mirascope/ops/_internal/context.py +76 -0
  188. mirascope/ops/_internal/exporters/__init__.py +26 -0
  189. mirascope/ops/_internal/exporters/exporters.py +342 -0
  190. mirascope/ops/_internal/exporters/processors.py +104 -0
  191. mirascope/ops/_internal/exporters/types.py +165 -0
  192. mirascope/ops/_internal/exporters/utils.py +29 -0
  193. mirascope/ops/_internal/instrumentation/__init__.py +8 -0
  194. mirascope/ops/_internal/instrumentation/llm/__init__.py +8 -0
  195. mirascope/ops/_internal/instrumentation/llm/encode.py +238 -0
  196. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/__init__.py +38 -0
  197. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/gen_ai_input_messages.py +31 -0
  198. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/gen_ai_output_messages.py +38 -0
  199. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/gen_ai_system_instructions.py +18 -0
  200. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/shared.py +100 -0
  201. mirascope/ops/_internal/instrumentation/llm/llm.py +1288 -0
  202. mirascope/ops/_internal/propagation.py +198 -0
  203. mirascope/ops/_internal/protocols.py +51 -0
  204. mirascope/ops/_internal/session.py +139 -0
  205. mirascope/ops/_internal/spans.py +232 -0
  206. mirascope/ops/_internal/traced_calls.py +371 -0
  207. mirascope/ops/_internal/traced_functions.py +394 -0
  208. mirascope/ops/_internal/tracing.py +276 -0
  209. mirascope/ops/_internal/types.py +13 -0
  210. mirascope/ops/_internal/utils.py +75 -0
  211. mirascope/ops/_internal/versioned_calls.py +512 -0
  212. mirascope/ops/_internal/versioned_functions.py +346 -0
  213. mirascope/ops/_internal/versioning.py +303 -0
  214. mirascope/ops/exceptions.py +21 -0
  215. {mirascope-2.0.0a2.dist-info → mirascope-2.0.0a4.dist-info}/METADATA +78 -3
  216. mirascope-2.0.0a4.dist-info/RECORD +247 -0
  217. {mirascope-2.0.0a2.dist-info → mirascope-2.0.0a4.dist-info}/WHEEL +1 -1
  218. mirascope/graphs/__init__.py +0 -22
  219. mirascope/graphs/finite_state_machine.py +0 -625
  220. mirascope/llm/agents/__init__.py +0 -15
  221. mirascope/llm/agents/agent.py +0 -97
  222. mirascope/llm/agents/agent_template.py +0 -45
  223. mirascope/llm/agents/decorator.py +0 -176
  224. mirascope/llm/calls/base_call.py +0 -33
  225. mirascope/llm/clients/__init__.py +0 -34
  226. mirascope/llm/clients/anthropic/__init__.py +0 -25
  227. mirascope/llm/clients/anthropic/_utils/encode.py +0 -243
  228. mirascope/llm/clients/anthropic/clients.py +0 -819
  229. mirascope/llm/clients/anthropic/model_ids.py +0 -8
  230. mirascope/llm/clients/google/__init__.py +0 -20
  231. mirascope/llm/clients/google/clients.py +0 -853
  232. mirascope/llm/clients/google/model_ids.py +0 -15
  233. mirascope/llm/clients/openai/__init__.py +0 -25
  234. mirascope/llm/clients/openai/completions/__init__.py +0 -28
  235. mirascope/llm/clients/openai/completions/_utils/model_features.py +0 -81
  236. mirascope/llm/clients/openai/completions/clients.py +0 -833
  237. mirascope/llm/clients/openai/completions/model_ids.py +0 -8
  238. mirascope/llm/clients/openai/responses/__init__.py +0 -26
  239. mirascope/llm/clients/openai/responses/_utils/__init__.py +0 -13
  240. mirascope/llm/clients/openai/responses/_utils/model_features.py +0 -87
  241. mirascope/llm/clients/openai/responses/clients.py +0 -832
  242. mirascope/llm/clients/openai/responses/model_ids.py +0 -8
  243. mirascope/llm/clients/openai/shared/__init__.py +0 -7
  244. mirascope/llm/clients/openai/shared/_utils.py +0 -55
  245. mirascope/llm/clients/providers.py +0 -175
  246. mirascope-2.0.0a2.dist-info/RECORD +0 -102
  247. /mirascope/llm/{clients → providers}/base/kwargs.py +0 -0
  248. /mirascope/llm/{clients → providers}/base/params.py +0 -0
  249. /mirascope/llm/{clients/anthropic → providers/google}/_utils/__init__.py +0 -0
  250. /mirascope/llm/{clients → providers}/google/message.py +0 -0
  251. /mirascope/llm/{clients/google → providers/openai/responses}/_utils/__init__.py +0 -0
  252. {mirascope-2.0.0a2.dist-info → mirascope-2.0.0a4.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,96 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.request_options import RequestOptions
7
+ from .raw_client import AsyncRawHealthClient, RawHealthClient
8
+ from .types.health_check_response import HealthCheckResponse
9
+
10
+
11
+ class HealthClient:
12
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
13
+ self._raw_client = RawHealthClient(client_wrapper=client_wrapper)
14
+
15
+ @property
16
+ def with_raw_response(self) -> RawHealthClient:
17
+ """
18
+ Retrieves a raw implementation of this client that returns raw responses.
19
+
20
+ Returns
21
+ -------
22
+ RawHealthClient
23
+ """
24
+ return self._raw_client
25
+
26
+ def check(
27
+ self, *, request_options: typing.Optional[RequestOptions] = None
28
+ ) -> HealthCheckResponse:
29
+ """
30
+ Parameters
31
+ ----------
32
+ request_options : typing.Optional[RequestOptions]
33
+ Request-specific configuration.
34
+
35
+ Returns
36
+ -------
37
+ HealthCheckResponse
38
+ Success
39
+
40
+ Examples
41
+ --------
42
+ from mirascope.api._generated import Mirascope
43
+
44
+ client = Mirascope()
45
+ client.health.check()
46
+ """
47
+ _response = self._raw_client.check(request_options=request_options)
48
+ return _response.data
49
+
50
+
51
+ class AsyncHealthClient:
52
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
53
+ self._raw_client = AsyncRawHealthClient(client_wrapper=client_wrapper)
54
+
55
+ @property
56
+ def with_raw_response(self) -> AsyncRawHealthClient:
57
+ """
58
+ Retrieves a raw implementation of this client that returns raw responses.
59
+
60
+ Returns
61
+ -------
62
+ AsyncRawHealthClient
63
+ """
64
+ return self._raw_client
65
+
66
+ async def check(
67
+ self, *, request_options: typing.Optional[RequestOptions] = None
68
+ ) -> HealthCheckResponse:
69
+ """
70
+ Parameters
71
+ ----------
72
+ request_options : typing.Optional[RequestOptions]
73
+ Request-specific configuration.
74
+
75
+ Returns
76
+ -------
77
+ HealthCheckResponse
78
+ Success
79
+
80
+ Examples
81
+ --------
82
+ import asyncio
83
+
84
+ from mirascope.api._generated import AsyncMirascope
85
+
86
+ client = AsyncMirascope()
87
+
88
+
89
+ async def main() -> None:
90
+ await client.health.check()
91
+
92
+
93
+ asyncio.run(main())
94
+ """
95
+ _response = await self._raw_client.check(request_options=request_options)
96
+ return _response.data
@@ -0,0 +1,129 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.pydantic_utilities import parse_obj_as
10
+ from ..core.request_options import RequestOptions
11
+ from ..errors.bad_request_error import BadRequestError
12
+ from ..types.http_api_decode_error import HttpApiDecodeError
13
+ from .types.health_check_response import HealthCheckResponse
14
+
15
+
16
+ class RawHealthClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._client_wrapper = client_wrapper
19
+
20
+ def check(
21
+ self, *, request_options: typing.Optional[RequestOptions] = None
22
+ ) -> HttpResponse[HealthCheckResponse]:
23
+ """
24
+ Parameters
25
+ ----------
26
+ request_options : typing.Optional[RequestOptions]
27
+ Request-specific configuration.
28
+
29
+ Returns
30
+ -------
31
+ HttpResponse[HealthCheckResponse]
32
+ Success
33
+ """
34
+ _response = self._client_wrapper.httpx_client.request(
35
+ "health",
36
+ method="GET",
37
+ request_options=request_options,
38
+ )
39
+ try:
40
+ if 200 <= _response.status_code < 300:
41
+ _data = typing.cast(
42
+ HealthCheckResponse,
43
+ parse_obj_as(
44
+ type_=HealthCheckResponse, # type: ignore
45
+ object_=_response.json(),
46
+ ),
47
+ )
48
+ return HttpResponse(response=_response, data=_data)
49
+ if _response.status_code == 400:
50
+ raise BadRequestError(
51
+ headers=dict(_response.headers),
52
+ body=typing.cast(
53
+ HttpApiDecodeError,
54
+ parse_obj_as(
55
+ type_=HttpApiDecodeError, # type: ignore
56
+ object_=_response.json(),
57
+ ),
58
+ ),
59
+ )
60
+ _response_json = _response.json()
61
+ except JSONDecodeError:
62
+ raise ApiError(
63
+ status_code=_response.status_code,
64
+ headers=dict(_response.headers),
65
+ body=_response.text,
66
+ )
67
+ raise ApiError(
68
+ status_code=_response.status_code,
69
+ headers=dict(_response.headers),
70
+ body=_response_json,
71
+ )
72
+
73
+
74
+ class AsyncRawHealthClient:
75
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
76
+ self._client_wrapper = client_wrapper
77
+
78
+ async def check(
79
+ self, *, request_options: typing.Optional[RequestOptions] = None
80
+ ) -> AsyncHttpResponse[HealthCheckResponse]:
81
+ """
82
+ Parameters
83
+ ----------
84
+ request_options : typing.Optional[RequestOptions]
85
+ Request-specific configuration.
86
+
87
+ Returns
88
+ -------
89
+ AsyncHttpResponse[HealthCheckResponse]
90
+ Success
91
+ """
92
+ _response = await self._client_wrapper.httpx_client.request(
93
+ "health",
94
+ method="GET",
95
+ request_options=request_options,
96
+ )
97
+ try:
98
+ if 200 <= _response.status_code < 300:
99
+ _data = typing.cast(
100
+ HealthCheckResponse,
101
+ parse_obj_as(
102
+ type_=HealthCheckResponse, # type: ignore
103
+ object_=_response.json(),
104
+ ),
105
+ )
106
+ return AsyncHttpResponse(response=_response, data=_data)
107
+ if _response.status_code == 400:
108
+ raise BadRequestError(
109
+ headers=dict(_response.headers),
110
+ body=typing.cast(
111
+ HttpApiDecodeError,
112
+ parse_obj_as(
113
+ type_=HttpApiDecodeError, # type: ignore
114
+ object_=_response.json(),
115
+ ),
116
+ ),
117
+ )
118
+ _response_json = _response.json()
119
+ except JSONDecodeError:
120
+ raise ApiError(
121
+ status_code=_response.status_code,
122
+ headers=dict(_response.headers),
123
+ body=_response.text,
124
+ )
125
+ raise ApiError(
126
+ status_code=_response.status_code,
127
+ headers=dict(_response.headers),
128
+ body=_response_json,
129
+ )
@@ -0,0 +1,8 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .health_check_response import HealthCheckResponse
6
+ from .health_check_response_status import HealthCheckResponseStatus
7
+
8
+ __all__ = ["HealthCheckResponse", "HealthCheckResponseStatus"]
@@ -0,0 +1,24 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+ from .health_check_response_status import HealthCheckResponseStatus
8
+
9
+
10
+ class HealthCheckResponse(UniversalBaseModel):
11
+ status: HealthCheckResponseStatus
12
+ timestamp: str
13
+ environment: str
14
+
15
+ if IS_PYDANTIC_V2:
16
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
17
+ extra="allow", frozen=True
18
+ ) # type: ignore # Pydantic v2
19
+ else:
20
+
21
+ class Config:
22
+ frozen = True
23
+ smart_union = True
24
+ extra = pydantic.Extra.allow
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ HealthCheckResponseStatus = typing.Union[typing.Literal["ok"], typing.Any]
@@ -0,0 +1,25 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .types import (
6
+ OrganizationsCreateResponse,
7
+ OrganizationsCreateResponseRole,
8
+ OrganizationsGetResponse,
9
+ OrganizationsGetResponseRole,
10
+ OrganizationsListResponseItem,
11
+ OrganizationsListResponseItemRole,
12
+ OrganizationsUpdateResponse,
13
+ OrganizationsUpdateResponseRole,
14
+ )
15
+
16
+ __all__ = [
17
+ "OrganizationsCreateResponse",
18
+ "OrganizationsCreateResponseRole",
19
+ "OrganizationsGetResponse",
20
+ "OrganizationsGetResponseRole",
21
+ "OrganizationsListResponseItem",
22
+ "OrganizationsListResponseItemRole",
23
+ "OrganizationsUpdateResponse",
24
+ "OrganizationsUpdateResponseRole",
25
+ ]
@@ -0,0 +1,380 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.request_options import RequestOptions
7
+ from .raw_client import AsyncRawOrganizationsClient, RawOrganizationsClient
8
+ from .types.organizations_create_response import OrganizationsCreateResponse
9
+ from .types.organizations_get_response import OrganizationsGetResponse
10
+ from .types.organizations_list_response_item import OrganizationsListResponseItem
11
+ from .types.organizations_update_response import OrganizationsUpdateResponse
12
+
13
+ # this is used as the default value for optional parameters
14
+ OMIT = typing.cast(typing.Any, ...)
15
+
16
+
17
+ class OrganizationsClient:
18
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
19
+ self._raw_client = RawOrganizationsClient(client_wrapper=client_wrapper)
20
+
21
+ @property
22
+ def with_raw_response(self) -> RawOrganizationsClient:
23
+ """
24
+ Retrieves a raw implementation of this client that returns raw responses.
25
+
26
+ Returns
27
+ -------
28
+ RawOrganizationsClient
29
+ """
30
+ return self._raw_client
31
+
32
+ def list(
33
+ self, *, request_options: typing.Optional[RequestOptions] = None
34
+ ) -> typing.List[OrganizationsListResponseItem]:
35
+ """
36
+ Parameters
37
+ ----------
38
+ request_options : typing.Optional[RequestOptions]
39
+ Request-specific configuration.
40
+
41
+ Returns
42
+ -------
43
+ typing.List[OrganizationsListResponseItem]
44
+ Success
45
+
46
+ Examples
47
+ --------
48
+ from mirascope.api._generated import Mirascope
49
+
50
+ client = Mirascope()
51
+ client.organizations.list()
52
+ """
53
+ _response = self._raw_client.list(request_options=request_options)
54
+ return _response.data
55
+
56
+ def create(
57
+ self, *, name: str, request_options: typing.Optional[RequestOptions] = None
58
+ ) -> OrganizationsCreateResponse:
59
+ """
60
+ Parameters
61
+ ----------
62
+ name : str
63
+ a string at most 100 character(s) long
64
+
65
+ request_options : typing.Optional[RequestOptions]
66
+ Request-specific configuration.
67
+
68
+ Returns
69
+ -------
70
+ OrganizationsCreateResponse
71
+ Success
72
+
73
+ Examples
74
+ --------
75
+ from mirascope.api._generated import Mirascope
76
+
77
+ client = Mirascope()
78
+ client.organizations.create(
79
+ name="name",
80
+ )
81
+ """
82
+ _response = self._raw_client.create(name=name, request_options=request_options)
83
+ return _response.data
84
+
85
+ def get(
86
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
87
+ ) -> OrganizationsGetResponse:
88
+ """
89
+ Parameters
90
+ ----------
91
+ id : str
92
+
93
+ request_options : typing.Optional[RequestOptions]
94
+ Request-specific configuration.
95
+
96
+ Returns
97
+ -------
98
+ OrganizationsGetResponse
99
+ Success
100
+
101
+ Examples
102
+ --------
103
+ from mirascope.api._generated import Mirascope
104
+
105
+ client = Mirascope()
106
+ client.organizations.get(
107
+ id="id",
108
+ )
109
+ """
110
+ _response = self._raw_client.get(id, request_options=request_options)
111
+ return _response.data
112
+
113
+ def update(
114
+ self,
115
+ id: str,
116
+ *,
117
+ name: str,
118
+ request_options: typing.Optional[RequestOptions] = None,
119
+ ) -> OrganizationsUpdateResponse:
120
+ """
121
+ Parameters
122
+ ----------
123
+ id : str
124
+
125
+ name : str
126
+ a string at most 100 character(s) long
127
+
128
+ request_options : typing.Optional[RequestOptions]
129
+ Request-specific configuration.
130
+
131
+ Returns
132
+ -------
133
+ OrganizationsUpdateResponse
134
+ Success
135
+
136
+ Examples
137
+ --------
138
+ from mirascope.api._generated import Mirascope
139
+
140
+ client = Mirascope()
141
+ client.organizations.update(
142
+ id="id",
143
+ name="name",
144
+ )
145
+ """
146
+ _response = self._raw_client.update(
147
+ id, name=name, request_options=request_options
148
+ )
149
+ return _response.data
150
+
151
+ def delete(
152
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
153
+ ) -> None:
154
+ """
155
+ Parameters
156
+ ----------
157
+ id : str
158
+
159
+ request_options : typing.Optional[RequestOptions]
160
+ Request-specific configuration.
161
+
162
+ Returns
163
+ -------
164
+ None
165
+
166
+ Examples
167
+ --------
168
+ from mirascope.api._generated import Mirascope
169
+
170
+ client = Mirascope()
171
+ client.organizations.delete(
172
+ id="id",
173
+ )
174
+ """
175
+ _response = self._raw_client.delete(id, request_options=request_options)
176
+ return _response.data
177
+
178
+
179
+ class AsyncOrganizationsClient:
180
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
181
+ self._raw_client = AsyncRawOrganizationsClient(client_wrapper=client_wrapper)
182
+
183
+ @property
184
+ def with_raw_response(self) -> AsyncRawOrganizationsClient:
185
+ """
186
+ Retrieves a raw implementation of this client that returns raw responses.
187
+
188
+ Returns
189
+ -------
190
+ AsyncRawOrganizationsClient
191
+ """
192
+ return self._raw_client
193
+
194
+ async def list(
195
+ self, *, request_options: typing.Optional[RequestOptions] = None
196
+ ) -> typing.List[OrganizationsListResponseItem]:
197
+ """
198
+ Parameters
199
+ ----------
200
+ request_options : typing.Optional[RequestOptions]
201
+ Request-specific configuration.
202
+
203
+ Returns
204
+ -------
205
+ typing.List[OrganizationsListResponseItem]
206
+ Success
207
+
208
+ Examples
209
+ --------
210
+ import asyncio
211
+
212
+ from mirascope.api._generated import AsyncMirascope
213
+
214
+ client = AsyncMirascope()
215
+
216
+
217
+ async def main() -> None:
218
+ await client.organizations.list()
219
+
220
+
221
+ asyncio.run(main())
222
+ """
223
+ _response = await self._raw_client.list(request_options=request_options)
224
+ return _response.data
225
+
226
+ async def create(
227
+ self, *, name: str, request_options: typing.Optional[RequestOptions] = None
228
+ ) -> OrganizationsCreateResponse:
229
+ """
230
+ Parameters
231
+ ----------
232
+ name : str
233
+ a string at most 100 character(s) long
234
+
235
+ request_options : typing.Optional[RequestOptions]
236
+ Request-specific configuration.
237
+
238
+ Returns
239
+ -------
240
+ OrganizationsCreateResponse
241
+ Success
242
+
243
+ Examples
244
+ --------
245
+ import asyncio
246
+
247
+ from mirascope.api._generated import AsyncMirascope
248
+
249
+ client = AsyncMirascope()
250
+
251
+
252
+ async def main() -> None:
253
+ await client.organizations.create(
254
+ name="name",
255
+ )
256
+
257
+
258
+ asyncio.run(main())
259
+ """
260
+ _response = await self._raw_client.create(
261
+ name=name, request_options=request_options
262
+ )
263
+ return _response.data
264
+
265
+ async def get(
266
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
267
+ ) -> OrganizationsGetResponse:
268
+ """
269
+ Parameters
270
+ ----------
271
+ id : str
272
+
273
+ request_options : typing.Optional[RequestOptions]
274
+ Request-specific configuration.
275
+
276
+ Returns
277
+ -------
278
+ OrganizationsGetResponse
279
+ Success
280
+
281
+ Examples
282
+ --------
283
+ import asyncio
284
+
285
+ from mirascope.api._generated import AsyncMirascope
286
+
287
+ client = AsyncMirascope()
288
+
289
+
290
+ async def main() -> None:
291
+ await client.organizations.get(
292
+ id="id",
293
+ )
294
+
295
+
296
+ asyncio.run(main())
297
+ """
298
+ _response = await self._raw_client.get(id, request_options=request_options)
299
+ return _response.data
300
+
301
+ async def update(
302
+ self,
303
+ id: str,
304
+ *,
305
+ name: str,
306
+ request_options: typing.Optional[RequestOptions] = None,
307
+ ) -> OrganizationsUpdateResponse:
308
+ """
309
+ Parameters
310
+ ----------
311
+ id : str
312
+
313
+ name : str
314
+ a string at most 100 character(s) long
315
+
316
+ request_options : typing.Optional[RequestOptions]
317
+ Request-specific configuration.
318
+
319
+ Returns
320
+ -------
321
+ OrganizationsUpdateResponse
322
+ Success
323
+
324
+ Examples
325
+ --------
326
+ import asyncio
327
+
328
+ from mirascope.api._generated import AsyncMirascope
329
+
330
+ client = AsyncMirascope()
331
+
332
+
333
+ async def main() -> None:
334
+ await client.organizations.update(
335
+ id="id",
336
+ name="name",
337
+ )
338
+
339
+
340
+ asyncio.run(main())
341
+ """
342
+ _response = await self._raw_client.update(
343
+ id, name=name, request_options=request_options
344
+ )
345
+ return _response.data
346
+
347
+ async def delete(
348
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
349
+ ) -> None:
350
+ """
351
+ Parameters
352
+ ----------
353
+ id : str
354
+
355
+ request_options : typing.Optional[RequestOptions]
356
+ Request-specific configuration.
357
+
358
+ Returns
359
+ -------
360
+ None
361
+
362
+ Examples
363
+ --------
364
+ import asyncio
365
+
366
+ from mirascope.api._generated import AsyncMirascope
367
+
368
+ client = AsyncMirascope()
369
+
370
+
371
+ async def main() -> None:
372
+ await client.organizations.delete(
373
+ id="id",
374
+ )
375
+
376
+
377
+ asyncio.run(main())
378
+ """
379
+ _response = await self._raw_client.delete(id, request_options=request_options)
380
+ return _response.data