Skip to content

Commit a06ee6e

Browse files
author
Daniel Schleicher
committed
Fixed errors from hatch run prepare
1 parent b0bab40 commit a06ee6e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/strands/models/litellm.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ async def stream(
127127
logger.debug("request=<%s>", request)
128128

129129
# Check if streaming is disabled in the params
130-
params = self.get_config().get("params", {})
130+
config = self.get_config()
131+
params = config.get("params") or {}
131132
is_streaming = params.get("stream", True)
132133

133134
litellm_request = {**request}
@@ -194,7 +195,7 @@ async def stream(
194195
yield self.format_chunk({"chunk_type": "message_start"})
195196
yield self.format_chunk({"chunk_type": "content_start", "data_type": "text"})
196197

197-
tool_calls: dict[int, list[Any]] = {}
198+
streaming_tool_calls: dict[int, list[Any]] = {}
198199
finish_reason = None
199200

200201
try:
@@ -219,7 +220,7 @@ async def stream(
219220
)
220221

221222
for tool_call in choice.delta.tool_calls or []:
222-
tool_calls.setdefault(tool_call.index, []).append(tool_call)
223+
streaming_tool_calls.setdefault(tool_call.index, []).append(tool_call)
223224

224225
if choice.finish_reason:
225226
finish_reason = choice.finish_reason
@@ -230,7 +231,7 @@ async def stream(
230231
yield self.format_chunk({"chunk_type": "content_stop", "data_type": "text"})
231232

232233
# Process tool calls
233-
for tool_deltas in tool_calls.values():
234+
for tool_deltas in streaming_tool_calls.values():
234235
yield self.format_chunk({"chunk_type": "content_start", "data_type": "tool", "data": tool_deltas[0]})
235236

236237
for tool_delta in tool_deltas:

0 commit comments

Comments
 (0)