Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions nemoguardrails/server/experimental/contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ Provider-required opaque fields may be left to provider validation; a projection

Object `variant` metadata describes discriminator matching and selected-variant
cardinality. This is distinct from ordinary array length constraints.
Typed `ObjectPolicy.variant` declarations derive the runtime array selectors;
required literal discriminators must distinguish the reviewed object branches.
Runtime validation checks discriminator types before coercion so selection in
the parsed model agrees with selection in the original payload. Integer `1`,
boolean `true`, and floating-point `1.0` are not interchangeable selectors.
Generic JSON Schema does not express this Python type strictness.
For example, Responses can retain reasoning items while requiring exactly one
assistant message. Generic JSON Schema validators ignore this guard annotation;
they do not enforce selected-variant cardinality without policy-aware handling.
`stream_selector_field` names a boolean request field: true selects streaming;
false or null selects buffered output, with null allowed only when the field's
schema permits it. Omission follows the declared default. This marker does not
Expand Down
17 changes: 17 additions & 0 deletions nemoguardrails/server/experimental/contracts/openai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@ arbitrary Python validation. For example, the runtime rejects choice index
[export guide](../../providers/openai/chat_completions/README.md#contract-export)
for generation, drift checks, and limitations.

## Responses

The [Responses boundary](../../providers/openai/responses/README.md) supports one
foreground input string, one assistant output message alongside reviewed
reasoning metadata, and buffered or SSE output. Python models, derived bindings,
event rules, and handwritten protocol hooks are authoritative. Its
[exported contract](_generated/responses.guard.yaml) records payload policy and
the bound stream classifier, including heterogeneous-array selection; hooks
remain runtime code rather than serialized policy.

Use `create_openai_integration(operations=("chat_completions", "responses"))`
to guard both operations, or select either name alone. The default remains
both; selection installs guard bindings rather than disabling other routes.
Unselected routes retain the application's passthrough behavior. The existing
`create_openai_chat_integration` factory remains Chat-only. Neither factory
establishes compatibility with every server exposing an OpenAI-shaped API.

## Provider provenance

[source.yaml](source.yaml) records the OpenAPI document's immutable revision,
Expand Down
Loading
Loading