.NET API
ResponseSchemaShape
Tracon.Abstractions.dllThe response schema as a provider’s client sends it to the model, and what differs from the schema the author wrote.
public sealed record ResponseSchemaShape : IEquatable<ResponseSchemaShape>- Inheritance
- object ← ResponseSchemaShape
- Implements
- IEquatable<ResponseSchemaShape>
- Inherited Members
- object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”A provider adapter may rewrite a response schema before it reaches the wire. The OpenAI adapters
do it for every request, strict or not: they close every object, make every property required and
move the bounds (maxLength, pattern, minimum and the like) out of the schema
into its description text. The model is asked for the rewritten schema, and a registered
IStructuredResponseValidator receives the schema as the author wrote it, so this shape is the
only place the author can see what the model was asked for.
JSON locations in ResponseSchemaShape.OptionalMadeRequired and ResponseSchemaShape.KeywordsNotEnforced are
JSON Pointers into the author’s schema, with # for the root: #/properties/address.
Constructors
Section titled “Constructors”ResponseSchemaShape()
Section titled “ ResponseSchemaShape()”public ResponseSchemaShape()Properties
Section titled “Properties”EffectiveSchema
Section titled “ EffectiveSchema”Gets the schema the provider’s client sends to the model.
public required JsonElement EffectiveSchema { get; init; }Property Value
Section titled “Property Value”KeywordsNotEnforced
Section titled “ KeywordsNotEnforced”Gets the bounds of the author’s schema that the client does not send as bounds, each as
"<location>: <keyword>", for example #/properties/name: maxLength.
A registered IStructuredResponseValidator receives the schema as written and can still apply them.
public IReadOnlyList<string> KeywordsNotEnforced { get; init; }Property Value
Section titled “Property Value”OptionalMadeRequired
Section titled “ OptionalMadeRequired”Gets the properties the author left optional that the client sends as required, and whose
schema does not allow null. The model has to produce a value for each of them.
public IReadOnlyList<string> OptionalMadeRequired { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”A property that must be allowed to stay empty accepts null, for example
"type": ["string", "null"].
Strict
Section titled “ Strict”Gets a value that is true when the client asks the provider to enforce the schema while the model generates (the provider’s strict mode).
public required bool Strict { get; init; }Property Value
Section titled “Property Value”StrictUnsupported
Section titled “ StrictUnsupported”Gets the parts of the schema that the provider refuses to accept in strict mode, each as
"<location>: <keyword>", for example #/properties/answer: oneOf. Empty when the
schema has none, and also when the provider cannot say.
public IReadOnlyList<string> StrictUnsupported { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”A provider fills it only from a refusal it has measured against the real service. It is read when ResponseSchemaShape.Strict is true: the same schema runs without the keyword in the provider’s non-strict mode. The locations are in the schema the client sends (ResponseSchemaShape.EffectiveSchema).
Methods
Section titled “Methods”Equals(object?)
Section titled “ Equals(object?)”public override bool Equals(object? obj)Parameters
Section titled “Parameters”obj object?
Returns
Section titled “Returns”Equals(ResponseSchemaShape?)
Section titled “ Equals(ResponseSchemaShape?)”public bool Equals(ResponseSchemaShape? other)Parameters
Section titled “Parameters”other ResponseSchemaShape?
Returns
Section titled “Returns”GetHashCode()
Section titled “ GetHashCode()”public override int GetHashCode()Returns
Section titled “Returns”ToString()
Section titled “ ToString()”public override string ToString()Returns
Section titled “Returns”Operators
Section titled “Operators”operator ==(ResponseSchemaShape?, ResponseSchemaShape?)
Section titled “ operator ==(ResponseSchemaShape?, ResponseSchemaShape?)”public static bool operator ==(ResponseSchemaShape? left, ResponseSchemaShape? right)Parameters
Section titled “Parameters”left ResponseSchemaShape?
right ResponseSchemaShape?
Returns
Section titled “Returns”operator !=(ResponseSchemaShape?, ResponseSchemaShape?)
Section titled “ operator !=(ResponseSchemaShape?, ResponseSchemaShape?)”public static bool operator !=(ResponseSchemaShape? left, ResponseSchemaShape? right)Parameters
Section titled “Parameters”left ResponseSchemaShape?
right ResponseSchemaShape?