Skip to navigation

nemoguardrails.server.experimental.providers.openai.responses.stream_projection

View as MarkdownOpen in Claude

Typed Responses SSE shapes; protocol ordering belongs to stream hooks.

Module Contents

Classes

NameDescription
ResponsesCompletedEventProjectionSuccessful native completion carries a final verified snapshot.
ResponsesContentPartAddedEventProjectionA reviewed text part snapshot, including its initial empty state.
ResponsesContentPartDoneEventProjectionThe final snapshot of the single text part.
ResponsesCreatedEventProjectionCreation is a nonterminal snapshot.
ResponsesErrorEventProjectionA provider error is terminal diagnostic data, not assistant output.
ResponsesEventProjectionValidate sequence numbers when supplied, without requiring unrelated metadata.
ResponsesFailedEventProjectionFailure may still contain text and therefore remains a checked snapshot.
ResponsesInProgressEventProjectionProgress is a nonterminal snapshot.
ResponsesIncompleteEventProjectionAn incomplete response is terminal, but its partial text is not opaque.
ResponsesIndexedEventProjectionTrack an output position without assuming reasoning always precedes text.
ResponsesLifecycleEventProjectionShare the response snapshot field, not its concrete event identity.
ResponsesLifecycleResponseProjectionDescribe a full response snapshot without demanding a message before generation.
ResponsesMessageAddedEventProjectionThe assistant item is a snapshot, not opaque output.
ResponsesMessageDoneEventProjectionThe completed assistant item must agree with previously observed deltas.
ResponsesQueuedEventProjectionQueue metadata does not make background execution an accepted request mode.
ResponsesReasoningAddedEventProjectionAllow only the reviewed, non-plaintext reasoning item.
ResponsesReasoningDoneEventProjectionPreserve completed reasoning metadata without inspecting encrypted values.
ResponsesSnapshotMessageProjectionAllow an initially empty message, but never a second guarded text part.
ResponsesSnapshotTextProjectionAn empty initial text snapshot is valid; annotations and logprobs stay restricted.
ResponsesTextDeltaEventProjectionOnly this event introduces new guarded assistant text.
ResponsesTextDoneEventProjectionRepeat the accumulated text rather than introducing a second text source.
ResponsesTextEventProjectionRestrict content to the single text part and validate any supplied identity.

API

class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesCompletedEventProjection()

Bases: ResponsesLifecycleEventProjection

Successful native completion carries a final verified snapshot.

policy
ObjectPolicy = ObjectPolicy(source='ResponseCompletedEvent')
type
Annotated[Literal['response.completed'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesContentPartAddedEventProjection()

Bases: ResponsesTextEventProjection

A reviewed text part snapshot, including its initial empty state.

part
Annotated[ResponsesSnapshotTextProjection, guarded()]
policy
ObjectPolicy
type
Annotated[Literal['response.content_part.added'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesContentPartDoneEventProjection()

Bases: ResponsesTextEventProjection

The final snapshot of the single text part.

part
Annotated[ResponsesSnapshotTextProjection, guarded()]
policy
ObjectPolicy
type
Annotated[Literal['response.content_part.done'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesCreatedEventProjection()

Bases: ResponsesLifecycleEventProjection

Creation is a nonterminal snapshot.

policy
ObjectPolicy = ObjectPolicy(source='ResponseCreatedEvent')
type
Annotated[Literal['response.created'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesErrorEventProjection()

Bases: ResponsesEventProjection

A provider error is terminal diagnostic data, not assistant output.

message
Annotated[str, constrained()]
policy
ObjectPolicy
type
Annotated[Literal['error'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesEventProjection()

Bases: PolicyModel

Validate sequence numbers when supplied, without requiring unrelated metadata.

sequence_number
Annotated[int | None, constrained(strict=True, ge=0)] = None
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesFailedEventProjection()

Bases: ResponsesLifecycleEventProjection

Failure may still contain text and therefore remains a checked snapshot.

policy
ObjectPolicy = ObjectPolicy(source='ResponseFailedEvent')
type
Annotated[Literal['response.failed'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesInProgressEventProjection()

Bases: ResponsesLifecycleEventProjection

Progress is a nonterminal snapshot.

policy
ObjectPolicy = ObjectPolicy(source='ResponseInProgressEvent')
type
Annotated[Literal['response.in_progress'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesIncompleteEventProjection()

Bases: ResponsesLifecycleEventProjection

An incomplete response is terminal, but its partial text is not opaque.

policy
ObjectPolicy = ObjectPolicy(source='ResponseIncompleteEvent')
type
Annotated[Literal['response.incomplete'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesIndexedEventProjection()

Bases: ResponsesEventProjection

Track an output position without assuming reasoning always precedes text.

output_index
Annotated[int | None, constrained(strict=True, ge=0)] = None
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesLifecycleEventProjection()

Bases: ResponsesEventProjection

Share the response snapshot field, not its concrete event identity.

response
Annotated[ResponsesLifecycleResponseProjection, guarded()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesLifecycleResponseProjection()

Bases: PolicyModel, GuardedContentModel

Describe a full response snapshot without demanding a message before generation.

image
Annotated[ResponseImageProjection | None, constrained()] = None
input_transformations
InputTransformations = None
output
Annotated[list[ResponsesReasoningItemProjection | ResponsesSnapshotMessageProjection], guarded()]
output_text
Annotated[None, disabled(provider_integrity.duplicate_text)] = None
policy
ObjectPolicy
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesMessageAddedEventProjection()

Bases: ResponsesIndexedEventProjection

The assistant item is a snapshot, not opaque output.

item
Annotated[ResponsesSnapshotMessageProjection, guarded()]
policy
ObjectPolicy
type
Annotated[Literal['response.output_item.added'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesMessageDoneEventProjection()

Bases: ResponsesIndexedEventProjection

The completed assistant item must agree with previously observed deltas.

item
Annotated[ResponsesSnapshotMessageProjection, guarded()]
policy
ObjectPolicy = ObjectPolicy(source='ResponseOutputItemDoneEvent')
type
Annotated[Literal['response.output_item.done'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesQueuedEventProjection()

Bases: ResponsesLifecycleEventProjection

Queue metadata does not make background execution an accepted request mode.

policy
ObjectPolicy = ObjectPolicy(source='ResponseQueuedEvent')
type
Annotated[Literal['response.queued'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesReasoningAddedEventProjection()

Bases: ResponsesIndexedEventProjection

Allow only the reviewed, non-plaintext reasoning item.

item
Annotated[ResponsesReasoningItemProjection, constrained()]
policy
ObjectPolicy
type
Annotated[Literal['response.output_item.added'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesReasoningDoneEventProjection()

Bases: ResponsesIndexedEventProjection

Preserve completed reasoning metadata without inspecting encrypted values.

item
Annotated[ResponsesReasoningItemProjection, constrained()]
policy
ObjectPolicy = ObjectPolicy(source='ResponseOutputItemDoneEvent')
type
Annotated[Literal['response.output_item.done'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesSnapshotMessageProjection()

Bases: ResponsesAssistantMessageProjection

Allow an initially empty message, but never a second guarded text part.

content
Annotated[list[ResponsesSnapshotTextProjection], guarded(max_length=1)]
id
Annotated[str | None, constrained()] = None
policy
ObjectPolicy
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesSnapshotTextProjection()

Bases: ResponsesOutputTextProjection

An empty initial text snapshot is valid; annotations and logprobs stay restricted.

text
Annotated[str, guarded(assistant, replaceable=False)]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesTextDeltaEventProjection()

Bases: ResponsesTextEventProjection

Only this event introduces new guarded assistant text.

delta
Annotated[str, guarded(assistant, replaceable=False)]
logprobs
Annotated[list[Any] | None, constrained(reason=(provider_integrity.token_logprobs), max_length=0)] = None
policy
ObjectPolicy
type
Annotated[Literal['response.output_text.delta'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesTextDoneEventProjection()

Bases: ResponsesTextEventProjection

Repeat the accumulated text rather than introducing a second text source.

logprobs
Annotated[list[Any] | None, constrained(reason=(provider_integrity.token_logprobs), max_length=0)] = None
policy
ObjectPolicy = ObjectPolicy(source='ResponseTextDoneEvent')
text
Annotated[str, guarded(assistant, replaceable=False)]
type
Annotated[Literal['response.output_text.done'], constrained()]
class nemoguardrails.server.experimental.providers.openai.responses.stream_projection.ResponsesTextEventProjection()

Bases: ResponsesIndexedEventProjection

Restrict content to the single text part and validate any supplied identity.

content_index
Annotated[int | None, constrained(strict=True, ge=0, le=0)] = None
item_id
Annotated[str | None, constrained()] = None