Skip to content

Instantly share code, notes, and snippets.

@eliasdabbas
Created May 11, 2026 15:21
Show Gist options
  • Select an option

  • Save eliasdabbas/d5ebb14f93b94e4273eb36bd191069b6 to your computer and use it in GitHub Desktop.

Select an option

Save eliasdabbas/d5ebb14f93b94e4273eb36bd191069b6 to your computer and use it in GitHub Desktop.
How to create an AI website search app with Chatnificent
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "chatnificent[anthropic]>=0.0.23",
# ]
# ///
import chatnificent as chat
welcome_message = """
## Welcome to the AlsoAsked AI assistant!
Ask me anything about AlsoAsked — features, pricing, how to use it, and more.
"""
web_search_tool = {
"type": "web_search_20250305",
"name": "web_search",
"allowed_domains": [
"alsoasked.com",
"developers.alsoasked.com",
"help.alsoasked.com",
],
"max_uses": 5,
}
system_prompt = """
Your name is Mark Williams-Cook
You are the official AI assistant for the AlsoAsked website
(alsoasked.com). Always answer using information retrieved from the
site via the web_search tool. Cite the page you used. If the answer is
not on the site, say so plainly instead of guessing. Include links that users can click
to and further from the website as much as possible.
If the question is about something else, decline politely, and mention that you only
answer questions about AlsoAsked.
"""
app = chat.Chatnificent(
llm=chat.llm.Anthropic(
model="claude-opus-4-6",
tools=[web_search_tool],
tool_choice={"type": "tool", "name": "web_search"},
system=system_prompt,
),
layout=chat.layout.Default(
brand="",
slogan="",
logo_url="https://d1iowmpck7i6p7.cloudfront.net/images/logo-blue.svg",
favicon_url="https://alsoasked.com/favicon.ico",
welcome_message=welcome_message,
),
)
if __name__ == "__main__":
app.run()
@eliasdabbas

eliasdabbas commented May 11, 2026

Copy link
Copy Markdown
Author

Make sure you set ANTHROPIC_API_KEY as an environment variable so you can send requests to their API.

The easiest way to run is with uv:

uv run --script ai_website_search_alsoasked.py

You can even run it locally on your computer with the same command using the full online URL:

uv run --script https://gist.githubusercontent.com/eliasdabbas/d5ebb14f93b94e4273eb36bd191069b6/raw/b5541bc439388e94c713b6855f6ce44cd305e654/ai_website_search_alsoasked.py

Many more examples here:

https://github.com/eliasdabbas/chatnificent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment