mirascope 1.20.1__py3-none-any.whl → 1.21.0__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.
@@ -37,6 +37,9 @@ from .call_response import CallResponse
37
37
  from .call_response_chunk import CallResponseChunk
38
38
  from .stream import Stream
39
39
 
40
+ _P = ParamSpec("_P")
41
+ _R = TypeVar("_R", contravariant=True)
42
+
40
43
  _BaseStreamT = TypeVar("_BaseStreamT", covariant=True)
41
44
  _ResponseModelT = TypeVar("_ResponseModelT", bound=BaseModel | BaseType | Enum)
42
45
  _SameSyncAndAsyncClientT = TypeVar("_SameSyncAndAsyncClientT", contravariant=True)
@@ -45,15 +48,7 @@ _AsyncBaseClientT = TypeVar("_AsyncBaseClientT", contravariant=True)
45
48
  _BaseCallParamsT = TypeVar("_BaseCallParamsT", contravariant=True)
46
49
  _AsyncBaseDynamicConfigT = TypeVar("_AsyncBaseDynamicConfigT", contravariant=True)
47
50
  _BaseDynamicConfigT = TypeVar("_BaseDynamicConfigT", contravariant=True)
48
- _ResponseT = TypeVar("_ResponseT", covariant=True)
49
- _AsyncResponseT = TypeVar("_AsyncResponseT", covariant=True)
50
- _ResponseChunkT = TypeVar("_ResponseChunkT", covariant=True)
51
- _AsyncResponseChunkT = TypeVar("_AsyncResponseChunkT", covariant=True)
52
- _InvariantResponseChunkT = TypeVar("_InvariantResponseChunkT", contravariant=True)
53
- _BaseToolT = TypeVar("_BaseToolT", bound=BaseTool)
54
51
  _ParsedOutputT = TypeVar("_ParsedOutputT")
55
- _P = ParamSpec("_P")
56
- _R = TypeVar("_R", contravariant=True)
57
52
  _BaseCallResponseT = TypeVar(
58
53
  "_BaseCallResponseT", bound=BaseCallResponse, covariant=True
59
54
  )
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from functools import cached_property
6
- from typing import Any, TypeVar
6
+ from typing import Any
7
7
 
8
8
  from pydantic import computed_field
9
9
 
@@ -16,23 +16,23 @@ from ..core.base import (
16
16
  Usage,
17
17
  transform_tool_outputs,
18
18
  )
19
+ from ..core.base._utils import BaseMessageParamConverter
19
20
  from ..core.base.message_param import ToolResultPart
20
21
  from ..core.base.types import FinishReason
21
22
  from ._response_metaclass import _ResponseMetaclass
22
23
  from .tool import Tool
23
24
 
24
- _ResponseT = TypeVar("_ResponseT")
25
-
26
25
 
27
26
  class CallResponse(
28
27
  BaseCallResponse[
29
- _ResponseT,
28
+ Any,
30
29
  Tool,
31
30
  Any,
32
31
  BaseDynamicConfig[Any, Any, Any],
33
32
  BaseMessageParam,
34
33
  BaseCallParams,
35
34
  BaseMessageParam,
35
+ BaseMessageParamConverter,
36
36
  ],
37
37
  metaclass=_ResponseMetaclass,
38
38
  ):
@@ -42,11 +42,11 @@ class CallResponse(
42
42
  We rely on _response having `common_` methods or properties for normalization.
43
43
  """
44
44
 
45
- _response: BaseCallResponse[_ResponseT, Tool, Any, Any, Any, Any, Any]
45
+ _response: BaseCallResponse[Any, Tool, Any, Any, Any, Any, Any, Any]
46
46
 
47
47
  def __init__(
48
48
  self,
49
- response: BaseCallResponse[_ResponseT, Tool, Any, Any, Any, Any, Any],
49
+ response: BaseCallResponse[Any, Tool, Any, Any, Any, Any, Any, Any],
50
50
  ) -> None:
51
51
  super().__init__(
52
52
  **{
@@ -59,6 +59,7 @@ class CallResponse(
59
59
  object.__setattr__(
60
60
  self, "user_message_param", response.common_user_message_param
61
61
  )
62
+ object.__setattr__(self, "messages", response.common_messages)
62
63
 
63
64
  def __getattribute__(self, name: str) -> Any: # noqa: ANN401
64
65
  special_names = {
@@ -67,6 +68,7 @@ class CallResponse(
67
68
  "usage",
68
69
  "message_param",
69
70
  "user_message_param",
71
+ "messages",
70
72
  "tools",
71
73
  "tool",
72
74
  "tool_message_params",
@@ -2,25 +2,22 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Any, Generic, TypeVar
5
+ from typing import Any
6
6
 
7
7
  from ..core.base.call_response_chunk import BaseCallResponseChunk
8
8
  from ..core.base.types import CostMetadata, FinishReason, Usage
9
9
  from ._response_metaclass import _ResponseMetaclass
10
10
 
11
- _ChunkT = TypeVar("_ChunkT")
12
-
13
11
 
14
12
  class CallResponseChunk(
15
- BaseCallResponseChunk[_ChunkT, FinishReason],
16
- Generic[_ChunkT],
13
+ BaseCallResponseChunk[Any, FinishReason],
17
14
  metaclass=_ResponseMetaclass,
18
15
  ):
19
- _response: BaseCallResponseChunk[_ChunkT, Any]
16
+ _response: BaseCallResponseChunk[Any, Any]
20
17
 
21
18
  def __init__(
22
19
  self,
23
- response: BaseCallResponseChunk[_ChunkT, Any],
20
+ response: BaseCallResponseChunk[Any, Any],
24
21
  ) -> None:
25
22
  super().__init__(
26
23
  **{field: getattr(response, field) for field in response.model_fields}
mirascope/llm/stream.py CHANGED
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from collections.abc import AsyncGenerator, Generator
6
- from typing import Any, Generic, TypeVar
6
+ from typing import Any, TypeVar
7
7
 
8
8
  from ..core.base import (
9
9
  BaseCallParams,
@@ -37,44 +37,32 @@ _FinishReasonT = TypeVar("_FinishReasonT")
37
37
 
38
38
  class Stream(
39
39
  BaseStream[
40
- _BaseCallResponseT,
41
- _BaseCallResponseChunkT,
42
- _UserMessageParamT,
43
- _AssistantMessageParamT,
44
- _ToolMessageParamT,
45
- _MessageParamT,
46
- _BaseToolT,
47
- _ToolSchemaT,
48
- _BaseDynamicConfigT,
49
- _BaseCallParamsT,
40
+ BaseCallResponse,
41
+ BaseCallResponseChunk,
42
+ BaseMessageParam,
43
+ BaseMessageParam,
44
+ BaseMessageParam,
45
+ BaseMessageParam,
46
+ BaseTool,
47
+ Any,
48
+ BaseDynamicConfig,
49
+ BaseCallParams,
50
50
  FinishReason,
51
51
  ],
52
- Generic[
53
- _BaseCallResponseT,
54
- _BaseCallResponseChunkT,
55
- _UserMessageParamT,
56
- _AssistantMessageParamT,
57
- _ToolMessageParamT,
58
- _MessageParamT,
59
- _BaseToolT,
60
- _ToolSchemaT,
61
- _BaseDynamicConfigT,
62
- _BaseCallParamsT,
63
- ],
64
52
  ):
65
53
  """A non-pydantic class that inherits from BaseStream."""
66
54
 
67
55
  _stream: BaseStream[
68
- _BaseCallResponseT,
69
- _BaseCallResponseChunkT,
70
- _UserMessageParamT,
71
- _AssistantMessageParamT,
72
- _ToolMessageParamT,
73
- _MessageParamT,
74
- _BaseToolT,
75
- _ToolSchemaT,
76
- _BaseDynamicConfigT,
77
- _BaseCallParamsT,
56
+ BaseCallResponse,
57
+ BaseCallResponseChunk,
58
+ BaseMessageParam,
59
+ BaseMessageParam,
60
+ BaseMessageParam,
61
+ BaseMessageParam,
62
+ BaseTool,
63
+ Any,
64
+ BaseDynamicConfig,
65
+ BaseCallParams,
78
66
  FinishReason,
79
67
  ]
80
68
 
@@ -82,16 +70,16 @@ class Stream(
82
70
  self,
83
71
  *,
84
72
  stream: BaseStream[
85
- _BaseCallResponseT,
86
- _BaseCallResponseChunkT,
87
- _UserMessageParamT,
88
- _AssistantMessageParamT,
89
- _ToolMessageParamT,
90
- _MessageParamT,
91
- _BaseToolT,
92
- _ToolSchemaT,
93
- _BaseDynamicConfigT,
94
- _BaseCallParamsT,
73
+ BaseCallResponse,
74
+ BaseCallResponseChunk,
75
+ BaseMessageParam,
76
+ BaseMessageParam,
77
+ BaseMessageParam,
78
+ BaseMessageParam,
79
+ BaseTool,
80
+ Any,
81
+ BaseDynamicConfig,
82
+ BaseCallParams,
95
83
  FinishReason,
96
84
  ],
97
85
  ) -> None:
@@ -121,9 +109,7 @@ class Stream(
121
109
  def __iter__( # pyright: ignore [reportIncompatibleMethodOverride]
122
110
  self,
123
111
  ) -> Generator[
124
- tuple[
125
- CallResponseChunk[_BaseCallResponseChunkT], Tool[_ToolMessageParamT] | None
126
- ],
112
+ tuple[CallResponseChunk, Tool[_ToolMessageParamT] | None],
127
113
  None,
128
114
  None,
129
115
  ]:
@@ -137,9 +123,7 @@ class Stream(
137
123
  async def __aiter__( # pyright: ignore [reportIncompatibleMethodOverride]
138
124
  self,
139
125
  ) -> AsyncGenerator[
140
- tuple[
141
- CallResponseChunk[_BaseCallResponseChunkT], Tool[_ToolMessageParamT] | None
142
- ],
126
+ tuple[CallResponseChunk, Tool[_ToolMessageParamT] | None],
143
127
  None,
144
128
  ]:
145
129
  """Iterates over the stream and stores useful information."""
@@ -155,17 +139,15 @@ class Stream(
155
139
 
156
140
  def _construct_message_param(
157
141
  self, tool_calls: list[Any] | None = None, content: str | None = None
158
- ) -> _AssistantMessageParamT:
142
+ ) -> BaseMessageParam:
159
143
  return self._stream._construct_message_param(
160
144
  tool_calls=tool_calls, content=content
161
145
  )
162
146
 
163
147
  def construct_call_response( # pyright: ignore [reportIncompatibleMethodOverride]
164
148
  self,
165
- ) -> CallResponse[_BaseCallResponseT]:
166
- return CallResponse[_BaseCallResponseT](
167
- response=self._stream.construct_call_response()
168
- ) # pyright: ignore [reportAbstractUsage]
149
+ ) -> CallResponse:
150
+ return CallResponse(response=self._stream.construct_call_response()) # pyright: ignore [reportAbstractUsage]
169
151
 
170
152
  @classmethod
171
153
  def tool_message_params( # pyright: ignore [reportIncompatibleMethodOverride]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mirascope
3
- Version: 1.20.1
3
+ Version: 1.21.0
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/WELCOME
@@ -47,7 +47,7 @@ mirascope/core/anthropic/__init__.py,sha256=GB-CULa3jYEPv1ZDyZjNCKQJbrc6ojqu8WNR
47
47
  mirascope/core/anthropic/_call.py,sha256=LXUR__AyexD-hsPMPKpA7IFuh8Cfc0uAg1GrJSxiWnU,2358
48
48
  mirascope/core/anthropic/_call_kwargs.py,sha256=EoXSl2B5FoLD_Nv03-ttXjiKlpBihZGXu6U-Ol3qwZ8,389
49
49
  mirascope/core/anthropic/call_params.py,sha256=K51kCyIf6us3Tl2SPgkqrZoacZTNwaMuVj23hFJcVBk,1238
50
- mirascope/core/anthropic/call_response.py,sha256=HsnYw9II46UC6JP5-hK5q5a-twJiyZOs4_HytRyalrM,6203
50
+ mirascope/core/anthropic/call_response.py,sha256=ND0gpZR1Zocop8trAKyekzWIRakG1w2NWHOCc6ZjFI4,6345
51
51
  mirascope/core/anthropic/call_response_chunk.py,sha256=Pzpc4nHUqA-OhMaBvdT7sJOexgRbrevNebqHm1HGrrA,4113
52
52
  mirascope/core/anthropic/dynamic_config.py,sha256=kZV4ApAnm3P1X5gKPJ3hbr45K6tgaNX8L6Ca8NjTkxU,1192
53
53
  mirascope/core/anthropic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -65,7 +65,7 @@ mirascope/core/azure/__init__.py,sha256=7Dpkf10T-TGxk7Lstej6x6s6On7QjI0qeE2ABO7Q
65
65
  mirascope/core/azure/_call.py,sha256=SHqSJe6_4zgn4Y9PkpDl4vXvLuT4QmVnWUcws9e_RR8,2237
66
66
  mirascope/core/azure/_call_kwargs.py,sha256=q38xKSgCBWi8DLScepG-KnUfgi67AU6xr2uOHwCZ2mI,435
67
67
  mirascope/core/azure/call_params.py,sha256=NK_ggVJbactDip85DbfCaqSWRpO0CgwN1svY-KW4_Yg,1836
68
- mirascope/core/azure/call_response.py,sha256=0jn2hHAOPoN_Q5J9Vg40iUGgJ3UjhJWqbwm81Dyrgno,6901
68
+ mirascope/core/azure/call_response.py,sha256=-CdJWhuXYVoOJafbECUXaWZDAYtC9d1oqlelwMT5KO0,7023
69
69
  mirascope/core/azure/call_response_chunk.py,sha256=2NorPZ6szna3G-xDx63kuPuMQ7PCh5WNeGhiBRvwCYM,3155
70
70
  mirascope/core/azure/dynamic_config.py,sha256=6SBMGFce7tuXdwHrlKNISpZxVxUnnumbIQB9lGR6nbs,1066
71
71
  mirascope/core/azure/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -82,13 +82,13 @@ mirascope/core/azure/_utils/_message_param_converter.py,sha256=JAUeHObtd_V225YyZ
82
82
  mirascope/core/azure/_utils/_setup_call.py,sha256=cdUof-RCxsPbKuJvevsEUYXU-ckoql3wTevNEQiEpz4,6496
83
83
  mirascope/core/base/__init__.py,sha256=mENqcLNM5-FCh4lyDGihOAegQSAzSoIK744pBMkJinM,2067
84
84
  mirascope/core/base/_call_factory.py,sha256=YdFHAa9WtGfYeqVcM2xaDNh5gMg584rOe26_E51-1to,9663
85
- mirascope/core/base/_create.py,sha256=1UNRA6pwMguaiLyLiQkPzTk12ASaXT_hh7jlNw4UFX4,10016
85
+ mirascope/core/base/_create.py,sha256=M6dpcWwtyb6O7pa9pT0rdwhYEUcuB2iu2uv97kAU1qk,10090
86
86
  mirascope/core/base/_extract.py,sha256=QTqkArgmgR17OB5jTP86Wo-TW-BcouOcK9gdMy-EcNw,6799
87
87
  mirascope/core/base/_extract_with_tools.py,sha256=MW4v8D1xty7LqLb5RwMFkX-peQqA73CtAVwGm7mC5w8,7338
88
88
  mirascope/core/base/_partial.py,sha256=w_ACCgsDKNLtMyAP-lNmfRdrFEPmzh2BT4aninajxyY,3240
89
89
  mirascope/core/base/call_kwargs.py,sha256=0mznCsrj1dYxvdwYNF0RKbc9CiU5G6WvvcjPqOMsOE4,351
90
90
  mirascope/core/base/call_params.py,sha256=wtuuOY-SwIZYCDBKfn_xRC0Kf1cUuI4eSQaXu6VrtaE,1331
91
- mirascope/core/base/call_response.py,sha256=Z30zh8qqiKmnuxadt2ch6vxN2LAkQv7sKHaonuSbJ44,10271
91
+ mirascope/core/base/call_response.py,sha256=PTPY8GoUZ9PIHVA4hYCEqQBcYtWCnBJ-v9-dAAf9Rmk,10691
92
92
  mirascope/core/base/call_response_chunk.py,sha256=ZfulgERwgva55TLrQI9XimX8bpgOqBNLs_I-_kELl-4,3606
93
93
  mirascope/core/base/dynamic_config.py,sha256=V5IG2X5gPFpfQ47uO8JU1zoC2eNdRftsRZEmwhRPaYI,2859
94
94
  mirascope/core/base/from_call_args.py,sha256=8ijMX7PN6a4o6uLdmXJlSRnE-rEVJU5NLxUmNrS8dvU,909
@@ -104,8 +104,8 @@ mirascope/core/base/structured_stream.py,sha256=FIvLXXKninrpQ5P7MsLEqGrU4cfvEDiP
104
104
  mirascope/core/base/tool.py,sha256=ISk4MKfNljfsMe0rEwW0J8Dqty7WXJej7gV2oSiVxa8,6885
105
105
  mirascope/core/base/toolkit.py,sha256=GmZquYPqvQL2J9Hd6StEwx6jfeFsqtcUyxKvp4iW_7Q,6271
106
106
  mirascope/core/base/types.py,sha256=4GVyVzHThWJU2Og-wpVbYNPZD8QMdHltIAV83FUlisM,9247
107
- mirascope/core/base/_utils/__init__.py,sha256=dbN-XSnpb-jdQtHvs5zhiAXLNac1nxA-2718fAXIgpI,3069
108
- mirascope/core/base/_utils/_base_message_param_converter.py,sha256=WcfVQXf-SqtwgcRwi0GgyCba5ErsnnMMdu61CAm4Qn4,676
107
+ mirascope/core/base/_utils/__init__.py,sha256=Tm-9-6k7cZL3IaqebOEaKpTg9nFUMfAGHHeKmC3YzLQ,3192
108
+ mirascope/core/base/_utils/_base_message_param_converter.py,sha256=mavWnEEonk3BoinyqtGm-avNq-KvtW6YAW2NMAXIO2Y,695
109
109
  mirascope/core/base/_utils/_base_type.py,sha256=x8ZabSxZZNAy6ER-VQEkB6mNyjWcGSCBivFydFNIRUE,700
110
110
  mirascope/core/base/_utils/_convert_base_model_to_base_tool.py,sha256=JoHf1CbRwK91dABm5xLhdIPmeMSFS_nj-qW9OQu_YJ0,1750
111
111
  mirascope/core/base/_utils/_convert_base_type_to_base_tool.py,sha256=fAOfqqoT0_vk1i-h-lCdWQYYeTjZ3fTiCgwGmgtHk9o,734
@@ -145,7 +145,7 @@ mirascope/core/bedrock/_call.py,sha256=8Z8sdzpTdJsMHBev35B1KH3O16_eMLbtTkOmPB7bz
145
145
  mirascope/core/bedrock/_call_kwargs.py,sha256=N1d_iglnwZW3JrcaT8WTOeuLT5MYcVLU5vS8u8uyEL4,408
146
146
  mirascope/core/bedrock/_types.py,sha256=ntmzYsgT6wuigv1GavkdqCvJnAYRsFvVuIwxafE4DFY,3229
147
147
  mirascope/core/bedrock/call_params.py,sha256=3eKNYTteCTaPLqvAcy1vHU5aY9nMVNhmApL45ugPbrQ,1716
148
- mirascope/core/bedrock/call_response.py,sha256=KHBA5OQmCbDwK7CneFimRt2gj1aHE0iHKrfC6zH2aKM,8224
148
+ mirascope/core/bedrock/call_response.py,sha256=6v9BUQj096n44JMvFSNr7Mk-eNAAAMPZP06W3TlDlTc,8368
149
149
  mirascope/core/bedrock/call_response_chunk.py,sha256=EAs0mJseL-C4dlnEhggtUT8_s6L2d5lSAqrIjLxQepI,3524
150
150
  mirascope/core/bedrock/dynamic_config.py,sha256=X6v93X9g14mfvkGLL08yX-xTFGgX8y8bVngNmExdUhQ,1166
151
151
  mirascope/core/bedrock/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -164,7 +164,7 @@ mirascope/core/cohere/_call.py,sha256=y0nB_7h7FWCNxHRPywtAVCYXyeYX3uzTyYBPWnuLwU
164
164
  mirascope/core/cohere/_call_kwargs.py,sha256=YmHwiofs0QADGp0wXUtOr_Z5Pt849zaCtIZmVyjw2OM,292
165
165
  mirascope/core/cohere/_types.py,sha256=dMcep2mhuUUUmKvFUmdoxkq4Zg5AtB2xquROiBbwRvo,1017
166
166
  mirascope/core/cohere/call_params.py,sha256=xtmELsLkjfyfUoNbZpn3JET-gJxo1EIvlcwxgMw3gcw,1860
167
- mirascope/core/cohere/call_response.py,sha256=mCr9133MV5Iy4SK7pB7V6IFSJMb7VgWZ3PiUcgkS6GI,6191
167
+ mirascope/core/cohere/call_response.py,sha256=izB0UfevaASRcDfXYT2JXfHd4jNtZASmiziIXu8AMiM,6317
168
168
  mirascope/core/cohere/call_response_chunk.py,sha256=M-EkkGOuNFnYqzAxn5HbE9EFmU4IRUA4kNPFnzl-nBs,3806
169
169
  mirascope/core/cohere/dynamic_config.py,sha256=noH36l6qGGnClVz0EtMqeW_0e4-oTCviU5SLIl8YS64,941
170
170
  mirascope/core/cohere/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -196,7 +196,7 @@ mirascope/core/gemini/__init__.py,sha256=x7GxY48nHa6nNFhoaS3ED8NK_DwF2bNEGXiWU86
196
196
  mirascope/core/gemini/_call.py,sha256=g47rUaE4V_onORvRUP9GlgnQKda28dV1Ge2YACvrD-c,2344
197
197
  mirascope/core/gemini/_call_kwargs.py,sha256=4f34gl1BPM14wkd0fGJw_58jYzxgGgNvZkjVI5d1hgU,360
198
198
  mirascope/core/gemini/call_params.py,sha256=aEXhgZVB0npcT6wL_p7GVGIE3vi_JOiMKdgWtpXTezQ,1723
199
- mirascope/core/gemini/call_response.py,sha256=ZJsyER0oXXOlNbSWxD7k-2THUUoOEFTyuCwyp4yb2vQ,6220
199
+ mirascope/core/gemini/call_response.py,sha256=KqXoEhQy4IpLZYukaMXQWuPx2Yz-eFM63rvh3peua3E,6346
200
200
  mirascope/core/gemini/call_response_chunk.py,sha256=YRyCrPLY5F79h_q3Yk6bg2ZiER_PpbAsg41ucy06QQ4,2915
201
201
  mirascope/core/gemini/dynamic_config.py,sha256=_bmJUVHFyrr3zKea96lES20q4GPOelK3W7K1DcX0mZ8,836
202
202
  mirascope/core/gemini/stream.py,sha256=1OIS-rrrDfRVRL86_HYatJ5uUKVLG2eRFx_PVb2YrCQ,3621
@@ -213,11 +213,11 @@ mirascope/core/google/__init__.py,sha256=5EhyiomPnjOS59FgfQP2uPCXS74ZJrGYvJ_CZbY
213
213
  mirascope/core/google/_call.py,sha256=GJOPyvHzVlSXvJpgQhJFg4wFHFUYsvvrbjhNxU-nSl8,2344
214
214
  mirascope/core/google/_call_kwargs.py,sha256=baCYcxWsmV06ATw6nuQhh6FPm3k6oWmKOn0MyjESDGc,372
215
215
  mirascope/core/google/call_params.py,sha256=9Dt5m1pPVjpl5Qppz6Egl_9FyGjjz9aGCnXkVps7C_Q,538
216
- mirascope/core/google/call_response.py,sha256=U1jyuIQ1F3E6HR4Q2540rDDXkX64b0uAK2F7CPCr-pQ,7385
216
+ mirascope/core/google/call_response.py,sha256=8yn1cRtqxhnjjzLltfWMzLbaS1Dg7gmS4I5aIr3Hu0g,7511
217
217
  mirascope/core/google/call_response_chunk.py,sha256=oORYaGjOBv4U1IVhsR_ZS-Vr-B58I8G0-9d6Kcj9RM4,3427
218
218
  mirascope/core/google/dynamic_config.py,sha256=O6j8F0fLVFuuNwURneu5OpPuu_bMEtbDEFHhJXRT6V0,857
219
219
  mirascope/core/google/stream.py,sha256=bTxB8OUrKXxzmcX0C7_-LqtBfaAAazA5HjKZGSxxtLw,4466
220
- mirascope/core/google/tool.py,sha256=hHHKlC6CIfv55XqG0NUsBf8eEgUNpgvaBuljq5_NopE,3030
220
+ mirascope/core/google/tool.py,sha256=HPe7CZEn1nPFkvuigpDiTdU9y9cQGp6R68FChjETMAU,4623
221
221
  mirascope/core/google/_utils/__init__.py,sha256=vL0hx6WKW5lqpUcFTFCFGvmwtR-pts0JzWgCXhaUVrI,388
222
222
  mirascope/core/google/_utils/_convert_common_call_params.py,sha256=KA-z6uvRtdD4WydC0eXd3dzQuSh4x4WKNR8PAqFNUVY,1065
223
223
  mirascope/core/google/_utils/_convert_finish_reason_to_common_finish_reasons.py,sha256=ig4tb7Zanz-tyZpvc9Ncd47a2FNTOS7-wl1PYBq-4cY,879
@@ -231,7 +231,7 @@ mirascope/core/groq/__init__.py,sha256=8jWCQScdei_TImGMWUwiKnlOwffQqaXdAL-bluFmE
231
231
  mirascope/core/groq/_call.py,sha256=gR8VN5IaYWIFXc0csn995q59FM0nBs-xVFjkVycPjMM,2223
232
232
  mirascope/core/groq/_call_kwargs.py,sha256=trT8AdQ-jdQPYKlGngIMRwwQuvKuvAbvI1yyozftOuI,425
233
233
  mirascope/core/groq/call_params.py,sha256=FchtsaeohTzYKzY9f2fUIzjgG2y4OtsnRWiHsUBLdi0,1619
234
- mirascope/core/groq/call_response.py,sha256=hnkwjzAyr8QP6WMOESXgh-6ciaemlXRQ8rmDm4u0A5M,6880
234
+ mirascope/core/groq/call_response.py,sha256=J-_ZUdvGBE4f7UhncQhHUtgIZ8Rfc-llWwXhvUhIM6A,7000
235
235
  mirascope/core/groq/call_response_chunk.py,sha256=lhlL7XelfBWzCY8SkCYHnstrTXo14s6aUsMRreuEYR0,3094
236
236
  mirascope/core/groq/dynamic_config.py,sha256=AjcXBVeBdMiI6ObHanX3TVMKYxm4iWhXju3m6d-ZWMY,937
237
237
  mirascope/core/groq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -259,7 +259,7 @@ mirascope/core/mistral/__init__.py,sha256=75tjaJC9nioECzQumC0FYITjosMsXCO1VzPV1t
259
259
  mirascope/core/mistral/_call.py,sha256=p9aSLYVSNgaIGA5SqCgGuT7iWN5WLfwmXubk4IF-w_I,2274
260
260
  mirascope/core/mistral/_call_kwargs.py,sha256=vZxlADPx4muIePARGdfKOVQpxpIoaXT9tCG6kY5oxSQ,513
261
261
  mirascope/core/mistral/call_params.py,sha256=wWHWI9hRnfloGhQurMwCcka9c1u_TwgcN84Ih6qVBXs,1054
262
- mirascope/core/mistral/call_response.py,sha256=rHgO70a4cGPBqEWWEP9Tp8TJUIiPHDr1l8OQaiuF1mw,6104
262
+ mirascope/core/mistral/call_response.py,sha256=di1vn2wnZUcXhNSglBbm3yko9-CBsrltC--kNM4Yhz4,6249
263
263
  mirascope/core/mistral/call_response_chunk.py,sha256=HvoPONyOcbMQPWnrG0qBCfiT6PHLaPR9nrByUuT1Cro,3130
264
264
  mirascope/core/mistral/dynamic_config.py,sha256=-pzTvXf870NxEhjpgjqPahFWqqifzMhSbvM0kXs2G_s,937
265
265
  mirascope/core/mistral/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -277,7 +277,7 @@ mirascope/core/openai/__init__.py,sha256=lOzSimt1AaWyFW2s_w1So5lIn7K2rpj3bEFicjo
277
277
  mirascope/core/openai/_call.py,sha256=ExXdY3rjBbil0ija2HlGMRvcOE2zOOj13rgliw8nmFc,2260
278
278
  mirascope/core/openai/_call_kwargs.py,sha256=x53EZmxqroNewR194M_JkRP1Ejuh4BTtDL-b7XNSo2Q,435
279
279
  mirascope/core/openai/call_params.py,sha256=DAjh2oZ2cLpBSh4wQAq24zsT9LBOJQLjev3AWIDcc2M,3052
280
- mirascope/core/openai/call_response.py,sha256=HBpuP87Moi0JXuatTQL_VygfI2m-RxBCJhbFasHV4Eo,8875
280
+ mirascope/core/openai/call_response.py,sha256=KgbRTWdGLWjha8L7KU_xJLlvqKUIcn2TZo8weqeZ13g,9000
281
281
  mirascope/core/openai/call_response_chunk.py,sha256=GLHiLEb-bRvTtBA9O2zlz8Dzqi7lwladRlNPwM0jv-g,4261
282
282
  mirascope/core/openai/dynamic_config.py,sha256=D36E3CMpXSaj5I8FEmtzMJz9gtTsNz1pVW_iM3dOCcw,1045
283
283
  mirascope/core/openai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -294,7 +294,7 @@ mirascope/core/vertex/__init__.py,sha256=eg_kNX956OYABi3leev5GyDg0KK8QopgztBtrMX
294
294
  mirascope/core/vertex/_call.py,sha256=ebQmWoQLnxScyxhnGKU3MmHkXXzzs_Sw2Yf-d3nZFwU,2323
295
295
  mirascope/core/vertex/_call_kwargs.py,sha256=6JxQt1bAscbhPWTGESG1TiskB-i5imDHqLMgbMHmyfI,353
296
296
  mirascope/core/vertex/call_params.py,sha256=ISBnMITxAtvuGmpLF9UdkqcDS43RwtuuVakk01YIHDs,706
297
- mirascope/core/vertex/call_response.py,sha256=l6T_FRCkT2tqKX0rUlyLB-0NesMmdLmzeLNjkn6UVSg,6087
297
+ mirascope/core/vertex/call_response.py,sha256=HiQOaqxInfr7YKbE5E3TK0nYxvoBfKohIVdTWRfJunQ,6213
298
298
  mirascope/core/vertex/call_response_chunk.py,sha256=MDCeDjzFonqRpFdoQnfJRGDPiJakLB9n-o2WyOGLKNw,2926
299
299
  mirascope/core/vertex/dynamic_config.py,sha256=KISQf7c2Rf1EpaS_2Ik6beA1w9uz_dAvMBk4nQcrdaM,809
300
300
  mirascope/core/vertex/stream.py,sha256=FYhCtYRfQ6lEccHO5ZKVrQJ8iafpelVFIzykO3xVjGE,3544
@@ -331,14 +331,15 @@ mirascope/integrations/otel/__init__.py,sha256=OzboYfm3fUNwKTuu08KX83hQHYI4oZYN2
331
331
  mirascope/integrations/otel/_utils.py,sha256=SCVb3MpcpqLpCpumJEbEdINceNdusnyT6iuKPz66sBc,8778
332
332
  mirascope/integrations/otel/_with_hyperdx.py,sha256=f17uxXQk5zZPtyj6zwPwJz5i7atsnUPOoq1LqT8JO0E,1637
333
333
  mirascope/integrations/otel/_with_otel.py,sha256=tbjd6BEbcSfnsm5CWHBoHwbRNrHt6-t4or-SYGQSD-w,1659
334
- mirascope/llm/__init__.py,sha256=wu7j3316Cx0ju9eS8UwCIpG_bGK3RRHCxD5SRlLZyHY,317
335
- mirascope/llm/_protocols.py,sha256=30708fzTNv7k6Ix3T0NwmSDnQ9BP9ZrHLAmumIfzuFI,16783
334
+ mirascope/llm/__init__.py,sha256=zo7QD39zQ6HIU_N2yHrzd6bbcT9YmlikZ84JN_r5k4E,397
335
+ mirascope/llm/_call.py,sha256=Xv9Ok0gZjLETQUOavYOk4rapnhOqfpNGw0mxlDf-nV4,12585
336
+ mirascope/llm/_context.py,sha256=Q4M-XRVsAvDW2LPW2XNtCm5HRU36BLFJYuahfGMfTGI,12332
337
+ mirascope/llm/_override.py,sha256=m4MdOhM-aJRIGP7NBJhscq3ISNct6FBPn3jjmryFo_Q,112292
338
+ mirascope/llm/_protocols.py,sha256=HXspRAC0PduGqbh2BM0CGe5iVj7CC3ZKMPAYvFvbDNQ,16406
336
339
  mirascope/llm/_response_metaclass.py,sha256=6DLQb5IrqMldyEXHT_pAsr2DlUVc9CmZuZiBXG37WK8,851
337
- mirascope/llm/call_response.py,sha256=U40eOKbKfzrmLsQ9j31kH_NUpc_vKGu6I7Ee0WNL6J8,4810
338
- mirascope/llm/call_response_chunk.py,sha256=ABVkAtCG9m-vmoLWv3J39V-8R4LTjlCRrM9IkpELnKE,2048
339
- mirascope/llm/llm_call.py,sha256=XR0TQtkGJi7MnRCpA4xOddrbszp7FwFQs8lNAwjFbq4,9726
340
- mirascope/llm/llm_override.py,sha256=riGazYBfcaTBjxEjIpMqQ-Neo8QgOx1EYzK5fKTSK3M,6681
341
- mirascope/llm/stream.py,sha256=_6OG7APLBGn9wrion4GT86KIPDBxxfTMUsBTyNmML9E,5840
340
+ mirascope/llm/call_response.py,sha256=iXIRlydSYD5ACkGSzWBhmnJHZY_DWvWTDfPdRnfQAGM,4941
341
+ mirascope/llm/call_response_chunk.py,sha256=bZwO43ipc6PO1VLgGSaAPRqCIUyZD_Ty5oxdJX62yno,1966
342
+ mirascope/llm/stream.py,sha256=GtUKyLBlKqqZTOKjdL9FLInCXJ0ZOEAe6nymbjKwyTQ,5293
342
343
  mirascope/llm/tool.py,sha256=MQRJBPhP1d-OyOz3PE_VsKmSXca0chySyYO1U9OW8ck,1824
343
344
  mirascope/mcp/__init__.py,sha256=mGboroTrBbzuZ_8uBssOhkqiJOJ4mNCvaJvS7mhumhg,155
344
345
  mirascope/mcp/client.py,sha256=ZsjaT6E5i4Cdm3iVp2-JTuDniUlzynWeeJvnBAtuffQ,11123
@@ -367,7 +368,7 @@ mirascope/v0/base/ops_utils.py,sha256=1Qq-VIwgHBaYutiZsS2MUQ4OgPC3APyywI5bTiTAmA
367
368
  mirascope/v0/base/prompts.py,sha256=FM2Yz98cSnDceYogiwPrp4BALf3_F3d4fIOCGAkd-SE,1298
368
369
  mirascope/v0/base/types.py,sha256=ZfatJoX0Yl0e3jhv0D_MhiSVHLYUeJsdN3um3iE10zY,352
369
370
  mirascope/v0/base/utils.py,sha256=XREPENRQTu8gpMhHU8RC8qH_am3FfGUvY-dJ6x8i-mw,681
370
- mirascope-1.20.1.dist-info/METADATA,sha256=XIsjsvbaT6joN-JvQ4MDtgT4VxqAnrCDsSmnOMYZmCU,8730
371
- mirascope-1.20.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
372
- mirascope-1.20.1.dist-info/licenses/LICENSE,sha256=LAs5Q8mdawTsVdONpDGukwsoc4KEUBmmonDEL39b23Y,1072
373
- mirascope-1.20.1.dist-info/RECORD,,
371
+ mirascope-1.21.0.dist-info/METADATA,sha256=3RrfjlPJIf5q2D1pf1jx9Pgrp8DBwnQYCNuGDbQ_ciE,8730
372
+ mirascope-1.21.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
373
+ mirascope-1.21.0.dist-info/licenses/LICENSE,sha256=LAs5Q8mdawTsVdONpDGukwsoc4KEUBmmonDEL39b23Y,1072
374
+ mirascope-1.21.0.dist-info/RECORD,,
@@ -1,233 +0,0 @@
1
- """Overrides the provider-specific call with the specified provider."""
2
-
3
- from __future__ import annotations
4
-
5
- from collections.abc import Callable
6
- from typing import TYPE_CHECKING, Any, Literal, ParamSpec, TypeVar, overload
7
-
8
- from ..core.base import CommonCallParams
9
- from ..core.base.types import LocalProvider, Provider
10
- from .llm_call import _call
11
-
12
- if TYPE_CHECKING:
13
- from ..core.anthropic import AnthropicCallParams
14
- from ..core.azure import AzureCallParams
15
- from ..core.bedrock import BedrockCallParams
16
- from ..core.cohere import CohereCallParams
17
- from ..core.gemini import GeminiCallParams
18
- from ..core.google import GoogleCallParams
19
- from ..core.groq import GroqCallParams
20
- from ..core.litellm import LiteLLMCallParams
21
- from ..core.mistral import MistralCallParams
22
- from ..core.openai import OpenAICallParams
23
- from ..core.vertex import VertexCallParams
24
- else:
25
- AnthropicCallParams = AzureCallParams = BedrockCallParams = CohereCallParams = (
26
- GeminiCallParams
27
- ) = GoogleCallParams = GroqCallParams = LiteLLMCallParams = MistralCallParams = (
28
- OpenAICallParams
29
- ) = VertexCallParams = None
30
-
31
-
32
- _P = ParamSpec("_P")
33
- _R = TypeVar("_R")
34
-
35
-
36
- @overload
37
- def override(
38
- provider_agnostic_call: Callable[_P, _R],
39
- *,
40
- provider: Literal["anthropic"],
41
- model: str,
42
- call_params: CommonCallParams | AnthropicCallParams | None = None,
43
- client: Any = None, # noqa: ANN401
44
- ) -> Callable[_P, _R]: ...
45
-
46
-
47
- @overload
48
- def override(
49
- provider_agnostic_call: Callable[_P, _R],
50
- *,
51
- provider: Literal["azure"],
52
- model: str,
53
- call_params: CommonCallParams | AzureCallParams | None = None,
54
- client: Any = None, # noqa: ANN401
55
- ) -> Callable[_P, _R]: ...
56
-
57
-
58
- @overload
59
- def override(
60
- provider_agnostic_call: Callable[_P, _R],
61
- *,
62
- provider: Literal["bedrock"],
63
- model: str,
64
- call_params: CommonCallParams | BedrockCallParams | None = None,
65
- client: Any = None, # noqa: ANN401
66
- ) -> Callable[_P, _R]: ...
67
-
68
-
69
- @overload
70
- def override(
71
- provider_agnostic_call: Callable[_P, _R],
72
- *,
73
- provider: Literal["cohere"],
74
- model: str,
75
- call_params: CommonCallParams | CohereCallParams | None = None,
76
- client: Any = None, # noqa: ANN401
77
- ) -> Callable[_P, _R]: ...
78
-
79
-
80
- @overload
81
- def override(
82
- provider_agnostic_call: Callable[_P, _R],
83
- *,
84
- provider: Literal["gemini"],
85
- model: str,
86
- call_params: CommonCallParams | GeminiCallParams | None = None,
87
- client: Any = None, # noqa: ANN401
88
- ) -> Callable[_P, _R]: ...
89
-
90
-
91
- @overload
92
- def override(
93
- provider_agnostic_call: Callable[_P, _R],
94
- *,
95
- provider: Literal["google"],
96
- model: str,
97
- call_params: CommonCallParams | GoogleCallParams | None = None,
98
- client: Any = None, # noqa: ANN401
99
- ) -> Callable[_P, _R]: ...
100
-
101
-
102
- @overload
103
- def override(
104
- provider_agnostic_call: Callable[_P, _R],
105
- *,
106
- provider: Literal["groq"],
107
- model: str,
108
- call_params: CommonCallParams | GroqCallParams | None = None,
109
- client: Any = None, # noqa: ANN401
110
- ) -> Callable[_P, _R]: ...
111
-
112
-
113
- @overload
114
- def override(
115
- provider_agnostic_call: Callable[_P, _R],
116
- *,
117
- provider: Literal["mistral"],
118
- model: str,
119
- call_params: CommonCallParams | MistralCallParams | None = None,
120
- client: Any = None, # noqa: ANN401
121
- ) -> Callable[_P, _R]: ...
122
-
123
-
124
- @overload
125
- def override(
126
- provider_agnostic_call: Callable[_P, _R],
127
- *,
128
- provider: Literal["openai"],
129
- model: str,
130
- call_params: CommonCallParams | OpenAICallParams | None = None,
131
- client: Any = None, # noqa: ANN401
132
- ) -> Callable[_P, _R]: ...
133
-
134
-
135
- @overload
136
- def override(
137
- provider_agnostic_call: Callable[_P, _R],
138
- *,
139
- provider: Literal["litellm"],
140
- model: str,
141
- call_params: CommonCallParams | LiteLLMCallParams | None = None,
142
- client: Any = None, # noqa: ANN401
143
- ) -> Callable[_P, _R]: ...
144
-
145
-
146
- @overload
147
- def override(
148
- provider_agnostic_call: Callable[_P, _R],
149
- *,
150
- provider: Literal["vertex"],
151
- model: str,
152
- call_params: CommonCallParams | VertexCallParams | None = None,
153
- client: Any = None, # noqa: ANN401
154
- ) -> Callable[_P, _R]: ...
155
-
156
-
157
- @overload
158
- def override(
159
- provider_agnostic_call: Callable[_P, _R],
160
- *,
161
- provider: None = None,
162
- model: None = None,
163
- call_params: CommonCallParams | None = None,
164
- client: Any = None, # noqa: ANN401
165
- ) -> Callable[_P, _R]: ...
166
-
167
-
168
- @overload
169
- def override(
170
- provider_agnostic_call: Callable[_P, _R],
171
- *,
172
- provider: Provider,
173
- model: str,
174
- call_params: CommonCallParams | None = None,
175
- client: Any = None, # noqa: ANN401
176
- ) -> Callable[_P, _R]: ...
177
-
178
-
179
- def override(
180
- provider_agnostic_call: Callable[_P, _R],
181
- *,
182
- provider: Provider | LocalProvider | None = None,
183
- model: str | None = None,
184
- call_params: CommonCallParams
185
- | AnthropicCallParams
186
- | GeminiCallParams
187
- | GoogleCallParams
188
- | AzureCallParams
189
- | BedrockCallParams
190
- | CohereCallParams
191
- | GroqCallParams
192
- | MistralCallParams
193
- | OpenAICallParams
194
- | VertexCallParams
195
- | None = None,
196
- client: Any = None, # noqa: ANN401
197
- ) -> Callable[_P, _R]:
198
- """Overrides the provider-specific call with the specified provider.
199
-
200
- Args:
201
- provider_agnostic_call: The provider-agnostic call to override.
202
- provider: The provider to override with.
203
- model: The model to override with.
204
- call_params: The call params to override with.
205
- client: The client to override with.
206
-
207
- Returns:
208
- The overridden function.
209
- """
210
- if (provider and not model) or (model and not provider):
211
- raise ValueError(
212
- "Provider and model must both be overridden if either is overridden."
213
- )
214
-
215
- original_provider = provider_agnostic_call._original_provider # pyright: ignore [reportFunctionMemberAccess]
216
- original_args = provider_agnostic_call._original_args # pyright: ignore [reportFunctionMemberAccess]
217
-
218
- # Note: if switching providers, we will always use `client` since `original_client`
219
- # would be from a different provider and fail.
220
- if provider and provider == original_provider:
221
- client = client or original_args["client"]
222
-
223
- return _call( # pyright: ignore [reportReturnType]
224
- provider=provider or original_provider,
225
- model=model or original_args["model"],
226
- stream=original_args["stream"],
227
- tools=original_args["tools"],
228
- response_model=original_args["response_model"],
229
- output_parser=original_args["output_parser"],
230
- json_mode=original_args["json_mode"],
231
- client=client,
232
- call_params=call_params or original_args["call_params"],
233
- )(provider_agnostic_call._original_fn) # pyright: ignore [reportFunctionMemberAccess]