Type {ellmer} | R Documentation |
Type definitions for function calling and structured data extraction.
Description
These S7 classes are provided for use by package devlopers who are
extending ellmer. In every day use, use type_boolean()
and friends.
Usage
TypeBasic(description = NULL, required = TRUE, type = stop("Required"))
TypeEnum(description = NULL, required = TRUE, values = character(0))
TypeArray(description = NULL, required = TRUE, items = Type())
TypeJsonSchema(description = NULL, required = TRUE, json = list())
TypeObject(
description = NULL,
required = TRUE,
properties = list(),
additional_properties = TRUE
)
Arguments
description |
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. |
required |
Is the component or argument required? In type descriptions for structured data, if In tool definitions, |
type |
Basic type name. Must be one of |
values |
Character vector of permitted values. |
items |
The type of the array items. Can be created by any of the
|
json |
A JSON schema object as a list. |
properties |
Named list of properties stored inside the object.
Each element should be an S7 |
additional_properties |
Can the object have arbitrary additional properties that are not explicitly listed? Only supported by Claude. |
Value
S7 objects inheriting from Type
Examples
TypeBasic(type = "boolean")
TypeArray(items = TypeBasic(type = "boolean"))