Learn R Programming

tidyllm (version 0.8.0)

field_chr: Define Field Descriptors for JSON Schema

Description

These functions create field descriptors used in tidyllm_schema() or field_object() to define JSON schema fields. They support character, factor, numeric, and logical types.

Usage

field_chr(.description = character(0), .vector = FALSE)

field_fct( .description = character(0), .levels, .vector = FALSE, .ordered = FALSE, .level_descriptions = NULL )

field_dbl(.description = character(0), .vector = FALSE)

field_lgl( .description = character(0), .vector = FALSE, .true = NULL, .false = NULL )

Value

An S7 tidyllm_field object representing the field descriptor.

Arguments

.description

A character string describing the field (optional).

.vector

A logical value indicating if the field is a vector (default: FALSE).

.levels

A character vector specifying allowable values (for field_fct() only).

.ordered

For field_fct(): TRUE marks the levels as ordered, which decide() reads as a score question. Structured-output chat ignores it.

.level_descriptions

For field_fct(): NULL (default) or a character vector with one description per level, in the order of .levels. Only decide() sends it; structured-output chat ignores it.

.true, .false

For field_lgl(): NULL (default) or a string saying what a yes and a no mean. Give both or neither. Only decide() sends them; structured-output chat ignores them.

Examples

Run this code
field_chr("A common street name")
field_fct("State abbreviation", .levels = c("CA", "TX", "Other"))
field_dbl("House number")
field_lgl("Is residential")
field_dbl("A list of appartment numbers at the address",.vector=TRUE )

Run the code above in your browser using DataLab