mirascope 2.0.0a0__py3-none-any.whl → 2.0.0a1__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/llm/__init__.py +5 -1
- mirascope/llm/clients/_missing_import_stubs.py +47 -0
- mirascope/llm/clients/anthropic/__init__.py +16 -2
- mirascope/llm/clients/google/__init__.py +16 -2
- mirascope/llm/clients/openai/completions/__init__.py +21 -2
- mirascope/llm/clients/openai/responses/__init__.py +19 -2
- {mirascope-2.0.0a0.dist-info → mirascope-2.0.0a1.dist-info}/METADATA +10 -1
- {mirascope-2.0.0a0.dist-info → mirascope-2.0.0a1.dist-info}/RECORD +10 -9
- {mirascope-2.0.0a0.dist-info → mirascope-2.0.0a1.dist-info}/WHEEL +0 -0
- {mirascope-2.0.0a0.dist-info → mirascope-2.0.0a1.dist-info}/licenses/LICENSE +0 -0
mirascope/llm/__init__.py
CHANGED
|
@@ -8,13 +8,14 @@ code that works with multiple LLM providers without changing your application lo
|
|
|
8
8
|
# TODO: Across the API, audit docstrings to ensure they are compliant Google-style docstrings
|
|
9
9
|
# (Write some tooling to ensure this happens consistently + in CI)
|
|
10
10
|
|
|
11
|
+
from contextlib import suppress
|
|
12
|
+
|
|
11
13
|
from . import (
|
|
12
14
|
calls,
|
|
13
15
|
clients,
|
|
14
16
|
content,
|
|
15
17
|
exceptions,
|
|
16
18
|
formatting,
|
|
17
|
-
mcp,
|
|
18
19
|
messages,
|
|
19
20
|
models,
|
|
20
21
|
prompts,
|
|
@@ -22,6 +23,9 @@ from . import (
|
|
|
22
23
|
tools,
|
|
23
24
|
types,
|
|
24
25
|
)
|
|
26
|
+
|
|
27
|
+
with suppress(ImportError):
|
|
28
|
+
from . import mcp
|
|
25
29
|
from .calls import call
|
|
26
30
|
from .clients import ModelId, Params, Provider, client, get_client
|
|
27
31
|
from .content import (
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""Utilities for handling optional provider dependencies."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Callable
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def create_import_error_stub(
|
|
7
|
+
package_name: str, client_name: str
|
|
8
|
+
) -> Callable: # pragma: no cover
|
|
9
|
+
"""Create a stub that raises ImportError when called.
|
|
10
|
+
|
|
11
|
+
Args:
|
|
12
|
+
package_name: The package/extra name (e.g., "anthropic", "openai", "google")
|
|
13
|
+
client_name: The client name for the error message (e.g., "AnthropicClient")
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
A callable that raises `ImportError` with helpful message.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def _raise_not_installed() -> None:
|
|
20
|
+
raise ImportError(
|
|
21
|
+
f"The '{package_name}' package is required to use {client_name}. "
|
|
22
|
+
f"Install it with: `uv add 'mirascope[{package_name}]'`. "
|
|
23
|
+
"Or use `uv add 'mirascope[all]'` to support all providers."
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
return _raise_not_installed
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def create_client_stub(package_name: str, client_name: str) -> type: # pragma: no cover
|
|
30
|
+
"""Create a stub client class that raises ImportError when instantiated.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
package_name: The package/extra name (e.g., "anthropic", "openai", "google")
|
|
34
|
+
client_name: The client name for the error message (e.g., "AnthropicClient")
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
A stub class that raises `ImportError` on instantiation.
|
|
38
|
+
"""
|
|
39
|
+
error_fn = create_import_error_stub(package_name, client_name)
|
|
40
|
+
|
|
41
|
+
class _ClientStub:
|
|
42
|
+
"""Stub client that raises `ImportError` when instantiated."""
|
|
43
|
+
|
|
44
|
+
def __init__(self) -> None:
|
|
45
|
+
error_fn()
|
|
46
|
+
|
|
47
|
+
return _ClientStub
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
"""Anthropic client implementation."""
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
|
|
3
|
+
from typing import TYPE_CHECKING, Any
|
|
4
|
+
|
|
5
|
+
if TYPE_CHECKING:
|
|
6
|
+
from .clients import AnthropicClient, client, get_client
|
|
7
|
+
from .model_ids import AnthropicModelId
|
|
8
|
+
else:
|
|
9
|
+
try:
|
|
10
|
+
from .clients import AnthropicClient, client, get_client
|
|
11
|
+
from .model_ids import AnthropicModelId
|
|
12
|
+
except ImportError: # pragma: no cover
|
|
13
|
+
from .._missing_import_stubs import create_client_stub, create_import_error_stub
|
|
14
|
+
|
|
15
|
+
AnthropicClient = create_client_stub("anthropic", "AnthropicClient")
|
|
16
|
+
AnthropicModelId = str
|
|
17
|
+
client = create_import_error_stub("anthropic", "AnthropicClient")
|
|
18
|
+
get_client = create_import_error_stub("anthropic", "AnthropicClient")
|
|
5
19
|
|
|
6
20
|
__all__ = [
|
|
7
21
|
"AnthropicClient",
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"""Google client implementation."""
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
if TYPE_CHECKING:
|
|
6
|
+
from .clients import GoogleClient, client, get_client
|
|
7
|
+
from .model_ids import GoogleModelId
|
|
8
|
+
else:
|
|
9
|
+
try:
|
|
10
|
+
from .clients import GoogleClient, client, get_client
|
|
11
|
+
from .model_ids import GoogleModelId
|
|
12
|
+
except ImportError: # pragma: no cover
|
|
13
|
+
from .._missing_import_stubs import create_client_stub, create_import_error_stub
|
|
14
|
+
|
|
15
|
+
GoogleClient = create_client_stub("google", "GoogleClient")
|
|
16
|
+
GoogleModelId = str
|
|
17
|
+
client = create_import_error_stub("google", "GoogleClient")
|
|
18
|
+
get_client = create_import_error_stub("google", "GoogleClient")
|
|
5
19
|
|
|
6
20
|
__all__ = ["GoogleClient", "GoogleModelId", "client", "get_client"]
|
|
@@ -1,5 +1,24 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
if TYPE_CHECKING:
|
|
4
|
+
from .clients import OpenAICompletionsClient, client, get_client
|
|
5
|
+
from .model_ids import OpenAICompletionsModelId
|
|
6
|
+
else:
|
|
7
|
+
try:
|
|
8
|
+
from .clients import OpenAICompletionsClient, client, get_client
|
|
9
|
+
from .model_ids import OpenAICompletionsModelId
|
|
10
|
+
except ImportError: # pragma: no cover
|
|
11
|
+
from ..._missing_import_stubs import (
|
|
12
|
+
create_client_stub,
|
|
13
|
+
create_import_error_stub,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
OpenAICompletionsClient = create_client_stub(
|
|
17
|
+
"openai", "OpenAICompletionsClient"
|
|
18
|
+
)
|
|
19
|
+
OpenAICompletionsModelId = str
|
|
20
|
+
client = create_import_error_stub("openai", "OpenAICompletionsClient")
|
|
21
|
+
get_client = create_import_error_stub("openai", "OpenAICompletionsClient")
|
|
3
22
|
|
|
4
23
|
__all__ = [
|
|
5
24
|
"OpenAICompletionsClient",
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
if TYPE_CHECKING:
|
|
4
|
+
from .clients import OpenAIResponsesClient, client, get_client
|
|
5
|
+
from .model_ids import OpenAIResponsesModelId
|
|
6
|
+
else:
|
|
7
|
+
try:
|
|
8
|
+
from .clients import OpenAIResponsesClient, client, get_client
|
|
9
|
+
from .model_ids import OpenAIResponsesModelId
|
|
10
|
+
except ImportError: # pragma: no cover
|
|
11
|
+
from ..._missing_import_stubs import (
|
|
12
|
+
create_client_stub,
|
|
13
|
+
create_import_error_stub,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
OpenAIResponsesClient = create_client_stub("openai", "OpenAIResponsesClient")
|
|
17
|
+
OpenAIResponsesModelId = str
|
|
18
|
+
client = create_import_error_stub("openai", "OpenAIResponsesClient")
|
|
19
|
+
get_client = create_import_error_stub("openai", "OpenAIResponsesClient")
|
|
3
20
|
|
|
4
21
|
__all__ = [
|
|
5
22
|
"OpenAIResponsesClient",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mirascope
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0a1
|
|
4
4
|
Summary: LLM abstractions that aren't obstructions
|
|
5
5
|
Project-URL: Homepage, https://mirascope.com
|
|
6
6
|
Project-URL: Documentation, https://mirascope.com/docs/mirascope/v2
|
|
@@ -46,7 +46,16 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
|
46
46
|
Classifier: Topic :: Software Development :: Libraries
|
|
47
47
|
Requires-Python: >=3.10
|
|
48
48
|
Requires-Dist: docstring-parser>=0.17.0
|
|
49
|
+
Requires-Dist: httpx>=0.27.0
|
|
50
|
+
Requires-Dist: pydantic>=2.0.0
|
|
49
51
|
Requires-Dist: typing-extensions>=4.10.0
|
|
52
|
+
Provides-Extra: all
|
|
53
|
+
Requires-Dist: anthropic<1.0,>=0.72.0; extra == 'all'
|
|
54
|
+
Requires-Dist: google-genai<2,>=1.48.0; extra == 'all'
|
|
55
|
+
Requires-Dist: mcp<2,>=1.0.0; extra == 'all'
|
|
56
|
+
Requires-Dist: openai<3,>=2.7.1; extra == 'all'
|
|
57
|
+
Requires-Dist: pillow<11,>=10.4.0; extra == 'all'
|
|
58
|
+
Requires-Dist: proto-plus>=1.24.0; extra == 'all'
|
|
50
59
|
Provides-Extra: anthropic
|
|
51
60
|
Requires-Dist: anthropic<1.0,>=0.72.0; extra == 'anthropic'
|
|
52
61
|
Provides-Extra: google
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
mirascope/__init__.py,sha256=wKvhFqB-FAf_Fxi1_pEenLRUK-QGMbhlsY5aPGc0lug,98
|
|
2
2
|
mirascope/graphs/__init__.py,sha256=fkZHjSt6DvJAX-V3OCnDO7B1zJx5gv1Qp2G6P32wI7I,1086
|
|
3
3
|
mirascope/graphs/finite_state_machine.py,sha256=9j8kwQ6Ne3o-auP0KVdoA0hzW2txfM1wH3GSSnbZOyg,23261
|
|
4
|
-
mirascope/llm/__init__.py,sha256=
|
|
4
|
+
mirascope/llm/__init__.py,sha256=rB8y7UB95NjsizaDGEAzgNstV9fFlt89HJ0SjyAGLg4,4495
|
|
5
5
|
mirascope/llm/exceptions.py,sha256=30yPPCIr8Uwibqpt2Y0cDMsimVlQubAmjqbeO5kVpSA,3090
|
|
6
6
|
mirascope/llm/agents/__init__.py,sha256=aG5ymnBfa4ZFLfGPZjdXybwjC3lrlkkeLjKfx2Zzr0Q,363
|
|
7
7
|
mirascope/llm/agents/agent.py,sha256=obACeIZuD8FIUaZL_NF0u5GNeaxRpbyNb9PNipyYIZE,2959
|
|
@@ -12,8 +12,9 @@ mirascope/llm/calls/base_call.py,sha256=ghD8__Uw-RpL-TWI1zShThWugXmZCiEA2tLsZ-XH
|
|
|
12
12
|
mirascope/llm/calls/calls.py,sha256=R2hEGVsOHkZlBKcp4CvfssXABoLiIj9aKu80qrx6Ta4,9867
|
|
13
13
|
mirascope/llm/calls/decorator.py,sha256=77JLc1xIotl7dWxzyz5xYeKIRu8ykMxZ40yj9MNd79c,7472
|
|
14
14
|
mirascope/llm/clients/__init__.py,sha256=L00p7Kfk1gu8hSLXz3dvn3y0ku0rG6vPxq2vxRoukJI,770
|
|
15
|
+
mirascope/llm/clients/_missing_import_stubs.py,sha256=KKTd_CVhUOZLTm8Slt2U-C94VN5N8mm2x89rKhmzdoI,1550
|
|
15
16
|
mirascope/llm/clients/providers.py,sha256=GwZldKYXGaTPbkbAbGlCYyl2-CuR1dnz4smZGblyfqc,5095
|
|
16
|
-
mirascope/llm/clients/anthropic/__init__.py,sha256=
|
|
17
|
+
mirascope/llm/clients/anthropic/__init__.py,sha256=9V6UiDGuSXRJgkrbOHP9KW7KFHVb4Z_CMON2n8h-U6M,818
|
|
17
18
|
mirascope/llm/clients/anthropic/clients.py,sha256=8Z1Ol8V-JwCxefT2mQYUrfduliES2Yvk88hyM4GCNvc,27460
|
|
18
19
|
mirascope/llm/clients/anthropic/model_ids.py,sha256=0vp-nhDCYMw_3sKFD_tQO2FRlW8QzKiwXKBQ_lEv0yo,197
|
|
19
20
|
mirascope/llm/clients/anthropic/_utils/__init__.py,sha256=U2VNfEJCaqorAJBZDV7p3rFEp1fyk7vSitYFv_5G5Cs,232
|
|
@@ -24,7 +25,7 @@ mirascope/llm/clients/base/_utils.py,sha256=JyVXkbsHgOD_CnCNkq-aVdSmD4me0M40NPsd
|
|
|
24
25
|
mirascope/llm/clients/base/client.py,sha256=ffgxwMJ2vmbUB-KKzPwpgumzmGT2IhIr1yGqxYt9oBk,42258
|
|
25
26
|
mirascope/llm/clients/base/kwargs.py,sha256=pjaHVqtlmScUBqG8ZAllVaLoepdKE-KYl2eTqzOBXm0,406
|
|
26
27
|
mirascope/llm/clients/base/params.py,sha256=x2WLz0s5rMZ3u3GBGQmRlYGjecePtsLglHSJBLh35YE,3670
|
|
27
|
-
mirascope/llm/clients/google/__init__.py,sha256=
|
|
28
|
+
mirascope/llm/clients/google/__init__.py,sha256=Wsf-AfbFJ5kD-encD776uhjcINJV30NaDKhXpV_GZ-U,749
|
|
28
29
|
mirascope/llm/clients/google/clients.py,sha256=rsWJV5kfwh93RSRE6x45wnBhnP122mLCCuOdy1cD2u4,28073
|
|
29
30
|
mirascope/llm/clients/google/message.py,sha256=ryNsMKPSyBSVXl_H0MQEaSiWC3FFybjxIUuORNSiKTk,179
|
|
30
31
|
mirascope/llm/clients/google/model_ids.py,sha256=zJe9IAX4DIO6JXeTksAx77nwtlz1k2aO0YcJHsNpRx4,338
|
|
@@ -32,14 +33,14 @@ mirascope/llm/clients/google/_utils/__init__.py,sha256=U2VNfEJCaqorAJBZDV7p3rFEp
|
|
|
32
33
|
mirascope/llm/clients/google/_utils/decode.py,sha256=z__aZLIL130nCVV5CdAJPTiaCSw61mCrItTHVDffkQQ,9007
|
|
33
34
|
mirascope/llm/clients/google/_utils/encode.py,sha256=XFaRCzMQlUW3sm949pc-rPTavDgxSIjrxOllJ8KgR3k,10482
|
|
34
35
|
mirascope/llm/clients/openai/__init__.py,sha256=LkD4Kkxc-dnpR_K5f539xSfqEaXE1vioDcW7suOJhJE,600
|
|
35
|
-
mirascope/llm/clients/openai/completions/__init__.py,sha256=
|
|
36
|
+
mirascope/llm/clients/openai/completions/__init__.py,sha256=KUymq4dY6LiOdTLCMctmi2n9DiwGbfL_7K2Ha-AjnIE,912
|
|
36
37
|
mirascope/llm/clients/openai/completions/clients.py,sha256=GjfNV1ewRi1ADgsP0t5cxPdQUWyN65gRSPzDJFMhApg,28086
|
|
37
38
|
mirascope/llm/clients/openai/completions/model_ids.py,sha256=bno8SND8YbzoQE3Tjh9dxYo04luDILD3ndzQvgL5pAg,243
|
|
38
39
|
mirascope/llm/clients/openai/completions/_utils/__init__.py,sha256=U2VNfEJCaqorAJBZDV7p3rFEp1fyk7vSitYFv_5G5Cs,232
|
|
39
40
|
mirascope/llm/clients/openai/completions/_utils/decode.py,sha256=yiXPQwL33YNVxIZAABohqSO3ElEtiShVSki8fPQWf0A,6539
|
|
40
41
|
mirascope/llm/clients/openai/completions/_utils/encode.py,sha256=q2jP8By9TUiv66-oJpWZddn709ZRIGkXniSPTxLR2Co,13227
|
|
41
42
|
mirascope/llm/clients/openai/completions/_utils/model_features.py,sha256=iIm0uxNNfYOJ4qn1wmZjNrkCXNJK5czOPmn5UVBIjz4,3397
|
|
42
|
-
mirascope/llm/clients/openai/responses/__init__.py,sha256=
|
|
43
|
+
mirascope/llm/clients/openai/responses/__init__.py,sha256=qecYX7X20HJ_n2Elmo2SkF5SuxkuLmpJjUhe0M2ual8,868
|
|
43
44
|
mirascope/llm/clients/openai/responses/clients.py,sha256=dMIdp-Ua_stFAtT99gDp89woUyLyWShO4aAz8G_2nog,27627
|
|
44
45
|
mirascope/llm/clients/openai/responses/model_ids.py,sha256=30OQ8wnIVp6A3I4NsTPBLqfi-SB5dhzyB7ic5p_XXhg,239
|
|
45
46
|
mirascope/llm/clients/openai/responses/_utils/__init__.py,sha256=U2VNfEJCaqorAJBZDV7p3rFEp1fyk7vSitYFv_5G5Cs,232
|
|
@@ -95,7 +96,7 @@ mirascope/llm/types/__init__.py,sha256=lqzi1FkZ-s-D9-KQzVkAHuQQ1zp6B6yM3r9UNo46t
|
|
|
95
96
|
mirascope/llm/types/dataclass.py,sha256=y4_9M3Yqw_4I-H0V4TwvgGIp6JvRdtpW11NxqufnsJk,247
|
|
96
97
|
mirascope/llm/types/jsonable.py,sha256=KY6l21_RBhlHQRXQ_xy6pUqqbTVb_jVFSU4ykRy_OLU,1104
|
|
97
98
|
mirascope/llm/types/type_vars.py,sha256=OsAcQAZh5T_X8ZTLlP4GC1x3qgVY9rfYSnME8aMTDxw,642
|
|
98
|
-
mirascope-2.0.
|
|
99
|
-
mirascope-2.0.
|
|
100
|
-
mirascope-2.0.
|
|
101
|
-
mirascope-2.0.
|
|
99
|
+
mirascope-2.0.0a1.dist-info/METADATA,sha256=N1uJYt06NVrGixnQ1x4DsM3YXBsToFxXKzRI4OhxVsI,5417
|
|
100
|
+
mirascope-2.0.0a1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
101
|
+
mirascope-2.0.0a1.dist-info/licenses/LICENSE,sha256=LAs5Q8mdawTsVdONpDGukwsoc4KEUBmmonDEL39b23Y,1072
|
|
102
|
+
mirascope-2.0.0a1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|