as_foundry_schema() is a small validation/conversion helper. It returns raw
JSON Schema lists unchanged, so code can accept either schemas built with
foundryR constructors or hand-written JSON Schema lists. If the ellmer
package is installed, ellmer::type_object() specifications are converted to
the equivalent strict JSON Schema, so ellmer users can pass their existing
type definitions to foundry_extract() and foundry_response().
Examples
schema <- foundry_schema(label = schema_string())
as_foundry_schema(schema)
#> $type
#> [1] "object"
#>
#> $properties
#> $properties$label
#> $properties$label$type
#> [1] "string"
#>
#>
#>
#> $required
#> [1] "label"
#>
#> $additionalProperties
#> [1] FALSE
#>