This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady
From Forgotten Pantry to First Sip
Somewhere in your kitchen, there's a forgotten jar of ginger, a lemon waiting for its moment, and some leftover herbs.....
You could make the same old tea.
Or you could open SlothBotanist.
Enter what you have, choose the kind of drink you're in the mood for, and let your tiny AI apothecary turn everyday ingredients into something more interesting.
Feeling traditional? Try a slow, comforting herbal infusion.
Want something refreshing? Explore a modern cold brew or infused drink.
Have an unfamiliar herb? Start with a photograph.
Need to avoid certain ingredients? Set your restrictions before you begin.
Two drink ideas. Your existing ingredients. One very relaxed sloth.
Meet SlothBotanist, an AI-powered herbal drink maker built with an open-weight Qwen model and a SerpApi-powered ingredient discovery workflow.
Because making something delightful from your pantry shouldn't require a culinary degree, a shopping trip, or seventeen open browser tabs.
What I Built
SlothBotanist, an AI-powered herbal drink maker that transforms the ingredients you already have into two distinct drink creations.
1. Heritage Elixir
For the traditional soul.
This option focuses on traditional-inspired preparations, such as infusions and slow decoctions. It explores how everyday ingredients can become comforting herbal drinks.
2. Modern Refresh
For the experimental soul.
This option explores contemporary preparations, including cold brews, infused water, and smoothies.
Both options start with the same pantry but approach it differently.
The goal is to help users discover new combinations without turning every drink into a shopping list.
Key Features
- Multi-Engine Recipe Generation: Input your drink goal, shelf ingredients, and allergies to get two distinct drinks (Heritage Elixir and Modern Refresh) created by a local LLM powered by 10 parallel SerpApi search engines. Includes one-click Copy and Print.
- Complete Recipe Intelligence: View allergen exclusions, safety cautions, seasonal interest peak charts, picture links, research notes, and a live "Search Crew" dashboard showing the status of all 10 engines.
- Visual Identification: Upload a photo or paste an image link to identify unknown herbs using Google Lens (SerpApi). Pick from top matches and click Add to my shelf directly from an editable input box.
- Distraction-Free Reader: Paste any recipe or web article link to strip out ads and clutter, leaving only clean plain text via SerpApi’s Extract API.
- Location Search & Privacy Control: Search your city to auto-set local country, language, and Google domain parameters. Features a 2-click browser reset button. All user data (shelf, allergies, location) is kept 100% private in local browser storage.
Demo
How I Built It
SlothBotanist combines a lightweight frontend, a FastAPI backend, SerpApi integrations, and a local language model.
Navigation & App Architecture
- 1. Brew It (Main Page): Input drink goals, available ingredients, and allergies to generate two customized recipes—a traditional Heritage Elixir and a modern Modern Refresh (with Copy/Print actions). Runs 10 SerpApi search engines in parallel for the local LLM to author recipes. Displays allergen exclusion notes, safety cautions, seasonal trend charts, source notes, image links, and a "Search Crew" engine status dashboard.
- 2. Identify: Upload a photo or image URL to identify unknown botanicals via Google Lens (SerpApi). Handles single ("This looks like") or multiple candidate matches, with an editable box to instantly add items to your shelf.
- 3. Pages: Paste any recipe or article link to extract and read clean, clutter-free plain text using SerpApi’s Extract API.
- 4. Ledger: Real-time analytics dashboard tracking brews made, searches saved, unique listings, allergen-blocked recipes, and an engine query bar chart (hydrated live from saved search logs).
- 5. Settings: Localize searches by selecting your city (auto-configures country, language, and Google domain) and manage local data via a two-click browser reset. All user inputs (shelf, allergies, location) are stored 100% locally in your browser for total privacy.
Code
Tech Stack
- Backend: Python, FastAPI
- Search and ingredient discovery: SerpApi
- Open-weight AI: Qwen/Qwen2.5-1.5B-Instruct
- Model runtime: Hugging Face Transformers
- Frontend: HTML, CSS and JavaScript
- Package Management: pip 26.x
- Testing: Python unit tests
- Additional utilities: evaluation suite(eval_brews.py) and weekly safety-Watchlist scanner(weekly_scan.py)
Project Directory Structure
SlothBotanist/
├── main.py
├── apothecary_core.py
├── test_core.py
├── weekly_scan.py
├── eval_brews.py
├── requirements.txt
├── README.md
└── static/
├── index.html
├── style.css
└── app.js
Installation & Running Locally
- Install Dependencies:
pip install -r requirements.txt
- Set Your SerpApi Key:
export SERPAPI_KEY="your_serpapi_key_here"
- Start the FastAPI Backend:
uvicorn main:app --reload
- Access the Application:
http://localhost:8000.
- Run Tests, Evaluations & Safety Scans:
a. Unit & Integration Tests:
python test_core.py
b. Run Evaluation Suite:
python eval_brews.py
c. Run Weekly Safety Watchlist Scan:
python weekly_scan.py
System Architecture
+------------------------------------------------------------------+
| USER INTERFACE |
+------------------------------------------------------------------+
| Pantry Ingredients | Drink Mood | Allergy Exclusions |
| Brew It | Identify | Pages | Ledger | Settings |
+------------------------------------------------------------------+
|
v
+------------------------------------------------------------------+
| FASTAPI BACKEND |
+------------------------------------------------------------------+
| Input Processing | Search Coordination |
| Allergy Filtering | Duplicate-Query Filtering |
| Drink Generation | Output Validation |
+------------------------------------------------------------------+
|
v
+------------------------------------------------------------------+
| SERPAPI INTEGRATION LAYER |
+------------------------------------------------------------------+
| SEARCH ENGINES |
| +------------------------------------------------------------+ |
| | Google Search | Recipes and preparation | |
| | DuckDuckGo | Ingredient discovery | |
| | Google Scholar | Academic and allergy research | |
| | Google Books | Traditional herbal sources | |
| | Google Patents | Extraction methods | |
| | Google News | Safety warnings and recalls | |
| | YouTube | Preparation demonstrations | |
| | Google Trends Trending | Current trending topics | |
| | Google Trends | Search interest over 12 months | |
| | Google Images | Visual results for the UI | |
| +------------------------------------------------------------+ |
| ADDITIONAL APIS |
| +------------------------------------------------------------+ |
| | Google Lens | Photo-based herb discovery | |
| | Extract API | Recipe-page content | |
| | Search Archive API | Previous results by search ID | |
| | Locations API | Supported search locations | |
| | Account API | Account usage information | |
| +------------------------------------------------------------+ |
| RELIABILITY |
| +------------------------------------------------------------+ |
| | Successful-search caching in .sloth_cache/ | |
| | HTTP 401/429 handling and 10-second engine cooldown | |
| | Cached-result fallback | |
| | Retry without rejected _sasl / _saslop parameters | |
| | SLOTH_OFFLINE=1 for cached research | |
| +------------------------------------------------------------+ |
+------------------------------------------------------------------+
|
v
+------------------------------------------------------------------+
| SEARCH CONTEXT ASSEMBLY |
+------------------------------------------------------------------+
| Search Results | Ingredient Information | Numbered Sources |
+------------------------------------------------------------------+
|
v
+------------------------------------------------------------------+
| LOCAL QWEN MODEL |
+------------------------------------------------------------------+
| Model: Qwen/Qwen2.5-1.5B-Instruct |
| Generates: Heritage Elixir + Modern Refresh |
+------------------------------------------------------------------+
|
v
+------------------------------------------------------------------+
| APPLICATION VALIDATION |
+------------------------------------------------------------------+
| Allergen Checks | Pantry Checks | Citation Validation |
| Regeneration or Withholding When Checks Fail |
+------------------------------------------------------------------+
|
v
+------------------------------------------------------------------+
| YOUR TWO BREWS |
+------------------------------------------------------------------+
| HERITAGE ELIXIR | MODERN REFRESH |
+------------------------------------------------------------------+
SerpApi: The Secret Ingredient Behind Every Brew
SlothBotanist isn't designed to make users research herbs. It's designed to help them make drinks.
SerpApi works behind the scenes to discover preparation methods, explore ingredients, and find information that can inform drink creation.
Here is how its capabilities fit into the application.
1. The Ten Search Engines
SlothBotanist is designed around ten SerpApi search-engine configurations. Each has a distinct purpose, query construction, and parameter configuration.
Search requests are dispatched concurrently using asyncio.gather so that all ten engine searches in a brew go out at the same time without waiting for each one to finish sequentially, while run_in_threadpool runs each blocking SerpApi call in its own worker thread to keep the main event loop completely free.
Search requests are dispatched simultaneously across ten SerpApi configurations:
1.1 Google Search — Recipe Discovery
Engine: google
Google Search looks for recipes and preparation methods that match the user's goal and available ingredients.
This helps locate practical recipes rather than relying entirely on a generated suggestion.
1.2 DuckDuckGo — An Additional Search Perspective
Engine: duckduckgo
DuckDuckGo provides a secondary search index for discovering additional drink ideas and preparation information.
The results may differ from Google Search, providing another set of pages to inspect.
1.3 Google Scholar — Research and Evidence Discovery
Engine: google_scholar
Google Scholar searches for research relevant to the ingredients and the user's intended drink.
When allergy restrictions exist, the application can also construct an allergy-focused research query.
1.4 Google Books — Traditional Herbal References
Engine: google_books
Google Books is intended to locate books and traditional herbal references relevant to the ingredients and drink style. This source is particularly relevant to Heritage Elixir.
Live support and successful results from the configured Google Books engine must be verified in the actual integration.
1.5 Google Patents — Extraction and Preparation Techniques
Engine: google_patents
Google Patents can discover documents describing various ingredients, extraction methods and related preparation techniques.
1.6 Google News — Safety Signals and Current Reporting
Engine: google_news
Google News searches for reporting that may identify warnings, recalls, ingredient interactions, or emerging safety concerns.
1.7 YouTube Search — Preparation Demonstrations
Engine: youtube
YouTube Search discovers demonstrations that can help users understand preparation techniques.
The integration uses the search_query parameter for the search phrase.
1.8 Google Trends Trending Now — Current Interest
Engine: google_trends_trending_now
This engine is intended to discover current trending topics that may provide context for contemporary drink ideas.
The integration uses the geo parameter to select the country or geographic scope. It does not construct a conventional recipe search query for this request.
Trends indicate interest, not evidence of health benefits or recipe quality.
1.9 Google Trends — Historical Interest
Engine: google_trends
This configuration examines interest over time rather than only current trending topics.
The application can compare interest in ingredients and identify a peak month.
For example, if the returned data supports it, the generation context might say that interest in elderberry peaks in October.
1.10 Google Images — Visual Discovery
Engine: google_images
Google Images provides visual results that can support the user interface.
Visual results is displayed separately from the textual sources used for recipe generation.
2. Different Drinks, Different Source Perspectives
The two drink formats are designed to use different combinations of search evidence.
2.1 Heritage Elixir
Heritage Elixir focuses on traditional-inspired preparation methods and references.
Its intended source emphasis includes:
Google Books for traditional herbal references.
Google Patents for extraction and preparation techniques.
Google Scholar for research discovery.
Relevant web and recipe results where available.
2.2 Modern Refresh
Modern Refresh focuses on contemporary drink formats and practical preparation ideas.
Its intended source emphasis includes:
Google Trends and Google Trends Trending Now for interest patterns.
YouTube for preparation demonstrations.
Google Search and DuckDuckGo for recipes and web information.
Google News when current safety information is relevant.
These are source-selection priorities, not guarantees that every engine returns useful evidence for every request. The sources available to the generator should depend on the current request and the successful search results.
3. Allergy-Focused Search Integration (google_scholar & google_news)
In addition to recipe discovery, SerpApi directly supports SlothBotanist's allergy-aware architecture by fetching external context for excluded items:
- Academic Cross-Reactivity (google_scholar): When allergy exclusions (such as ragweed, birch pollen, tree nuts, or soy) are active, SerpApi queries academic and clinical literature to surface research regarding botanical cross-reactivity and potential allergen relationships.
- Safety Signals & Recalls (google_news): Pulls real-time news reporting, warnings, and recall signals for specific herbs or ingredients.
4. Additional SerpApi Features
The ten search-engine configurations are only part of the integration. SlothBotanist also includes workflows for ingredient discovery, page extraction, search reproducibility, account information, and geographic localization.
- Google Lens Workflow (google_lens): Accepts an image URL, retrieves visual matches, and extracts candidate plant names from knowledge-graph titles to help identify unfamiliar pantry items.
- Extract API Workflow (engine=extract): Accepts a recipe URL and returns text_content for deep inspection of specific source pages.
- Search Archive API / Ledger Workflow: Uses search_metadata.id from search responses to retrieve archived search receipts for result reproducibility.
- Account API: Fetches plan details and remaining credit counts to monitor search capacity.
- Locations API: Configures geographic search parameters (location, gl, hl, google_domain) for localized queries.
5. Search Processing, Response Normalization, Deduplication & Citation Ingestion
- Pre-Search Query Deduplication: Before dispatching requests, the application compares and removes duplicate query strings across engine configurations to prevent redundant SerpApi API calls and save search quota.
- Normalization Layer: Converts disparate engine response structures (organic_results, news_results, video_results, trending_searches, images_results) into a uniform Source record format.
- Request-Scoped URL Deduplication: Normalizes and deduplicates URLs within the current request prior to citation mapping.
- Numbered Sources & Citation Validation: Assigns indexed references like [S1], [S2], and validates generated citations using resolve_citations while stripping invented references (e.g., [S99]).
- Source Isolation: Guarantees source registries strictly belong to their individual requests.
6. SerpApi Resilience, Caching, and Error Handling
- API Key Rejection Guard (401 Handling): If an invalid or rejected API key returns a 401 Unauthorized response, searches immediately halt and the app displays: “SerpApi rejected the API key. Check SERPAPI_KEY, then restart the server.” to protect resources.
- Per-Engine Cooldown: HTTP 429 rate limits trigger a 10-second cooldown for the affected engine while other engines and cache fulfill requests.
- Request-Parameter Fallback: Automatically retries requests once without internal parameters (_sasl=1, _saslop=1) if initially rejected.
- no_cache Parameter: By default, SerpApi serves cached search results if an identical query was recently run (saving your monthly search quota). However, when fresh real-time information or breaking news signals are needed, the application can opt to pass no_cache=true to force SerpApi to fetch a brand-new, live result directly from the search engine.
- zero_trace Parameter: For high-privacy or enterprise-tier configurations, the zero_trace=true option tells SerpApi's infrastructure to skip storing search parameters, metadata, or search files on their servers entirely, leaving no trace of the request logs.
- Local Disk Caching (.sloth_cache/): To prevent burning through API limits during development, testing, or offline coding sessions, the application automatically saves successful SerpApi JSON responses locally inside a .sloth_cache/ directory on disk.
- Offline Replay Mode (SLOTH_OFFLINE=1): When you set the environment variable SLOTH_OFFLINE=1, the application short-circuits live external calls entirely. Instead, it reads directly from the local .sloth_cache/ archive. This allows you to run full end-to-end drink generation tests, demo the UI, or run evaluation scripts offline without active internet connectivity or consuming API credits.
Why Does Open Innovation Matter?
At its core, SlothBotanist is a pantry-first herbal drink generator that helps users transform everyday kitchen ingredients into tailored infusions (Heritage Elixirs and Modern Refreshes).
Because SlothBotanist handles wellness suggestions and dietary preferences, open innovation is not just a philosophy—it is the foundation of user safety, transparency, and accessible knowledge.
Relying on closed, proprietary "black-box" models to generate health or dietary recipes creates critical risks. Open innovation solves this by putting complete control and visibility back into the hands of the user and developer:
- Verifiable Evidence & Transparency: Closed AI models frequently hallucinate health claims or invent fake sources with authoritative confidence. Open innovation enables us to pair a lightweight, open-weight language model (Qwen/Qwen2.5-1.5B-Instruct) with transparent, multi-engine retrieval via SerpApi. Because our prompt structures, source-normalization layer, and retrieval code are fully open-source, users can verify exactly where every drink recommendation comes from and trace every citation ([S1], [S2]) directly to live web or scholarly evidence.
- Privacy-First Allergen Exclusions: Dietary restrictions (such as tree nuts, dairy, gluten, soy, or pollen cross-reactivities) are personal health data. SlothBotanist uses an open, local-first architecture where allergen filtering and input sanitization run directly in the user's browser (localStorage) before search queries are ever dispatched.
- No Vendor Lock-In or Paywalled Wellness: Open-weight models combined with standardized API integrations mean that exploring herbal traditions remains accessible to anyone on modest local hardware, without requiring paywalls or expensive cloud subscriptions.
- Community-Driven Safety & Auditability: Open source allows the community to audit our automated safety evaluation scripts (eval_brews.py) and weekly recall scanners (weekly_scan.py). Anyone can inspect how safety rules are enforced or contribute updated ingredient guidelines.
- Reproducible Herbal Discovery: By leveraging open retrieval logic alongside SerpApi's Search Archive Ledger (search_metadata.id), every search query and source set is permanently archived, making drink recommendations fully reproducible and verifiable over time.
By keeping the application, language models, and search pipelines open, SlothBotanist turns AI from an opaque black box into a reliable, community-verifiable tool for everyday wellness.
The Lazy Payoff
The true spirit of SlothBotanist is that you can do the sipping while the app does all the thinking.
When you're ready to unwind, deciding what to drink shouldn't feel like hard work. Figuring out which flavors mesh, guessing what works, checking for sensitivities, and mastering the prep takes all the relaxation out of the ritual.
SlothBotanist turns that whole hassle into a 30-second cozy ritual:
Use What You Have: No special shopping trips required. Just type in whatever is already sitting in your kitchen cabinet.
Match Your mood and goals: Select your current mood with a single tap—whether you need "Morning energy", "Gentle digestion", or a "Calm before sleep".
Two Instant Drink Choices: Get straight to the good part. You receive two ready-to-make drink ideas right away: a cozy Heritage Elixir and a crisp Modern Refresh.
Peace of Mind: Save your dietary exclusions once, and the app quietly filters out anything you need to avoid automatically.
The Bottom Line:
Zero guesswork, zero effort, and zero stress. You just pick your pantry ingredients, kick back, and instantly get to enjoying your cup.
🍵 Your Next Brew Awaits: Time to Take a Sip
Next time you look into your kitchen and see a wedge of lime, half a cucumber, or a pod of green cardamom, don't just reach for a plain mug of hot water.
Let the sloth do the heavy lifting. Discover what your pantry has been trying to tell you all along. Delightfully effortless—your next favorite elixir is already sitting on your counter.
"Pantry odds, perfect brews."⭐
"Slow down, brew up."✨
Prize Categories
Best Use of SerpApi
In SlothBotanist, SerpApi is not an auxiliary add-on, a side widget, or a simple wrapper—it is the core architectural engine that powers the entire system. While standard applications rely on single-endpoint web lookups, SerpApi is Architectural Backbone of SlothBotanist.
Architectural Highlights:
- High-Performance Concurrency & Ecosystem Workflows: Search requests execute simultaneously using asyncio.gather while run_in_threadpool runs blocking SerpApi calls in worker threads to keep the main event loop unblocked. The 10 integrated engines are Google Search (google), DuckDuckGo (duckduckgo), Google Scholar (google_scholar), Google Books (google_books), Google Patents (google_patents), Google News (google_news), YouTube (youtube), Google Trends Trending Now (google_trends_trending_now), Google Trends (google_trends), _and _Google Images (google_images). Beyond search, it incorporates Google Lens (google_lens),Extract API (engine=extract), Search Archive API (search_metadata.id), Account API, and Locations API (location, gl, hl, google_domain).
- Dual-Format Intelligence Routing: Prioritizes Books, Patents, and Scholar for traditional Heritage Elixirs, while routing Trends, YouTube, News, and Web Search for contemporary Modern Refreshes.
- Allergy Safety Layer: Automates google_scholar botanical cross-reactivity checks (ragweed, birch, soy, tree nuts etc) and google_news recall sweeps prior to recipe generation.
- Data Normalization & Citation Integrity: Performs pre-search and request-scoped URL deduplication, isolates source registries per request, and strips hallucinated citations ([S99]) via resolve_citations.
- Production Resilience & Offline Mode: Features 401 key protection, 429 rate-limit cooldowns, parameter fallbacks, explicit no_cache / zero_trace flags, disk caching (.sloth_cache/), and zero-quota offline replay (SLOTH_OFFLINE=1).

Top comments (0)