@@ -137,14 +137,13 @@ async def test_get_response_reports_the_requested_model(client_model: str | None
137137class _StubConverseAndStreamWithoutModelId (_StubConverseWithoutModelId ):
138138 def converse_stream (self , ** kwargs : Any ) -> dict [str , Any ]:
139139 self .calls .append (kwargs )
140- return {
141- "stream" : _StubEventStream ([
142- {"messageStart" : {"role" : "assistant" }},
143- {"contentBlockDelta" : {"delta" : {"text" : "hi" }, "contentBlockIndex" : 0 }},
144- {"contentBlockStop" : {"contentBlockIndex" : 0 }},
145- {"messageStop" : {"stopReason" : "end_turn" }},
146- ])
147- }
140+ events : list [dict [str , Any ]] = [
141+ {"messageStart" : {"role" : "assistant" }},
142+ {"contentBlockDelta" : {"delta" : {"text" : "hi" }, "contentBlockIndex" : 0 }},
143+ {"contentBlockStop" : {"contentBlockIndex" : 0 }},
144+ {"messageStop" : {"stopReason" : "end_turn" }},
145+ ]
146+ return {"stream" : _StubEventStream (events )}
148147
149148
150149@pytest .mark .parametrize ("stream" , [False , True ])
@@ -157,13 +156,12 @@ async def test_streaming_and_non_streaming_report_the_same_model(stream: bool) -
157156 client = stub , # pyrefly: ignore[bad-argument-type] # ty: ignore[invalid-argument-type] # pyright: ignore[reportArgumentType]
158157 )
159158 messages = [Message (role = "user" , contents = [Content .from_text (text = "hello" )])]
160- options = {"model" : "us.openai.gpt-6-sol" }
161159
162160 if stream :
163- response_stream = client .get_response (messages = messages , options = options , stream = True )
161+ response_stream = client .get_response (messages = messages , options = { "model" : "us.openai.gpt-6-sol" } , stream = True )
164162 response = await response_stream .get_final_response ()
165163 else :
166- response = await client .get_response (messages = messages , options = options )
164+ response = await client .get_response (messages = messages , options = { "model" : "us.openai.gpt-6-sol" } )
167165
168166 assert stub .calls [0 ]["modelId" ] == "us.openai.gpt-6-sol"
169167 assert response .text == "hi"
0 commit comments