inferencesh 0.4.19__py3-none-any.whl → 0.4.20__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.
Potentially problematic release.
This version of inferencesh might be problematic. Click here for more details.
- inferencesh/models/llm.py +11 -4
- {inferencesh-0.4.19.dist-info → inferencesh-0.4.20.dist-info}/METADATA +1 -1
- {inferencesh-0.4.19.dist-info → inferencesh-0.4.20.dist-info}/RECORD +7 -7
- {inferencesh-0.4.19.dist-info → inferencesh-0.4.20.dist-info}/WHEEL +0 -0
- {inferencesh-0.4.19.dist-info → inferencesh-0.4.20.dist-info}/entry_points.txt +0 -0
- {inferencesh-0.4.19.dist-info → inferencesh-0.4.20.dist-info}/licenses/LICENSE +0 -0
- {inferencesh-0.4.19.dist-info → inferencesh-0.4.20.dist-info}/top_level.txt +0 -0
inferencesh/models/llm.py
CHANGED
|
@@ -224,8 +224,6 @@ def build_messages(
|
|
|
224
224
|
parts.append({"type": "image_url", "image_url": {"url": image_data_uri}})
|
|
225
225
|
elif msg.image.uri:
|
|
226
226
|
parts.append({"type": "image_url", "image_url": {"url": msg.image.uri}})
|
|
227
|
-
if msg.tool_calls:
|
|
228
|
-
parts.append({"type": "tool_call", "tool_calls": msg.tool_calls})
|
|
229
227
|
if allow_multipart:
|
|
230
228
|
return parts
|
|
231
229
|
if len(parts) == 1 and parts[0]["type"] == "text":
|
|
@@ -239,6 +237,13 @@ def build_messages(
|
|
|
239
237
|
images = [msg.image for msg in messages if msg.image]
|
|
240
238
|
image = images[0] if images else None # TODO: handle multiple images
|
|
241
239
|
return ContextMessage(role=messages[0].role, text=text, image=image)
|
|
240
|
+
|
|
241
|
+
def merge_tool_calls(messages: List[ContextMessage]) -> List[Dict[str, Any]]:
|
|
242
|
+
tool_calls = []
|
|
243
|
+
for msg in messages:
|
|
244
|
+
if msg.tool_calls:
|
|
245
|
+
tool_calls.extend(msg.tool_calls)
|
|
246
|
+
return tool_calls
|
|
242
247
|
|
|
243
248
|
user_input_text = ""
|
|
244
249
|
if hasattr(input_data, "text"):
|
|
@@ -264,14 +269,16 @@ def build_messages(
|
|
|
264
269
|
else:
|
|
265
270
|
messages.append({
|
|
266
271
|
"role": current_role,
|
|
267
|
-
"content": render_message(merge_messages(current_messages), allow_multipart=multipart)
|
|
272
|
+
"content": render_message(merge_messages(current_messages), allow_multipart=multipart),
|
|
273
|
+
"tool_calls": merge_tool_calls(current_messages)
|
|
268
274
|
})
|
|
269
275
|
current_messages = [msg]
|
|
270
276
|
current_role = msg.role
|
|
271
277
|
if len(current_messages) > 0:
|
|
272
278
|
messages.append({
|
|
273
279
|
"role": current_role,
|
|
274
|
-
"content": render_message(merge_messages(current_messages), allow_multipart=multipart)
|
|
280
|
+
"content": render_message(merge_messages(current_messages), allow_multipart=multipart),
|
|
281
|
+
"tool_calls": merge_tool_calls(current_messages)
|
|
275
282
|
})
|
|
276
283
|
|
|
277
284
|
return messages
|
|
@@ -3,13 +3,13 @@ inferencesh/client.py,sha256=sMgr6vVPD84P3LpQfjmuKqlRpbgOUmWLFQ9IJM5kWzc,39410
|
|
|
3
3
|
inferencesh/models/__init__.py,sha256=FDwcdtT6c4hbRitymjmN-hZMlQa8RbKSftkZZyjtUXA,536
|
|
4
4
|
inferencesh/models/base.py,sha256=eTwRvXAjMGh6b8AUXWKSGpRyeScAkPs6bNYY8AXKSz8,5505
|
|
5
5
|
inferencesh/models/file.py,sha256=H4s-A2RWfNTMCcLqSLpqNHvGfSvYEnbZaJj-rWftrL0,11743
|
|
6
|
-
inferencesh/models/llm.py,sha256=
|
|
6
|
+
inferencesh/models/llm.py,sha256=1k54fEiY0L241vzcENeNvCWDrCbntfILB0-95JxKbWg,28708
|
|
7
7
|
inferencesh/utils/__init__.py,sha256=-xiD6uo2XzcrPAWFb_fUbaimmnW4KFKc-8IvBzaxNd4,148
|
|
8
8
|
inferencesh/utils/download.py,sha256=DRGBudiPVa5bDS35KfR-DYeGRk7gO03WOelnisecwMo,1815
|
|
9
9
|
inferencesh/utils/storage.py,sha256=E4J8emd4eFKdmdDgAqzz3TpaaDd3n0l8gYlMHuY8yIU,519
|
|
10
|
-
inferencesh-0.4.
|
|
11
|
-
inferencesh-0.4.
|
|
12
|
-
inferencesh-0.4.
|
|
13
|
-
inferencesh-0.4.
|
|
14
|
-
inferencesh-0.4.
|
|
15
|
-
inferencesh-0.4.
|
|
10
|
+
inferencesh-0.4.20.dist-info/licenses/LICENSE,sha256=OsgqEWIh2el_QMj0y8O1A5Q5Dl-dxqqYbFE6fszuR4s,1086
|
|
11
|
+
inferencesh-0.4.20.dist-info/METADATA,sha256=K8shP2g-2-MG2fu-yOd0zwdyCE8W9RKz33WGyxcJzDA,5406
|
|
12
|
+
inferencesh-0.4.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
inferencesh-0.4.20.dist-info/entry_points.txt,sha256=6IC-fyozAqW3ljsMLGCXxJ0_ui2Jb-2fLHtoH1RTnEE,45
|
|
14
|
+
inferencesh-0.4.20.dist-info/top_level.txt,sha256=TSMHg3T1ThMl1HGAWmzBClwOYH1ump5neof9BfHIwaA,12
|
|
15
|
+
inferencesh-0.4.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|