Skip to content

toolhouse-community/adventai-d2

Repository files navigation

Hello AdventAI - Day 2️⃣

Banner

Fork

Table of Contents

Introduction to AdventAI

AdventAI is an initiative from Toolhouse that blends the festive spirit of Christmas through December with daily challenges designed for AI enthusiasts.

Participants unlock a new app daily that they can use, configure, and distribute or even monetize. Each app bridges the gap between AI and real-time functions with the use of Tools.

Note

Tools are serverless functions that run on the Toolhouse infrastructure, and empower LLMs with new functionalities like scraping the internet, a particular website, or sending emails.

Registration

To sign up and receive notifications and guides about upcoming apps throughout the initiative, register on adventai.dev.

Introduction to Toolhouse

Toolhouse is the first cloud platform that allows developers to quickly build, manage, and run AI function calling. We take care of every aspect of connecting AI to the real world, from performance optimization to prompting to integrations with all foundational models, in just three lines of code.

Read The Docs

Key Features

✅ Easy Implementation

✅ Universal SDK

✅ Fast and Secure

✅ Built for Privacy

✅ Fantastic Developer Experience

About the App

Screengrab

On Day 2️⃣, we are unwrapping an AI-powered social media monitoring app that harnesses the search_x tool to curate and deliver comprehensive daily insights from X (formerly Twitter), straight to your email.

What you get:

  • Customized Topic Tracking: Effortlessly monitor specific topics, names, hashtags, or mentions across the X platform with precision and depth.
  • AI-Powered Curation: Leverages sophisticated artificial intelligence to filter, prioritize, and summarize the most relevant and impactful social media content.
  • Daily Email Digest: ADelivers a concise, intelligently compiled email report directly to your inbox, highlighting key discussions, trending perspectives, and critical insights.
  • Sentiment Analysis: Provides nuanced understanding of the emotional tone and public perception surrounding tracked topics.
  • Real-Time Adaptive Learning: Continuously refines content selection based on your interaction patterns and preferences.

Note

This app requires the send_email, memory_fetch, memory_store, and search_x tools.

How to Deploy

The app can deploy on any service that can host Python 3.12. For convenience, we made it easy to deploy on Heroku and Render.

Deploy to Heroku Deploy to Render

Getting Started

Fork and Clone the App

Warning

We recommend forking the app first instead of directly cloning so you can add your own changes on your copy as you go. This also allows you to open a PR easily and showcase your app to other participants!

  • Execute the following in your terminal, replacing your username below:
git clone https://github.com/{USERNAME}/adventai-d2/
cd adventai-d2

Pre-requisites

  • Python 3.12.7
  • Poetry

Requirements

  • A Toolhouse account. If you don't have one already, follow this link.
  • Any LLM of your liking. All our apps and Toolhouse are universally compatible with LLMs.

Setup Toolhouse

  • Login to your Toolhouse Account and grab your API Key. We'll be using it in the next steps.

Note

The tools we'll be using in this project are pre-installed in a Bundle that's already linked to your account and the app.

Installation

  1. Install Poetry

    poetry install
  2. Configure Environment Variables

    Copy the provided .env.example file to a new .env file:

    cp .env.example .env

    Fill in the required values in the .env file. Ensure you update all placeholders with the correct values.

  3. Run the Development Server

    To run on http://0.0.0.0:8000:

    hypercorn main:app --bind 0.0.0.0:8000

    You can use watchexec to monitor changes and reload changes automatically.

      watchexec -r -e py "hypercorn main:app --bind 0.0.0.0:8000" 

    To reload changes you made to the frontend, simply refresh your browser.

Development

Because your function calling infrastructure and code are hosted on Toolhouse, all apps from AdventAI are actually just a collection of prompts and some business logic.

Each app has this:

  • main.py is the main entry point. It sets up the API routes and serves static content.
  • api contains the backend endpoints:
    • api/chat streams responses to the LLM you choose
    • api/cron contains the logic to perform actions every day
    • api/config will read the configuration for the app you want and serve it back to the frontend
  • static contains the frontend
  • prompts contains the prompts needed by each use case, as well as the UI configuration

Here is how an app gets loaded:

  • Each AdventAI app will be served at /app/<your_app_name>, where <your_app_name> must match one of the filenames in the prompts folder (for example /app/random-pet-fact).
  • The frontend will call /app/config. The backend will look at the referer header to infer the app name. It will then send the appropriate configuration. For example, if you're calling /app/random-pet-fact, /app/config will open prompts/random-pet-fact.toml, covert it to JSON, and serve it to the frontend.
  • The frontend will read the configuration and set itself up.

Build a New Use Case

Most of the work is already done for you! Simply copy prompts/_template.toml and fill in the blanks. You can follow one of the other pre-configured configurations for inspiration.

Get Help

We have a thriving community of developers building with Toolhouse. Join us on Discord and share your questions, concerns and feedback!

Discord

License

All the apps under AdventAI are available under the MIT license. See the LICENSE file for more information.

Code of Conduct

AdventAI follows the Contributor Covenant Code of Conduct for all incoming contributions.

Back to Top ⬆️