Created
May 11, 2026 15:21
-
-
Save eliasdabbas/d5ebb14f93b94e4273eb36bd191069b6 to your computer and use it in GitHub Desktop.
How to create an AI website search app with Chatnificent
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
| # /// 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() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure you set
ANTHROPIC_API_KEYas an environment variable so you can send requests to their API.The easiest way to run is with uv:
You can even run it locally on your computer with the same command using the full online URL:
Many more examples here:
https://github.com/eliasdabbas/chatnificent