fix: stream internal model calls with idle timeouts (#5730)
* fix: stream internal model calls with idle timeouts * fix(providers): reject streams without terminal events
This commit is contained in:
1 parent
aeb7b207d7
commit
73410e0217
60 files changed
+815
-795
No files matched your search
@@ -240,6 +240,21 @@ def test_parse_response_maps_text_tools_reasoning_usage_and_stop_reason() -> Non
|
||||
assert result.tool_calls[0].arguments == {"q": "x"}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_chat_stream_retries_eof_without_stop_reason() -> None:
|
||||
client = FakeClient(stream_events=[
|
||||
{"contentBlockDelta": {"contentBlockIndex": 0, "delta": {"text": "partial summary"}}},
|
||||
])
|
||||
provider = BedrockProvider(region="us-east-1", client=client)
|
||||
provider._CHAT_RETRY_DELAYS = (0,)
|
||||
|
||||
result = await provider.chat_stream_with_retry([{"role": "user", "content": "summarize"}])
|
||||
|
||||
assert result.finish_reason == "error"
|
||||
assert result.error_kind == "connection"
|
||||
assert len(client.stream_calls) == 2
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_chat_stream_aggregates_text_tool_use_and_usage() -> None:
|
||||
client = FakeClient(stream_events=[
|
||||
|
||||
Reference in new issue
Block a user