Skip to contents

Define output schema for LLM responses

Usage

schema(name = NULL, ..., description = NULL)

Arguments

name

Optional Character: The name of the schema.

...

Field objects defining the schema fields. Create using field.

description

Optional Character: A brief description of the schema.

Value

Schema object, named list, or JSON string.

Author

EDG

Examples

schema(
  "LabSchema",
  field("Lab name"),
  field("normal range low", type = "number"),
  field("normal range high", type = "number")
)
#> LabSchema: 
#>            description: NULL
#>                 fields: 
#>                                  Lab name: 
#>                                                   type: string
#>                                            description: Lab name
#>                                               required: TRUE
#>                          normal range low: 
#>                                                   type: number
#>                                            description: normal range low
#>                                               required: TRUE
#>                         normal range high: 
#>                                                   type: number
#>                                            description: normal range high
#>                                               required: TRUE
#>