Skip to content

docs: add a booking assistant cookbook - #1253

Merged
vishxrad merged 2 commits into
visharad/cookbook-document-comparisonfrom
visharad/cookbook-booking-assistant
Sep 28, 2026
Merged

vishxrad merged 2 commits into
visharad/cookbook-document-comparisonfrom
visharad/cookbook-booking-assistant

Conversation

@vishxrad

Copy link
Copy Markdown
Contributor

Stacked on #1250 (document comparison cookbook). This PR's diff shows only the booking assistant; it retargets to main once #1250 merges.

What

Add a third cookbook: a booking assistant with adaptive forms and a runnable example. Readers describe a trip in their own words, such as "Book a place in Lisbon for two this weekend", and get a form prefilled with what the model understood. They fill in what's missing, pick from stays that are free every night of their dates, review a summary, and confirm a simulated booking.

Changes

  • Cookbook page: docs/content/docs/cookbooks/booking-assistant.mdx, structured like the other cookbooks. It covers why a prefilled form and why confirm before booking, setup, five build steps (listings, tools, components, the booking flow prompt, Agent Interface), a browser checklist, and adapting it to other inventory.
  • Example: examples/cookbooks/booking-assistant, registered in the example catalogs and the docs navigation.
    • npm run prepare:listings downloads the latest Lisbon snapshot from Inside Airbnb (CC BY 4.0), keeps about 5,700 well-reviewed listings, and stores each one's year of nightly availability as a string, one character per night. Downloads and the database are not committed.
    • search_stays treats dates and guests as requirements and the rest as preferences. When few stays match, it counts how many each relaxed preference would add, so the model can suggest what to change. Ratings are weighed by review count.
    • book_stay validates its arguments, checks the nights again, and saves the booking in one transaction. It is simulated: nothing is charged or sent to a host.
    • A DatePicker that keeps React UI's name and props but reads and writes YYYY-MM-DD. The built-in stores Date objects, so the model cannot prefill it (string values crash it), and submitted dates reach the model as UTC timestamps that can fall on the previous day.
    • The prompt starts every new request with a prefilled form, and tells the model to use its prefilled value for fields the submitted form state leaves out, since form state contains only changed fields.
    • The chat route and tool loop match the other cookbooks and the Gateway template. The message limit rises to 4,000 characters because a submitted form arrives as one message.
  • Agent Interface customization: a terracotta theme that follows the system light or dark mode, a logo with the default sidebar header, a My bookings page in the sidebar, long starters with icons, and a thread header with the data attribution.
  • Diagram: CookbookBookingDiagram shows the four chat screens (request, prefilled form, open stays, summary) and the two server steps behind them.

Test Plan

  • Example: frozen pnpm install and verify (spec generation, typecheck, production build) pass on a clean copy without keys or data, as CI runs them.
  • Data: prepare:listings builds a 3.7 MB database of 5,700 listings with availability from 2026-06-23 to 2027-07-02 in about 30 seconds.
  • Tools: search returns real open stays, an over-tight search returns relaxation counts, invalid dates are rejected, and a second booking for overlapping nights is refused.
  • Live Gateway, "this weekend for two": the form arrives prefilled with Fri to Sun and two guests; the search uses the prefilled values the form state omits; picking a stay shows the summary; empty and invalid guest details are blocked in the browser; confirming books and the stay appears under My bookings.
  • Live Gateway, other requests: "next month" leaves dates empty and required; "a week in late October" infers Oct 24 to 31 with a hint; "under €25 a night in Alfama" searches again, explains why nothing matches, and suggests dropping the price limit.
  • UI: light and dark themes, the logo, and the date picker closing after a pick.
  • Docs: the page and diagram render in light and dark mode, all links and the cross-page anchor resolve, 11 docs tests pass, and ESLint and Prettier pass.
  • Demo recording under What you'll build.

Checklist

  • I linked a related issue, if applicable (no related issue).
  • I updated docs/README when needed.
  • I considered backwards compatibility; existing docs routes are unchanged.

🤖 Generated with Claude Code

vishxrad and others added 2 commits September 28, 2026 16:47
A chat assistant that turns a request for a stay into a prefilled,
validated form, searches real availability, and books after a summary.
It uses Lisbon listings and nightly calendars from Inside Airbnb, which
npm run prepare:listings downloads into a local SQLite database.

- search_stays checks every night of the stay against the calendar and,
  when few stays match, counts how many each relaxed preference would add.
- book_stay validates its arguments, checks the nights again, and saves a
  simulated booking in one transaction.
- A DatePicker with React UI's props that reads and writes YYYY-MM-DD, so
  the model can prefill dates and submitted dates keep their calendar day.
- The prompt starts each request with a form and uses prefilled values
  for fields the submitted form state leaves out.
- A terracotta theme, logo, and a My bookings page in the sidebar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the example

The page follows the other cookbooks: why a prefilled form and why
confirm before booking, setup, five build steps (listings, tools,
components, the booking flow prompt, Agent Interface), a browser
checklist, and adapting it to other inventory. Its diagram shows the
four chat screens and the server steps behind them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openui-docs Building Building Preview Sep 28, 2026 11:17am UTC

Request Review

@vishxrad
vishxrad marked this pull request as ready for review September 28, 2026 11:18
@vishxrad
vishxrad merged commit d3c543b into visharad/cookbook-document-comparison Sep 28, 2026
1 of 2 checks passed
@vishxrad
vishxrad deleted the visharad/cookbook-booking-assistant branch September 28, 2026 11:18
@vishxrad
vishxrad restored the visharad/cookbook-booking-assistant branch September 28, 2026 11:20
@vishxrad vishxrad mentioned this pull request Sep 28, 2026
10 of 11 tasks

This branch was successfully deployed

1 active deployment
Preview — 36ef9c2e Deployed Sep 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant