Skip to content

Commit d490c07

Browse files
committed
fix: move mapping.clear() after call to format request and update expected tooluseid in relevant test
1 parent 967ea58 commit d490c07

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/strands/models/gemini.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,8 @@ async def stream(
374374
Raises:
375375
ModelThrottledException: If the request is throttled by Gemini.
376376
"""
377-
self._tool_use_id_to_name.clear()
378-
379377
request = self._format_request(messages, tool_specs, system_prompt, self.config.get("params"))
378+
self._tool_use_id_to_name.clear()
380379

381380
client = genai.Client(**self.client_args).aio
382381
try:

tests/strands/models/test_gemini.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ async def test_stream_response_tool_use(gemini_client, model, messages, agenerat
459459
exp_chunks = [
460460
{"messageStart": {"role": "assistant"}},
461461
{"contentBlockStart": {"start": {}}},
462-
{"contentBlockStart": {"start": {"toolUse": {"name": "calculator", "toolUseId": "calculator"}}}},
462+
{"contentBlockStart": {"start": {"toolUse": {"name": "calculator", "toolUseId": "c1"}}}},
463463
{"contentBlockDelta": {"delta": {"toolUse": {"input": '{"expression": "2+2"}'}}}},
464464
{"contentBlockStop": {}},
465465
{"contentBlockStop": {}},

0 commit comments

Comments
 (0)