These S7 classes are provided for use by package devlopers who are
extending ellmer. In every day use, use type_boolean()
and friends.
TypeBasic(description = NULL, required = TRUE, type = stop("Required"))
TypeEnum(description = NULL, required = TRUE, values = character(0))
TypeArray(description = NULL, required = TRUE, items = Type())
TypeObject(
description = NULL,
required = TRUE,
properties = list(),
additional_properties = TRUE
)
The purpose of the component. This is used by the LLM to determine what values to pass to the tool or what values to extract in the structured data, so the more detail that you can provide here, the better.
Is the component or argument required?
In type descriptions for structured data, if required = FALSE
and the
component does not exist in the data, the LLM may hallucinate a value. Only
applies when the element is nested inside of a type_object()
.
In tool definitions, required = TRUE
signals that the LLM should always
provide a value. Arguments with required = FALSE
should have a default
value in the tool function's definition. If the LLM does not provide a
value, the default value will be used.
Basic type name. Must be one of boolean
, integer
,
number
, or string
.
Character vector of permitted values.
The type of the array items. Can be created by any of the
type_
function.
Named list of properties stored inside the object.
Each element should be an S7 Type
object.`
Can the object have arbitrary additional properties that are not explicitly listed? Only supported by Claude.
S7 objects inheriting from Type
TypeBasic(type = "boolean")
#> <ellmer::TypeBasic>
#> @ description: NULL
#> @ required : logi TRUE
#> @ type : chr "boolean"
TypeArray(items = TypeBasic(type = "boolean"))
#> <ellmer::TypeArray>
#> @ description: NULL
#> @ required : logi TRUE
#> @ items : <ellmer::TypeBasic>
#> .. @ description: NULL
#> .. @ required : logi TRUE
#> .. @ type : chr "boolean"