Skip to content

Commit f233301

Browse files
committed
llm function calling v0
1 parent c7bb38a commit f233301

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/inferencesh/models/llm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class StreamResponse:
213213
"""Holds a single chunk of streamed response."""
214214
def __init__(self):
215215
self.content = ""
216-
self.tool_calls = []
216+
self.tool_calls = None # Changed from [] to None
217217
self.finish_reason = None
218218
self.timing_stats = {
219219
"time_to_first_token": 0.0,
@@ -265,6 +265,9 @@ def update_from_chunk(self, chunk: Dict[str, Any], timing: Any) -> None:
265265

266266
def _update_tool_calls(self, new_tool_calls: List[Dict[str, Any]]) -> None:
267267
"""Update tool calls, handling both full and partial updates."""
268+
if self.tool_calls is None:
269+
self.tool_calls = []
270+
268271
for tool_delta in new_tool_calls:
269272
tool_id = tool_delta.get("id")
270273
if not tool_id:

0 commit comments

Comments
 (0)