Repository navigation
docs(examples): add web research example using web_search - #2517
Merged
Merged
Conversation
|
Contributor
|
✅ agents import sizes: no significant changes ( |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
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.
Summary
A new example,
examples/web-research: a chat agent that answers from the live web with theweb_searchtool from #2502 and cites its sources. A side panel shows each search three ways: Results, Model saw (the trimmedtoModelOutputtext) and You got (the full response), plus settings for provider and max results.I've also done a bunch of UI improvements compared to the other examples to remove some of the janky behaviour and improve the design. e.g. the feed only follows the stream while you're at the bottom, tool steps show a pending state between them, and the chat pieces live in a reusable
src/chat-ui.tsx.There's a ton we should probably do for all the other examples to improve the UI but this will do for now.
Evidence
Example deployed here: https://web-research-example.agents-b8a.workers.dev/
npm starton an account without credits (likeagents): the search fails withweb_search_payment_required, the UI shows it, and the model answers from memory.Screenshots
These were taken running locally against my personal CF account (where I have gateway credit):