docs: add document comparison and booking assistant cookbooks - #1250
Merged
Merged
Conversation
Compare the latest Form 10-K filings from NVIDIA, AMD, and Intel through conversation. npm run prepare:documents downloads each PDF from the company's investor relations site, splits every page into passages, and embeds them with OpenAI into SQLite. The search_documents function tool returns each document's closest passages with page numbers and a found flag, so gaps become callouts instead of invented values. Answers compare criteria in a table with page citations, choose charts from the shape of the data (trends, breakdowns, single values), flag fiscal-year and definition conflicts, and end with one collapsible Sources section. The chat route and tool loop match the first cookbook and the Gateway template. Agent Interface is customized for this example: a teal theme that follows the system light or dark mode, a custom sidebar with a Documents page, long starters with icons, and a thread header naming the documents. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The page follows the conversational analytics cookbook: a general introduction to comparing documents with retrieval and generative UI, why passages and embeddings, setup, five build steps (documents, search tool, components, Agent Interface customization, streaming), a browser checklist that includes a known gap, and notes on adapting it. Generalize the architecture diagram into CookbookArchitecture so each cookbook supplies its own server and data labels; the analytics page passes its existing text and renders unchanged. Add the example README and catalog entries, and let prepare:documents read keys from .env as well as .env.local, since openui create writes .env. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Resolve the cookbook tables in examples/README.md and examples/cookbooks/README.md by keeping both cookbooks with main's new top-level /cookbooks URLs, and move this branch's remaining links to /cookbooks as well. Match the example's OpenUI packages to main's update: react-ui and react-headless 0.16.3, cli 0.4.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@openuidev/react-ui/components.css and styles/index.css are the same stylesheet; the package build copies one to the other. Keep the components.css import, as the Gateway template does. The built CSS is unchanged. Also style the document comparison example's mobile header name, which Agent Interface leaves unstyled like the sidebar name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 tasks
vishxrad
marked this pull request as ready for review
September 28, 2026 09:06
Replace the shared architecture diagram with one that explains this cookbook on its own: preparing the reports once (pages, text chunks, embeddings, a local database), then answering a question by picking what to compare and finding the best-matching page in each report. Labels use plain words and real page citations. Explain in How it works that separate searches keep one criterion's passages from crowding out another's, and describe the search as embedding the query with OpenAI and ranking passages loaded from SQLite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It is the same stylesheet as components.css; the built CSS is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep every table cell to one short value, and give each part of a multi-part criterion, such as a company's segments, its own row. Show breakdowns as one full-width horizontal bar chart with a bar per company and segment, never put charts side by side, and keep callouts short. Remove PieChart from the component library, and update the example answer and the cookbook page to match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the Sources accordion with a Sources component built on React UI's source strip: one card per quoted page with the company, page, and quote, opening the PDF at that page. search_documents returns each passage's page URL, and quotes from the same page merge into one card. Also tell the model not to write before or between searches, so no OpenUI Lang status message appears in Behind the scenes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pass agentName and logoUrl to Agent Interface and render the default SidebarHeader, as the Sidebar docs describe. Custom logo and name nodes lacked the classes that hide the name and swap the logo for the open button in the collapsed sidebar. The logo is now an SVG that follows the system color scheme, also used on the welcome screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Show the recording under What you'll build, converted from GIF to MP4 like the conversational analytics demo, and drop the note about Gateway embeddings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 tasks
vishxrad
force-pushed
the
visharad/cookbook-document-comparison
branch
from
September 28, 2026 11:20
d3c543b to
1856e88
Compare
11 tasks
vishxrad
added this pull request to stack #1255
September 28, 2026 11:22
Follow the conversational analytics cookbook's move off the Responses API. Chat Completions stores no conversations, so Agent Interface keeps threads in memory and fetchLLM sends each thread's messages with every question. - Chat route: calls gateway.chat.completions.create with the system prompt and the conversation, forwarding only user questions and assistant answers. It opens the first stream before responding so Gateway errors return as HTTP errors, and accepts browser requests only from its own page. - Tool loop: the Chat Completions loop from the conversational analytics cookbook, streaming AG-UI events so each search shows with its result. - Browser: fetchLLM with openAIMessageFormat and agUIAdapter(), no storage prop. - search_documents uses the Chat Completions tool shape. - Removed the frontend-token route and gateway-session.ts. - The cookbook page, README, and .env.example describe Chat Completions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Replace the Inside Airbnb download with trivago's public MCP server, so the booking assistant finds stays anywhere with live prices and needs only the Thesys key. Move generation to Chat Completions, following the conversational analytics cookbook. - search_stays calls trivago-accommodation-search with the MCP SDK and returns only the fields the cards need, dropping the embedded photo data and trivago's formatting instructions. It applies the budget, which trivago cannot filter by, and reports what it left out. - Stay cards show each hotel's photo across the card. Each card's value is its booking link, so the summary's Continue to booking button opens it without storing tool results between turns. - The form covers destination, dates, adults, children's ages, rooms, budget in the destination's currency, stars, guest rating, and amenities. - Chat route and tool loop match the conversational analytics cookbook: Chat Completions, AG-UI events, fetchLLM, and an origin check. - Removed the listings download, SQLite database, simulated booking, My bookings page, frontend-token route, and gateway-session.ts. - The cookbook page, diagram, README, and catalog entries describe the new flow, including why the tool calls the MCP server itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Form renders only once its required buttons are defined, and the prompt's examples defined them after every field, so the trip form appeared only when the answer finished. Define each form's Buttons right after the Form in the examples, and tell the model to do the same, so the form appears early and fills in as its fields stream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he page - Show the recording under What you'll build, converted from GIF to MP4 like the other cookbook demos. - Name trivago's MCP server in the page description. - Use New York instead of Goa across the page and diagram, following the recording; the example keeps its Goa starter. - Explain why the tool calls the MCP server itself without referring to the Responses API, since the example uses Chat Completions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refine language for clarity in document comparison process.
The document comparison cookbook has its own diagram, so the generic CookbookArchitecture component served only the analytics page. Restore cookbook-analytics-architecture.tsx and the analytics page's diagram, which also resolves the conflict with the diagram edit on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bring in the restored analytics architecture diagram and the latest document comparison changes, so this branch no longer renames the diagram that main edits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vishxrad
added a commit
that referenced
this pull request
Sep 28, 2026
* chore: import React UI CSS once, through components.css `@openuidev/react-ui/styles/index.css` (and `./index.css`) ship the same stylesheet as `./components.css`; cp-css.js writes one to the other. Many examples and the self-hosted template imported both. - Drop the redundant `styles/index.css` import from the agent-framework, harness, miscellaneous, and FastAPI examples and the self-hosted template and overlays, and the extra page-level import in the Vercel Eve example. - Switch examples that imported only `styles/index.css` to `components.css`, matching the Gateway template. - Recommend `components.css` in the react-ui README and API reference, and note that the other two paths contain the same stylesheet. Cookbook examples are covered by #1250. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: explain why the default and layered stylesheets don't mix Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: prefer styles/index.css over components.css styles/index.css pairs with layered/styles/index.css and the per-component styles/<Component>.css files, and the react-ui README and API reference already called it the default. Switch the examples, both templates, the docs overview snippet, and the browser bundle's CSS concat to it, and list components.css and index.css as aliases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Bring in main's latest changes through the document comparison branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
abhithesys
approved these changes
Sep 28, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add two cookbooks, each with a runnable example, after conversational analytics:
This combines the former stack of this PR and #1254.
Changes
Document comparison
docs/content/docs/cookbooks/document-comparison.mdx, with a demo recording and its own diagram (CookbookComparisonDiagram) showing preparation once and the per-question search. It covers why retrieval and embeddings, setup, five build steps, a browser checklist, and adapting it to your own PDFs.examples/cookbooks/document-comparison.npm run prepare:documentsdownloads each 10-K PDF from the company's investor relations site, splits every page into overlapping passages that keep their page number, embeds them with OpenAItext-embedding-3-small, and stores them in SQLite. PDFs and the database are not committed.search_documentsfunction tool returns each document's closest passages with page numbers, a link to each page (#page=N), and afoundflag.Sourcescomponent reuses React UI's source strip: one card per quoted page with the company's icon, page, and quote.logoUrlandagentNamewith the default sidebar header, a Documents page, long starters with icons, and a thread header naming the documents.Booking assistant
docs/content/docs/cookbooks/booking-assistant.mdx, with a demo recording andCookbookBookingDiagram.examples/cookbooks/booking-assistant.search_staysvalidates its arguments, callstrivago-accommodation-searchwith the MCP SDK, applies the budget (trivago has no price filter), and returns only the fields the cards need, never trivago's embedded images or formatting instructions.DatePickerthat keeps React UI's name and props but reads and writesYYYY-MM-DD, so the model can prefill it.Shared
@openuidev/react-ui/styles/index.cssonce.Test Plan
pnpm installandverify(spec generation, typecheck, production build) pass on a clean copy without keys or data, as CI runs them.prepare:documentsextracts 396 pages into 1,564 passages and embeds them.Checklist
🤖 Generated with Claude Code