MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / interrupted_stream_response

Function interrupted_stream_response

tests/lib/threads/helpers.py:492–499  ·  view source on GitHub ↗

A streamed reply cut off in its text block, once `text` has arrived: the body ends there, or reading on raises `error`.

(
    id: str, text: str, *, error: type[httpx2.TransportError] | None = None
)

Source from the content-addressed store, hash-verified

490
491
492def interrupted_stream_response(
493 id: str, text: str, *, error: type[httpx2.TransportError] | None = None
494) -> httpx2.Response:
495 """A streamed reply cut off in its text block, once `text` has arrived: the body ends there, or reading on raises
496 `error`."""
497 return httpx2.Response(
498 200, headers={"content-type": "text/event-stream"}, content=_interrupted_sse_body(id, text, error)
499 )
500
501
502def async_interrupted_stream_response(

Calls 1

_interrupted_sse_bodyFunction · 0.85