Module Chatoyant_schema.SchemaSource

Typed schema descriptors used for structured outputs and tool arguments.

This first layer models schema metadata explicitly. Later increments can add richer typed builders and generated/proxied ergonomics without changing the provider-facing JSON Schema contract.

Sourcetype string_format =
  1. | Date_time
  2. | Date
  3. | Time
  4. | Duration
  5. | Email
  6. | Hostname
  7. | Ipv4
  8. | Ipv6
  9. | Uri
  10. | Uuid
  11. | Regex
  12. | Custom of string
Sourcetype field =
  1. | String of string_options
  2. | Number of number_options
  3. | Integer of number_options
  4. | Boolean of boolean_options
  5. | Null of base_options
  6. | Array of array_options
  7. | Object of object_options
  8. | Enum of enum_options
  9. | Literal of literal_options
Sourceand base_options = {
  1. description : string option;
  2. optional : bool;
}
Sourceand string_options = {
  1. string_base : base_options;
  2. string_default : string option;
  3. min_length : int option;
  4. max_length : int option;
  5. pattern : string option;
  6. format : string_format option;
}
Sourceand number_options = {
  1. number_base : base_options;
  2. number_default : float option;
  3. minimum : float option;
  4. maximum : float option;
  5. exclusive_minimum : float option;
  6. exclusive_maximum : float option;
  7. multiple_of : float option;
}
Sourceand boolean_options = {
  1. boolean_base : base_options;
  2. boolean_default : bool option;
}
Sourceand array_options = {
  1. array_base : base_options;
  2. items : field;
  3. min_items : int option;
  4. max_items : int option;
  5. unique_items : bool option;
}
Sourceand object_options = {
  1. object_base : base_options;
  2. fields : (string * field) list;
}
Sourceand enum_options = {
  1. enum_base : base_options;
  2. values : Chatoyant_runtime.Json.t list;
  3. enum_default : Chatoyant_runtime.Json.t option;
}
Sourceand literal_options = {
  1. literal_base : base_options;
  2. value : Chatoyant_runtime.Json.t;
}
Sourceval base : ?description:string -> ?optional:bool -> unit -> base_options
Sourceval string : ?description:string -> ?optional:bool -> ?default:string -> ?min_length:int -> ?max_length:int -> ?pattern:string -> ?format:string_format -> unit -> field
Sourceval number : ?description:string -> ?optional:bool -> ?default:float -> ?minimum:float -> ?maximum:float -> ?exclusive_minimum:float -> ?exclusive_maximum:float -> ?multiple_of:float -> unit -> field
Sourceval integer : ?description:string -> ?optional:bool -> ?default:int -> ?minimum:int -> ?maximum:int -> unit -> field
Sourceval boolean : ?description:string -> ?optional:bool -> ?default:bool -> unit -> field
Sourceval null : ?description:string -> ?optional:bool -> unit -> field
Sourceval array : ?description:string -> ?optional:bool -> field -> field
Sourceval object_ : ?description:string -> ?optional:bool -> (string * field) list -> field
Sourceval enum : ?description:string -> ?optional:bool -> Chatoyant_runtime.Json.t list -> field
Sourceval literal : ?description:string -> ?optional:bool -> Chatoyant_runtime.Json.t -> field
Sourceval with_description : string option -> field -> field

Replace the human-readable description on a schema field.

Sourceval with_array_constraints : ?min_items:int -> ?max_items:int -> ?unique_items:bool -> field -> field

Apply array-specific validation constraints when field is an array.

Sourceval with_string_constraints : ?min_length:int -> ?max_length:int -> ?pattern:string -> field -> field

Apply string-specific validation constraints when field is a string.

Sourceval with_number_constraints : ?minimum:float -> ?maximum:float -> field -> field

Apply numeric validation constraints when field is a number or integer.

Sourceval is_optional : field -> bool

Whether a field can be omitted or supplied as JSON null.

Sourceval to_json_schema : field -> Chatoyant_runtime.Json.t

Convert a field to JSON Schema draft-compatible JSON.