MCPcopy
hub / github.com/openai/openai-python / on_event

Function on_event

tests/lib/chat/test_completions_streaming.py:106–108  ·  view source on GitHub ↗
(stream: ChatCompletionStream[Location], event: ChatCompletionStreamEvent[Location])

Source from the content-addressed store, hash-verified

104 done_snapshots: list[ParsedChatCompletionSnapshot] = []
105
106 def on_event(stream: ChatCompletionStream[Location], event: ChatCompletionStreamEvent[Location]) -> None:
107 if event.type == "content.done":
108 done_snapshots.append(model_copy(stream.current_completion_snapshot, deep=True))
109
110 listener = _make_stream_snapshot_request(
111 lambda c: c.chat.completions.stream(

Callers 1

Calls 2

model_copyFunction · 0.90
appendMethod · 0.45

Tested by

no test coverage detected