mirascope 1.21.0__py3-none-any.whl → 1.21.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/llm/_call.py +22 -6
- {mirascope-1.21.0.dist-info → mirascope-1.21.1.dist-info}/METADATA +1 -1
- {mirascope-1.21.0.dist-info → mirascope-1.21.1.dist-info}/RECORD +5 -5
- {mirascope-1.21.0.dist-info → mirascope-1.21.1.dist-info}/WHEEL +0 -0
- {mirascope-1.21.0.dist-info → mirascope-1.21.1.dist-info}/licenses/LICENSE +0 -0
mirascope/llm/_call.py
CHANGED
|
@@ -50,24 +50,36 @@ _ResultT = TypeVar("_ResultT")
|
|
|
50
50
|
def _get_local_provider_call(
|
|
51
51
|
provider: LocalProvider,
|
|
52
52
|
client: Any | None, # noqa: ANN401
|
|
53
|
+
is_async: bool,
|
|
53
54
|
) -> tuple[Callable, Any | None]:
|
|
54
55
|
if provider == "ollama":
|
|
55
56
|
from ..core.openai import openai_call
|
|
56
57
|
|
|
57
58
|
if client:
|
|
58
59
|
return openai_call, client
|
|
59
|
-
|
|
60
|
+
if is_async:
|
|
61
|
+
from openai import AsyncOpenAI
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
client = AsyncOpenAI(api_key="ollama", base_url="http://localhost:11434/v1")
|
|
64
|
+
else:
|
|
65
|
+
from openai import OpenAI
|
|
66
|
+
|
|
67
|
+
client = OpenAI(api_key="ollama", base_url="http://localhost:11434/v1")
|
|
62
68
|
return openai_call, client
|
|
63
69
|
else: # provider == "vllm"
|
|
64
70
|
from ..core.openai import openai_call
|
|
65
71
|
|
|
66
72
|
if client:
|
|
67
73
|
return openai_call, client
|
|
68
|
-
from openai import OpenAI
|
|
69
74
|
|
|
70
|
-
|
|
75
|
+
if is_async:
|
|
76
|
+
from openai import AsyncOpenAI
|
|
77
|
+
|
|
78
|
+
client = AsyncOpenAI(api_key="ollama", base_url="http://localhost:8000/v1")
|
|
79
|
+
else:
|
|
80
|
+
from openai import OpenAI
|
|
81
|
+
|
|
82
|
+
client = OpenAI(api_key="ollama", base_url="http://localhost:8000/v1")
|
|
71
83
|
return openai_call, client
|
|
72
84
|
|
|
73
85
|
|
|
@@ -245,7 +257,9 @@ def _call(
|
|
|
245
257
|
|
|
246
258
|
if effective_provider in get_args(LocalProvider):
|
|
247
259
|
provider_call, effective_client = _get_local_provider_call(
|
|
248
|
-
cast(LocalProvider, effective_provider),
|
|
260
|
+
cast(LocalProvider, effective_provider),
|
|
261
|
+
effective_client,
|
|
262
|
+
True,
|
|
249
263
|
)
|
|
250
264
|
effective_call_args["client"] = effective_client
|
|
251
265
|
else:
|
|
@@ -293,7 +307,9 @@ def _call(
|
|
|
293
307
|
|
|
294
308
|
if effective_provider in get_args(LocalProvider):
|
|
295
309
|
provider_call, effective_client = _get_local_provider_call(
|
|
296
|
-
cast(LocalProvider, effective_provider),
|
|
310
|
+
cast(LocalProvider, effective_provider),
|
|
311
|
+
effective_client,
|
|
312
|
+
False,
|
|
297
313
|
)
|
|
298
314
|
effective_call_args["client"] = effective_client
|
|
299
315
|
else:
|
|
@@ -332,7 +332,7 @@ mirascope/integrations/otel/_utils.py,sha256=SCVb3MpcpqLpCpumJEbEdINceNdusnyT6iu
|
|
|
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
334
|
mirascope/llm/__init__.py,sha256=zo7QD39zQ6HIU_N2yHrzd6bbcT9YmlikZ84JN_r5k4E,397
|
|
335
|
-
mirascope/llm/_call.py,sha256=
|
|
335
|
+
mirascope/llm/_call.py,sha256=XyMMZzg_DUW1pZgVcOP0QxyVDCYW8s7Xj_XMDwCzb_w,13068
|
|
336
336
|
mirascope/llm/_context.py,sha256=Q4M-XRVsAvDW2LPW2XNtCm5HRU36BLFJYuahfGMfTGI,12332
|
|
337
337
|
mirascope/llm/_override.py,sha256=m4MdOhM-aJRIGP7NBJhscq3ISNct6FBPn3jjmryFo_Q,112292
|
|
338
338
|
mirascope/llm/_protocols.py,sha256=HXspRAC0PduGqbh2BM0CGe5iVj7CC3ZKMPAYvFvbDNQ,16406
|
|
@@ -368,7 +368,7 @@ mirascope/v0/base/ops_utils.py,sha256=1Qq-VIwgHBaYutiZsS2MUQ4OgPC3APyywI5bTiTAmA
|
|
|
368
368
|
mirascope/v0/base/prompts.py,sha256=FM2Yz98cSnDceYogiwPrp4BALf3_F3d4fIOCGAkd-SE,1298
|
|
369
369
|
mirascope/v0/base/types.py,sha256=ZfatJoX0Yl0e3jhv0D_MhiSVHLYUeJsdN3um3iE10zY,352
|
|
370
370
|
mirascope/v0/base/utils.py,sha256=XREPENRQTu8gpMhHU8RC8qH_am3FfGUvY-dJ6x8i-mw,681
|
|
371
|
-
mirascope-1.21.
|
|
372
|
-
mirascope-1.21.
|
|
373
|
-
mirascope-1.21.
|
|
374
|
-
mirascope-1.21.
|
|
371
|
+
mirascope-1.21.1.dist-info/METADATA,sha256=G2jXSfZomkT1FvuLahmGaE83CA4RMPdhwIujlADIbc8,8730
|
|
372
|
+
mirascope-1.21.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
373
|
+
mirascope-1.21.1.dist-info/licenses/LICENSE,sha256=LAs5Q8mdawTsVdONpDGukwsoc4KEUBmmonDEL39b23Y,1072
|
|
374
|
+
mirascope-1.21.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|