feat(chat): stop an in-flight answer — Send becomes Stop, the partial is kept and persisted, the model stream is torn down
This commit is contained in:
@@ -289,6 +289,7 @@ def _chunk(
|
||||
class _FakeChatStream:
|
||||
def __init__(self, chunks: list) -> None:
|
||||
self._chunks = list(chunks)
|
||||
self.close_calls = 0
|
||||
|
||||
def __aiter__(self):
|
||||
self._i = 0
|
||||
@@ -301,6 +302,11 @@ class _FakeChatStream:
|
||||
self._i += 1
|
||||
return chunk
|
||||
|
||||
async def close(self) -> None:
|
||||
"""The openai SDK ``AsyncStream.close()`` (phase 48): ``chat_stream``
|
||||
awaits it on every exit after a successful ``create()``."""
|
||||
self.close_calls += 1
|
||||
|
||||
|
||||
class _FakeCompletion:
|
||||
"""One fake non-streaming ChatCompletion (``choices[].message`` shape).
|
||||
|
||||
Reference in New Issue
Block a user