nemoguardrails.server.experimental.providers.openai.chat_completions.stream_hooks
nemoguardrails.server.experimental.providers.openai.chat_completions.stream_hooks
Bind OpenAI Chat Completions protocol hooks to the staged classifier.
Module Contents
Classes
API
Require successful streams to end with [DONE].
A provider error may end the stream without a sentinel. Data-less keepalives are permitted throughout; payload events cannot follow an error or sentinel, except for a sentinel after an error. State belongs to one upstream stream.
Encode an OpenAI-compatible error and terminal chat event.
Track the actual sentinel and reject payloads after termination.
Reject successful streams that end before their sentinel.