Toolhouse is a platform that helps developers integrate tools in their projects, to build powerful AI agents. You can start this journey with only 3 lines of code in your app.
This sample application is built with Flask and uses Anthropic and Toolhouse. Follow along to make changes to your copy of this repository! For ease of use, you only have to install the dependencies once.
To install, clone this repository.
git clone https://github.com/toolhouse-community/sample-flask.git
cd sample-flask
Create a .env
file and ensure that you have exported both Toolhouse and Anthropic API Keys in it.
ANTHROPIC_API_KEY='YOUR-ANTHROPIC-KEY'
TOOLHOUSE_API_KEY='YOUR-TOOLHOUSE-KEY'
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
pip install -r requirements.txt
If you don't have Flask pre-installed, execute the following:
pip install Flask
Head over to the Toolstore and install the tools you'd like the LLM to use.
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.
Additionally, you can also create and use Bundles to reduce hallucinations and avoid unnecessary credit consumption. All you need to do is pass the Bundle name in Line 65 of app.py
.
For this sample application, we recommend the use of the following tools:
- Current Time (current_time)
- Get Page Contents (scraper)
- Web Search (web_search)
In your terminal, execute the following command to start the application.
flask run
By default, the Flask app runs on port=5000. Head over to the URL on your terminal and see the application in action.
If you'd like to use the application out of the box with your own ideas, make changes to the system_message
prompt, in Line 27 of app.py
.
To make changes to the interface, edit templates/index.html
.
To learn more about Toolhouse, read our documentation! We also have a thriving community on Discord and would love to have you join us!