Skip to content
Tracon

ResponseSchemaShape

Namespace Tracon · Assembly Tracon.Abstractions.dll

The 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()

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.

public ResponseSchemaShape()

Gets the schema the provider’s client sends to the model.

public required JsonElement EffectiveSchema { get; init; }

JsonElement

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; }

IReadOnlyList<string>

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; }

IReadOnlyList<string>

A property that must be allowed to stay empty accepts null, for example "type": ["string", "null"].

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; }

bool

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; }

IReadOnlyList<string>

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).

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(ResponseSchemaShape? other)

other ResponseSchemaShape?

bool

public override int GetHashCode()

int

public override string ToString()

string

operator ==(ResponseSchemaShape?, ResponseSchemaShape?)

Section titled “ operator ==(ResponseSchemaShape?, ResponseSchemaShape?)”
public static bool operator ==(ResponseSchemaShape? left, ResponseSchemaShape? right)

left ResponseSchemaShape?

right ResponseSchemaShape?

bool

operator !=(ResponseSchemaShape?, ResponseSchemaShape?)

Section titled “ operator !=(ResponseSchemaShape?, ResponseSchemaShape?)”
public static bool operator !=(ResponseSchemaShape? left, ResponseSchemaShape? right)

left ResponseSchemaShape?

right ResponseSchemaShape?

bool