A survey spec is a plain list with three parts: questions, messages,
and config. Start it with survey_spec(), then add to it with the pipe
verbs add_question(), set_messages(), and set_config(). Each verb
returns the same list with one more part, so str() shows the full spec.
Value
A list of class surveychat_spec with no questions, the default
messages, and the default config.
See also
survey_server() to run the spec.
Examples
survey <- survey_spec(version = "1.0") |>
add_question(
"name",
text = "What's your name?",
answer = ellmer::type_string("The person's first name")
) |>
add_question(
"color",
text = "Hi {name}! What's your favorite color?",
answer = ellmer::type_string("The color")
)
survey
#> <surveychat_spec> version "1.0", 2 questions
#> 1. name
#> 2. color
