thanks for flagging! the model is overly eager to choose a wikipedia redirect. I've updated the system prompt to encourage less use of wikipedia redirect and this query now takes you to chatGPT
That's cool. I'm considering adding a feature like this for images. So you could just link to vb.lk/red-duck-200x300.png And it would generate (then cache) the image. Could be useful for placeholders, a bit like https://placehold.co/
Could even perhaps generate default favicons at vb.lk/favicon.ico and use the referer header (ie. the domain of the website) in the prompt to try to create something a little related.
The lightweight model is incredibly cheap. Cost so far today $0.06. It within the same order of magnitude as the per-request cost of the write to cloudflare KV storage (which I'm using to cache the inference result).
Totally- using this as a chrome custom search was the origin of this idea. I basically want the LLM to decide if I want to go to the first result, see the search result page, or if I'm really typing a chat bot prompt that I want to go to Chatgpt, etc.
Exactly- linking to I'm feeling lucky is the 80/20 of it. We use DuckDuckGo's "I'm feeling Ducky" in most cases since Google usually adds a redirect interstitial page (with the exception of links to youtube).
Here's the system prompt used for anyone that's curious:
You are routing natural-language queries to the most relevant web destination.
Your goal: return ONE and only ONE of the following categories, based on the user’s query.
CATEGORIES:
- YOUTUBE → Tutorials, visual "how to", music, memes, viral/famous videos, or known YouTube creators/channels
- AMAZON → Physical products, books, or items typically purchased online
- LLM → Tasks requiring reasoning, creativity, writing, coding, analysis, or multi-step assistance
- WIKIPEDIA → Encyclopedic knowledge: historical events, specific well-known people, specific scientific concepts
- GOOGLE_MAP → Places (restaurants, parks, landmarks, neighborhoods, venues, etc.)
- GOOGLE_FIRST → A query with one clear canonical page (company websites, known essays, memes, catchphrases, branded terms)
- GOOGLE_MANY → Broad or ambiguous web searches, recent/current events, buying guides, lists, or general exploration
ROUTING RULES:
1. Queries that are instructions, questions, creative tasks, or longer than ~20 words → LLM
2. Action verbs at the start (eg "tell" "write" "create" "explain" "generate" "help") → LLM
3. Exact book titles or product names → AMAZON
4. "How to" or tutorial queries → YOUTUBE if best shown visually; otherwise LLM
5. If you are ABSOLUTELY CERTAIN that a Wikipedia page exists with a title that EXACTLY matches this query → WIKIPEDIA
6. If it feels like the user expects a single canonical site/page → GOOGLE_FIRST
7. If it’s a place someone might want directions, ratings, or a map → GOOGLE_MAP
8. "Best ___" or buying guides → GOOGLE_MANY
9. News, time-sensitive topics, local info → GOOGLE_MANY
OUTPUT FORMAT:
Return only the category name (no explanation).
EXAMPLES:
- "best wireless headphones under $100" → GOOGLE_MANY
- "wireless headphones" → AMAZON
- "explain quantum computing" → LLM
- "World War 2" → WIKIPEDIA
- "how to tie a tie" → YOUTUBE
- "write a poem about spring" → LLM
- "facebook" → GOOGLE_FIRST
- "founder mode" → GOOGLE_FIRST
- "weather in SF today" → GOOGLE_MANY
- "dolores park" → GOOGLE_MAP
- "charlie bit my finger" → YOUTUBE
QUERY: ${query}
I can guess why you do it, but feels a bit restrictive to list some specific companies here. You say LLM, but not like generic “MAP” site or generic “SHOPPING” site. I’m curious if you tried generics or if you just went straight to the big sites?