mirascope 1.18.0__py3-none-any.whl → 1.18.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.
@@ -10,7 +10,6 @@ from azure.ai.inference import ChatCompletionsClient
10
10
  from azure.ai.inference.aio import ChatCompletionsClient as AsyncChatCompletionsClient
11
11
  from azure.ai.inference.models import (
12
12
  ChatCompletions,
13
- ChatCompletionsResponseFormatJSON,
14
13
  ChatRequestMessage,
15
14
  StreamingChatCompletionsUpdate,
16
15
  UserMessage,
@@ -29,13 +28,27 @@ from ...base._utils import (
29
28
  from ...base.call_params import CommonCallParams
30
29
  from ...base.stream_config import StreamConfig
31
30
  from .._call_kwargs import AzureCallKwargs
32
- from ..call_params import AzureCallParams
31
+ from ..call_params import AzureCallParams, ResponseFormatJSON
33
32
  from ..dynamic_config import AsyncAzureDynamicConfig, AzureDynamicConfig
34
33
  from ..tool import AzureTool, GenerateAzureStrictToolJsonSchema
35
34
  from ._convert_common_call_params import convert_common_call_params
36
35
  from ._convert_message_params import convert_message_params
37
36
  from ._get_credential import get_credential
38
37
 
38
+ try:
39
+ from azure.ai.inference.models._models import (
40
+ ChatCompletionsResponseFormatJSON as FormatJSON,
41
+ )
42
+
43
+ json_object: ResponseFormatJSON | None = None
44
+ except ImportError: # pragma: no cover
45
+ # https://github.com/Azure/azure-sdk-for-python/commit/cf61ada8243d619ee6164bf1d32b3939b3c271e5#diff-0fb29d8cce6df3a014592ba8e9959409b8c471088381549807239324f5e8ddc4R15-R17
46
+ from azure.ai.inference.models._models import (
47
+ JsonSchemaFormat as FormatJSON, # pyright: ignore [reportAttributeAccessIssue]
48
+ )
49
+
50
+ json_object = "json_object" # pyright: ignore [reportAssignmentType]
51
+
39
52
 
40
53
  @overload
41
54
  def setup_call(
@@ -116,7 +129,7 @@ def setup_call(
116
129
  messages = convert_message_params(messages)
117
130
  if json_mode:
118
131
  if response_model and response_model.model_config.get("strict", False):
119
- call_kwargs["response_format"] = ChatCompletionsResponseFormatJSON(
132
+ call_kwargs["response_format"] = FormatJSON(
120
133
  {
121
134
  "name": response_model.__name__,
122
135
  "description": response_model.__doc__ or DEFAULT_TOOL_DOCSTRING,
@@ -127,7 +140,7 @@ def setup_call(
127
140
  }
128
141
  )
129
142
  else:
130
- call_kwargs["response_format"] = ChatCompletionsResponseFormatJSON()
143
+ call_kwargs["response_format"] = json_object or FormatJSON()
131
144
  json_mode_content = _utils.json_mode_content(response_model).strip()
132
145
  messages.append(UserMessage(content=json_mode_content))
133
146
  elif response_model:
@@ -2,13 +2,26 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Any
5
+ from typing import Any, Literal, TypeAlias
6
6
 
7
7
  from azure.ai.inference.models import (
8
8
  ChatCompletionsNamedToolChoice,
9
- ChatCompletionsResponseFormat,
10
9
  ChatCompletionsToolChoicePreset,
11
10
  )
11
+
12
+ try:
13
+ from azure.ai.inference.models import (
14
+ ChatCompletionsResponseFormatJSON,
15
+ )
16
+
17
+ ResponseFormatJSON: TypeAlias = ChatCompletionsResponseFormatJSON # pyright: ignore [reportRedeclaration]
18
+ except ImportError: # pragma: no cover
19
+ from azure.ai.inference.models import (
20
+ JsonSchemaFormat, # pyright: ignore [reportAttributeAccessIssue]
21
+ )
22
+
23
+ ResponseFormatJSON: TypeAlias = JsonSchemaFormat | Literal["json_object"] # pyright: ignore [reportRedeclaration]
24
+
12
25
  from typing_extensions import NotRequired
13
26
 
14
27
  from ..base import BaseCallParams
@@ -36,7 +49,7 @@ class AzureCallParams(BaseCallParams):
36
49
  max_tokens: NotRequired[int | None]
37
50
  model_extras: NotRequired[dict[str, Any] | None]
38
51
  presence_penalty: NotRequired[float | None]
39
- response_format: NotRequired[ChatCompletionsResponseFormat | None]
52
+ response_format: NotRequired[ResponseFormatJSON | None]
40
53
  seed: NotRequired[int | None]
41
54
  stop: NotRequired[list[str] | None]
42
55
  temperature: NotRequired[float | None]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mirascope
3
- Version: 1.18.0
3
+ Version: 1.18.1
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
@@ -65,7 +65,7 @@ mirascope/core/anthropic/_utils/_setup_call.py,sha256=tR-SFT_ZJd_Gk7RY4NOU3do536
65
65
  mirascope/core/azure/__init__.py,sha256=ozfFhyCC0bFLDUA7m2v1POywSFpLJi6E7xZ2bhBIdC0,852
66
66
  mirascope/core/azure/_call.py,sha256=SHqSJe6_4zgn4Y9PkpDl4vXvLuT4QmVnWUcws9e_RR8,2237
67
67
  mirascope/core/azure/_call_kwargs.py,sha256=q38xKSgCBWi8DLScepG-KnUfgi67AU6xr2uOHwCZ2mI,435
68
- mirascope/core/azure/call_params.py,sha256=o5xhlWlyUB8bTewp9fj3l0jvbCpoOsZFnaGwhkEWTD0,1366
68
+ mirascope/core/azure/call_params.py,sha256=NK_ggVJbactDip85DbfCaqSWRpO0CgwN1svY-KW4_Yg,1836
69
69
  mirascope/core/azure/call_response.py,sha256=eYH55I5awZ0Yhu3sK2N-4XLImjvRgDKOGF1pTs_QjIY,6834
70
70
  mirascope/core/azure/call_response_chunk.py,sha256=tcLgURISaGONGDvWjWDfDPs2c0hQJT_tVELiDqL33SQ,2884
71
71
  mirascope/core/azure/dynamic_config.py,sha256=6SBMGFce7tuXdwHrlKNISpZxVxUnnumbIQB9lGR6nbs,1066
@@ -81,7 +81,7 @@ mirascope/core/azure/_utils/_get_credential.py,sha256=hEWoKtB27PLZtC35qvPx36CPvQ
81
81
  mirascope/core/azure/_utils/_get_json_output.py,sha256=Qec7WJY5is1Q63Vp9uUNNfkRwgxhdoLMCI7AF_e2t90,1017
82
82
  mirascope/core/azure/_utils/_handle_stream.py,sha256=M_BGnjBGWTPefNyIMuJSHiDxIvqmENmqfVlDx_qzL1c,4638
83
83
  mirascope/core/azure/_utils/_message_param_converter.py,sha256=JAUeHObtd_V225YyZqEruuih3HRozq43pqjYJCbJj8A,4443
84
- mirascope/core/azure/_utils/_setup_call.py,sha256=07fVPaM56CC-nNgf9hjIAxiNTGC9XD3bvADEEOCKJ9E,5936
84
+ mirascope/core/azure/_utils/_setup_call.py,sha256=cdUof-RCxsPbKuJvevsEUYXU-ckoql3wTevNEQiEpz4,6496
85
85
  mirascope/core/base/__init__.py,sha256=iq8HMwrTt7MK-zgHg2JgBP4F7ruBTbDituFR2P4Jg2k,1904
86
86
  mirascope/core/base/_call_factory.py,sha256=YdFHAa9WtGfYeqVcM2xaDNh5gMg584rOe26_E51-1to,9663
87
87
  mirascope/core/base/_create.py,sha256=1UNRA6pwMguaiLyLiQkPzTk12ASaXT_hh7jlNw4UFX4,10016
@@ -350,7 +350,7 @@ mirascope/v0/base/ops_utils.py,sha256=1Qq-VIwgHBaYutiZsS2MUQ4OgPC3APyywI5bTiTAmA
350
350
  mirascope/v0/base/prompts.py,sha256=FM2Yz98cSnDceYogiwPrp4BALf3_F3d4fIOCGAkd-SE,1298
351
351
  mirascope/v0/base/types.py,sha256=ZfatJoX0Yl0e3jhv0D_MhiSVHLYUeJsdN3um3iE10zY,352
352
352
  mirascope/v0/base/utils.py,sha256=XREPENRQTu8gpMhHU8RC8qH_am3FfGUvY-dJ6x8i-mw,681
353
- mirascope-1.18.0.dist-info/METADATA,sha256=P63GzWcu4PhSMPV6Wie3XbEgz_Jpu1xu-FNl2yJeftk,8678
354
- mirascope-1.18.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
355
- mirascope-1.18.0.dist-info/licenses/LICENSE,sha256=LAs5Q8mdawTsVdONpDGukwsoc4KEUBmmonDEL39b23Y,1072
356
- mirascope-1.18.0.dist-info/RECORD,,
353
+ mirascope-1.18.1.dist-info/METADATA,sha256=EVxejvWOHOGfN2Xau4TuWEA1RwyI6l_aoN6UoSDz0uE,8678
354
+ mirascope-1.18.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
355
+ mirascope-1.18.1.dist-info/licenses/LICENSE,sha256=LAs5Q8mdawTsVdONpDGukwsoc4KEUBmmonDEL39b23Y,1072
356
+ mirascope-1.18.1.dist-info/RECORD,,