inferencesh 0.2.24__py3-none-any.whl → 0.2.26__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
@@ -87,9 +87,9 @@ class LLMInput(BaseAppInput):
87
87
  context_size: int = Field(default=4096)
88
88
 
89
89
  # Model specific flags
90
- reasoning: bool = Field(default=False)
90
+ reasoning: Optional[bool] = Field(default=None)
91
91
 
92
- tools: List[Dict[str, Any]] = Field(default=[])
92
+ tools: Optional[List[Dict[str, Any]]] = Field(default=None)
93
93
 
94
94
  class LLMUsage(BaseAppOutput):
95
95
  stop_reason: str = ""
@@ -235,22 +235,16 @@ class StreamResponse:
235
235
 
236
236
  def update_from_chunk(self, chunk: Dict[str, Any], timing: Any) -> None:
237
237
  """Update response state from a chunk."""
238
- print("DEBUG: Entering update_from_chunk")
239
- print(f"DEBUG: Current usage stats: {self.usage_stats}")
240
- print(f"DEBUG: Chunk: {chunk}")
241
-
242
238
  # Update usage stats if present
243
239
  if "usage" in chunk:
244
240
  usage = chunk["usage"]
245
241
  if usage is not None:
246
- print(f"DEBUG: Updating usage stats with: {usage}")
247
242
  # Update usage stats preserving existing values if not provided
248
243
  self.usage_stats.update({
249
244
  "prompt_tokens": usage.get("prompt_tokens", self.usage_stats["prompt_tokens"]),
250
245
  "completion_tokens": usage.get("completion_tokens", self.usage_stats["completion_tokens"]),
251
246
  "total_tokens": usage.get("total_tokens", self.usage_stats["total_tokens"])
252
247
  })
253
- print(f"DEBUG: Updated usage stats: {self.usage_stats}")
254
248
 
255
249
  # Get the delta from the chunk
256
250
  delta = chunk.get("choices", [{}])[0]
@@ -290,7 +284,6 @@ class StreamResponse:
290
284
  self.usage_stats["completion_tokens"] / timing_stats["generation_time"]
291
285
  )
292
286
 
293
- print(f"DEBUG: Final usage stats in update_from_chunk: {self.usage_stats}")
294
287
 
295
288
  def _update_tool_calls(self, new_tool_calls: List[Dict[str, Any]]) -> None:
296
289
  """Update tool calls, handling both full and partial updates."""
@@ -327,15 +320,10 @@ class StreamResponse:
327
320
  has_usage = self.usage_stats["prompt_tokens"] > 0 or self.usage_stats["completion_tokens"] > 0
328
321
  has_finish = bool(self.finish_reason)
329
322
 
330
- print(f"DEBUG: has_updates check - content: {has_content}, tool_calls: {has_tool_calls}, usage: {has_usage}, finish: {has_finish}")
331
-
332
323
  return has_content or has_tool_calls or has_usage or has_finish
333
324
 
334
325
  def to_output(self, buffer: str, transformer: Any) -> LLMOutput:
335
- """Convert current state to LLMOutput."""
336
- print("DEBUG: Entering to_output")
337
- print(f"DEBUG: Usage stats before conversion: {self.usage_stats}")
338
-
326
+ """Convert current state to LLMOutput."""
339
327
  buffer, output, _ = transformer(self.content, buffer)
340
328
 
341
329
  # Add tool calls if present
@@ -343,7 +331,6 @@ class StreamResponse:
343
331
  output.tool_calls = self.tool_calls
344
332
 
345
333
  # Add usage stats
346
- print(f"DEBUG: Creating LLMUsage with stats: {self.usage_stats}")
347
334
  output.usage = LLMUsage(
348
335
  stop_reason=self.usage_stats["stop_reason"],
349
336
  time_to_first_token=self.timing_stats["time_to_first_token"] or 0.0,
@@ -354,7 +341,6 @@ class StreamResponse:
354
341
  reasoning_time=self.timing_stats["reasoning_time"],
355
342
  reasoning_tokens=self.timing_stats["reasoning_tokens"]
356
343
  )
357
- print(f"DEBUG: Created output usage: {output.usage}")
358
344
 
359
345
  return output, buffer
360
346
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: inferencesh
3
- Version: 0.2.24
3
+ Version: 0.2.26
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=ycg20sSx3UJevjoTVukBZXwRyXY06tFZKAmlVp0MBzQ,23168
5
+ inferencesh/models/llm.py,sha256=3NZW6-_SXNPqVHu5LUDACYQupa9DHMJxDvay3x-AEUY,22383
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.24.dist-info/licenses/LICENSE,sha256=OsgqEWIh2el_QMj0y8O1A5Q5Dl-dxqqYbFE6fszuR4s,1086
10
- inferencesh-0.2.24.dist-info/METADATA,sha256=kQq9qN65EU9DS-SAQHm3Sw73yzz-FZVQX6ueHSgktW8,2757
11
- inferencesh-0.2.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
- inferencesh-0.2.24.dist-info/entry_points.txt,sha256=6IC-fyozAqW3ljsMLGCXxJ0_ui2Jb-2fLHtoH1RTnEE,45
13
- inferencesh-0.2.24.dist-info/top_level.txt,sha256=TSMHg3T1ThMl1HGAWmzBClwOYH1ump5neof9BfHIwaA,12
14
- inferencesh-0.2.24.dist-info/RECORD,,
9
+ inferencesh-0.2.26.dist-info/licenses/LICENSE,sha256=OsgqEWIh2el_QMj0y8O1A5Q5Dl-dxqqYbFE6fszuR4s,1086
10
+ inferencesh-0.2.26.dist-info/METADATA,sha256=cbycGHYSsZVicaxlQWqiDV4KhZsTkXDT0OU3hArQG04,2757
11
+ inferencesh-0.2.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ inferencesh-0.2.26.dist-info/entry_points.txt,sha256=6IC-fyozAqW3ljsMLGCXxJ0_ui2Jb-2fLHtoH1RTnEE,45
13
+ inferencesh-0.2.26.dist-info/top_level.txt,sha256=TSMHg3T1ThMl1HGAWmzBClwOYH1ump5neof9BfHIwaA,12
14
+ inferencesh-0.2.26.dist-info/RECORD,,