Skip to contents

surveychat is a shinychat toolkit for conversational and adaptive surveys. Participants answer in natural dialogue with a chat interface. An LLM routed through ellmer validates typed answers, extracts data, and writes adaptive questions or skips ones already answered. Each answer goes to SQL tables through a DBI connection. Earlier answers pipe into later questions, so participants get treated in context and you get richer data.

Installation

pak::pak("dylanpieper/surveychat")

Example

A workshop sign-up that starts in the AI chat, with buttons to change to the form or to both side by side, which is useful while you test a survey. Choose the model with chat, as "provider/model"; the provider reads its own key, such as ANTHROPIC_API_KEY, and the model must support structured output.

surveychat::run_example("panel-chat-form", chat = "anthropic/claude-haiku-4-5")

Screen recording of the AI Coding Workshop sign-up in the AI chat. The user types the name Dylan, and the chat replies Hey, Dylan! and asks for a role. Dylan clicks Software Engineer, checks two workshop days, clicks Maybe for dinner, and types Vegetarian for diet and Agentic coding as a learning goal. The chat then writes a new question about experience with AI tools. Dylan types I use Claude Code, and the chat replies: Great! You're already familiar with Claude. Let's build on that today. It asks about a project, Dylan names an R package called surveychat, and the chat asks what surveychat does. After that answer, the chat comments in one sentence, says Thanks, Dylan! See you at the workshop., and shows Survey complete.

Learn more

Python port note

surveychat will be ported to Python to align with the R and Python codebase for shinychat.