inferencesh 0.2.24__tar.gz → 0.2.26__tar.gz
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-0.2.24/src/inferencesh.egg-info → inferencesh-0.2.26}/PKG-INFO +1 -1
- {inferencesh-0.2.24 → inferencesh-0.2.26}/pyproject.toml +1 -1
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh/models/llm.py +3 -17
- {inferencesh-0.2.24 → inferencesh-0.2.26/src/inferencesh.egg-info}/PKG-INFO +1 -1
- {inferencesh-0.2.24 → inferencesh-0.2.26}/LICENSE +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/README.md +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/setup.cfg +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/setup.py +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh/__init__.py +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh/models/__init__.py +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh/models/base.py +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh/models/file.py +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh/utils/__init__.py +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh/utils/download.py +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh/utils/storage.py +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh.egg-info/SOURCES.txt +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh.egg-info/dependency_links.txt +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh.egg-info/entry_points.txt +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh.egg-info/requires.txt +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/src/inferencesh.egg-info/top_level.txt +0 -0
- {inferencesh-0.2.24 → inferencesh-0.2.26}/tests/test_sdk.py +0 -0
|
@@ -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=
|
|
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
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|