inferencesh 0.2.20__py3-none-any.whl → 0.2.22__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 CHANGED
@@ -366,9 +366,9 @@ class ResponseTransformer:
366
366
  def stream_generate(
367
367
  model: Any,
368
368
  messages: List[Dict[str, Any]],
369
- tools: List[Dict[str, Any]],
370
- tool_choice: Dict[str, Any],
371
- transformer: ResponseTransformer,
369
+ transformer: ResponseTransformer = ResponseTransformer(),
370
+ tools: List[Dict[str, Any]] = [],
371
+ tool_choice: Dict[str, Any] = {},
372
372
  temperature: float = 0.7,
373
373
  top_p: float = 0.95,
374
374
  max_tokens: int = 4096,
@@ -416,7 +416,7 @@ def stream_generate(
416
416
  if "message" in delta:
417
417
  message = delta["message"]
418
418
  content = message.get("content", "")
419
- if "tool_calls" in message:
419
+ if message.get("tool_calls"):
420
420
  for tool in message["tool_calls"]:
421
421
  if tool.get("id") not in {t.get("id") for t in tool_calls}:
422
422
  tool_calls.append(tool)
@@ -426,7 +426,7 @@ def stream_generate(
426
426
  content = delta_content.get("content", "")
427
427
 
428
428
  # Handle streaming tool calls
429
- if "tool_calls" in delta_content:
429
+ if delta_content.get("tool_calls"):
430
430
  for tool_delta in delta_content["tool_calls"]:
431
431
  tool_id = tool_delta.get("id")
432
432
 
@@ -451,7 +451,13 @@ def stream_generate(
451
451
 
452
452
  finish_reason = delta.get("finish_reason")
453
453
 
454
- if content or "tool_calls" in (delta.get("message", {}) or delta.get("delta", {})):
454
+ has_update = bool(content)
455
+ has_tool_update = bool(
456
+ (delta.get("message", {}) or {}).get("tool_calls") or
457
+ (delta.get("delta", {}) or {}).get("tool_calls")
458
+ )
459
+
460
+ if has_update or has_tool_update:
455
461
  if not timing.first_token_time:
456
462
  timing.mark_first_token()
457
463
  response_queue.put((content, {}, tool_calls[:] if tool_calls else None))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: inferencesh
3
- Version: 0.2.20
3
+ Version: 0.2.22
4
4
  Summary: inference.sh Python SDK
5
5
  Author: Inference Shell Inc.
6
6
  Author-email: "Inference Shell Inc." <hello@inference.sh>
@@ -2,13 +2,13 @@ inferencesh/__init__.py,sha256=WdADtOhfa3HDOunoE9HLFCTFlXRykYstBIH1FpyWvj8,613
2
2
  inferencesh/models/__init__.py,sha256=FDwcdtT6c4hbRitymjmN-hZMlQa8RbKSftkZZyjtUXA,536
3
3
  inferencesh/models/base.py,sha256=4gZQRi8J7y9U6PrGD9pRIehd1MJVJAqGakPQDs2AKFM,3251
4
4
  inferencesh/models/file.py,sha256=5xnpypcRahM1YcEjj64rv9g2gTimxrZb41YT4r440hU,7393
5
- inferencesh/models/llm.py,sha256=MbNNGxzxcceXBAZJINOh3UFFY4PdG_Tl3nB8mNOGJxo,21456
5
+ inferencesh/models/llm.py,sha256=XVHsHANGHXhB54aXAS-YcQNcgM673Q_b90xa10gorbA,21729
6
6
  inferencesh/utils/__init__.py,sha256=-xiD6uo2XzcrPAWFb_fUbaimmnW4KFKc-8IvBzaxNd4,148
7
7
  inferencesh/utils/download.py,sha256=7n5twvoNYDcFnKJyefImaj2YfzRI7vddQw4usZbj38c,1521
8
8
  inferencesh/utils/storage.py,sha256=E4J8emd4eFKdmdDgAqzz3TpaaDd3n0l8gYlMHuY8yIU,519
9
- inferencesh-0.2.20.dist-info/licenses/LICENSE,sha256=OsgqEWIh2el_QMj0y8O1A5Q5Dl-dxqqYbFE6fszuR4s,1086
10
- inferencesh-0.2.20.dist-info/METADATA,sha256=s8YwPPOHBktqvghEa1Ecc1SoixmGYnyDf7Jw42nqJu0,2757
11
- inferencesh-0.2.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
- inferencesh-0.2.20.dist-info/entry_points.txt,sha256=6IC-fyozAqW3ljsMLGCXxJ0_ui2Jb-2fLHtoH1RTnEE,45
13
- inferencesh-0.2.20.dist-info/top_level.txt,sha256=TSMHg3T1ThMl1HGAWmzBClwOYH1ump5neof9BfHIwaA,12
14
- inferencesh-0.2.20.dist-info/RECORD,,
9
+ inferencesh-0.2.22.dist-info/licenses/LICENSE,sha256=OsgqEWIh2el_QMj0y8O1A5Q5Dl-dxqqYbFE6fszuR4s,1086
10
+ inferencesh-0.2.22.dist-info/METADATA,sha256=o78bpkWPq1MqQH_qgT3VTK1hJLKrZRHUX8e5PVuS_4M,2757
11
+ inferencesh-0.2.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ inferencesh-0.2.22.dist-info/entry_points.txt,sha256=6IC-fyozAqW3ljsMLGCXxJ0_ui2Jb-2fLHtoH1RTnEE,45
13
+ inferencesh-0.2.22.dist-info/top_level.txt,sha256=TSMHg3T1ThMl1HGAWmzBClwOYH1ump5neof9BfHIwaA,12
14
+ inferencesh-0.2.22.dist-info/RECORD,,