mirascope 1.22.4__py3-none-any.whl → 1.22.6__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/core/google/call_response_chunk.py +8 -1
- mirascope/core/openai/_utils/_convert_message_params.py +24 -22
- {mirascope-1.22.4.dist-info → mirascope-1.22.6.dist-info}/METADATA +1 -1
- {mirascope-1.22.4.dist-info → mirascope-1.22.6.dist-info}/RECORD +6 -6
- {mirascope-1.22.4.dist-info → mirascope-1.22.6.dist-info}/WHEEL +0 -0
- {mirascope-1.22.4.dist-info → mirascope-1.22.6.dist-info}/licenses/LICENSE +0 -0
|
@@ -48,7 +48,14 @@ class GoogleCallResponseChunk(
|
|
|
48
48
|
@property
|
|
49
49
|
def content(self) -> str:
|
|
50
50
|
"""Returns the chunk content for the 0th choice."""
|
|
51
|
-
|
|
51
|
+
if (
|
|
52
|
+
not (candidates := self.chunk.candidates)
|
|
53
|
+
or not (content := candidates[0].content)
|
|
54
|
+
or not (parts := content.parts)
|
|
55
|
+
or not (text := parts[0].text)
|
|
56
|
+
):
|
|
57
|
+
return ""
|
|
58
|
+
return text
|
|
52
59
|
|
|
53
60
|
@property
|
|
54
61
|
def finish_reasons(self) -> list[GoogleFinishReason]:
|
|
@@ -22,6 +22,7 @@ def convert_message_params(
|
|
|
22
22
|
else:
|
|
23
23
|
converted_content = []
|
|
24
24
|
|
|
25
|
+
tool_calls = []
|
|
25
26
|
for part in content:
|
|
26
27
|
if part.type == "text":
|
|
27
28
|
converted_content.append(part.model_dump())
|
|
@@ -100,25 +101,16 @@ def convert_message_params(
|
|
|
100
101
|
}
|
|
101
102
|
)
|
|
102
103
|
elif part.type == "tool_call":
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"id": part.id,
|
|
114
|
-
}
|
|
115
|
-
],
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if converted_content:
|
|
119
|
-
converted_message_param["content"] = converted_content
|
|
120
|
-
converted_content = []
|
|
121
|
-
converted_message_params.append(converted_message_param)
|
|
104
|
+
tool_calls.append(
|
|
105
|
+
{
|
|
106
|
+
"function": {
|
|
107
|
+
"name": part.name,
|
|
108
|
+
"arguments": json.dumps(part.args),
|
|
109
|
+
},
|
|
110
|
+
"type": "function",
|
|
111
|
+
"id": part.id,
|
|
112
|
+
}
|
|
113
|
+
)
|
|
122
114
|
elif part.type == "tool_result":
|
|
123
115
|
if converted_content:
|
|
124
116
|
converted_message_params.append(
|
|
@@ -138,9 +130,19 @@ def convert_message_params(
|
|
|
138
130
|
"OpenAI currently only supports text, image and audio parts. "
|
|
139
131
|
f"Part provided: {part.type}"
|
|
140
132
|
)
|
|
141
|
-
if
|
|
133
|
+
if tool_calls:
|
|
134
|
+
converted_message_param = {
|
|
135
|
+
"role": "assistant",
|
|
136
|
+
"tool_calls": tool_calls,
|
|
137
|
+
}
|
|
138
|
+
converted_message_params.append(converted_message_param)
|
|
139
|
+
if converted_content:
|
|
140
|
+
converted_message_param["content"] = converted_content
|
|
141
|
+
elif converted_content:
|
|
142
142
|
converted_message_params.append(
|
|
143
|
-
{
|
|
143
|
+
{
|
|
144
|
+
"role": message_param.role,
|
|
145
|
+
"content": converted_content,
|
|
146
|
+
}
|
|
144
147
|
)
|
|
145
|
-
# print(converted_message_params)
|
|
146
148
|
return converted_message_params
|
|
@@ -214,7 +214,7 @@ mirascope/core/google/_call.py,sha256=GJOPyvHzVlSXvJpgQhJFg4wFHFUYsvvrbjhNxU-nSl
|
|
|
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
216
|
mirascope/core/google/call_response.py,sha256=nAlH1XWQMiMfCKgi6sG3qIA0YccxIzLWzY_NNl2JtqM,7372
|
|
217
|
-
mirascope/core/google/call_response_chunk.py,sha256=
|
|
217
|
+
mirascope/core/google/call_response_chunk.py,sha256=14ggxCYtl92LdyA3nxY8awKQVSBvFV1Wse2Jm7rfvJc,3535
|
|
218
218
|
mirascope/core/google/dynamic_config.py,sha256=O6j8F0fLVFuuNwURneu5OpPuu_bMEtbDEFHhJXRT6V0,857
|
|
219
219
|
mirascope/core/google/stream.py,sha256=bTxB8OUrKXxzmcX0C7_-LqtBfaAAazA5HjKZGSxxtLw,4466
|
|
220
220
|
mirascope/core/google/tool.py,sha256=61a9Ejdxz41pwaab9VE2yvP_J1Aebua3BeRPJ_GJSnE,5138
|
|
@@ -285,7 +285,7 @@ mirascope/core/openai/stream.py,sha256=jyI9Q4-Ne4N34n30RzRCYsi8z-hFqXbV_Occ7KrFk
|
|
|
285
285
|
mirascope/core/openai/tool.py,sha256=iJWJQrY3-1Rq5OywzKFO9JUAcglneGD0UtkS3pcA0pg,3154
|
|
286
286
|
mirascope/core/openai/_utils/__init__.py,sha256=Y1nMFOydpFvMWcuoB8TzMD33uZoMIM0C8_kYJkv_JJE,388
|
|
287
287
|
mirascope/core/openai/_utils/_convert_common_call_params.py,sha256=gvxsRdULxiC2137M9l53hUmF0ZkBxFQFurhWBcl_5Cg,739
|
|
288
|
-
mirascope/core/openai/_utils/_convert_message_params.py,sha256=
|
|
288
|
+
mirascope/core/openai/_utils/_convert_message_params.py,sha256=B4pNV-QDR6bLaJVif1pjEogeEASzhPA6YokPGGLQaNw,6219
|
|
289
289
|
mirascope/core/openai/_utils/_get_json_output.py,sha256=Q_5R6NFFDvmLoz9BQiymC5AEyYvxKPH2_XnOQZ8hIkU,1215
|
|
290
290
|
mirascope/core/openai/_utils/_handle_stream.py,sha256=adsHAcTtGyMMFU9xnUsE4Yd2wrhSNSjcVddkS74mli0,5226
|
|
291
291
|
mirascope/core/openai/_utils/_message_param_converter.py,sha256=r6zJ54xHMxxJ-2daY8l5FyDIa0HsdXeP0cN1wHNt6-E,4101
|
|
@@ -371,7 +371,7 @@ mirascope/v0/base/ops_utils.py,sha256=1Qq-VIwgHBaYutiZsS2MUQ4OgPC3APyywI5bTiTAmA
|
|
|
371
371
|
mirascope/v0/base/prompts.py,sha256=FM2Yz98cSnDceYogiwPrp4BALf3_F3d4fIOCGAkd-SE,1298
|
|
372
372
|
mirascope/v0/base/types.py,sha256=ZfatJoX0Yl0e3jhv0D_MhiSVHLYUeJsdN3um3iE10zY,352
|
|
373
373
|
mirascope/v0/base/utils.py,sha256=XREPENRQTu8gpMhHU8RC8qH_am3FfGUvY-dJ6x8i-mw,681
|
|
374
|
-
mirascope-1.22.
|
|
375
|
-
mirascope-1.22.
|
|
376
|
-
mirascope-1.22.
|
|
377
|
-
mirascope-1.22.
|
|
374
|
+
mirascope-1.22.6.dist-info/METADATA,sha256=j1V88cvscUYrvPpSsjyRRBzf0RzxuUux6jnu7ZC7U9c,8783
|
|
375
|
+
mirascope-1.22.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
376
|
+
mirascope-1.22.6.dist-info/licenses/LICENSE,sha256=LAs5Q8mdawTsVdONpDGukwsoc4KEUBmmonDEL39b23Y,1072
|
|
377
|
+
mirascope-1.22.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|