openai.internal._strict

(internal) `schema`, from `baml.json.schema`, rewritten to the subset OpenAI's strict mode accepts:

Reference version

Signature

function openai.internal._strict(
schema: baml.json.json,
type_name: string,
provider: string
) -> baml.json.json throws ai.errors.InvalidRequest

(internal) schema, from baml.json.schema, rewritten to the subset OpenAI's strict mode accepts:

  • every object lists all its properties in required and sets additionalProperties: false. A property that may be absent is one whose schema already admits null, and strict mode spells "optional" exactly that way;
  • a $ref with a description beside it becomes a one-member anyOf, because strict mode rejects keywords beside $ref;
  • a map (an object with schema-valued additionalProperties, or propertyNames) is rejected: strict mode has no form for one.

Only the keywords that hold schemas are walked. enum and const hold values, and are copied as they are.

Source:<builtin>/openai/ns_internal/structured.bamlbytes 6259–9324