SandboxStream

class baseten.sandbox.SandboxStream

Bases: Generic[_ItemT]

Items a sandbox sends as they happen, read by iterating.

Reading to the end, or an error while reading, closes the stream. To stop early, use it as a context manager or call close(). Closing stops only the stream, never what it reports on, such as a running process.

Parameters:
  • response (httpx.Response)

  • parse (Callable[[Iterator[str]], Generator[_ItemT, None, None]])

close()

Stop reading and release the connection. Does nothing if already closed.

Return type:

None