Skip to content

Sample Application built using Flask, Anthropic and Toolhouse

Notifications You must be signed in to change notification settings

toolhouse-community/sample-flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👋 Introduction

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.

ℹ️ Getting Started

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.

Requirements

🛠️ Installation

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'

Install the Required Dependencies

With Virtual Environment (Preferred)

python3 -m venv env
source env/bin/activate
pip install -r requirements.txt

Without Virtual Environment

pip install -r requirements.txt

If you don't have Flask pre-installed, execute the following:

pip install Flask

⚒️ Setup Toolhouse

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)

🏃 Run the Application

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.

💡 Make Changes

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.

📚 Learn More

To learn more about Toolhouse, read our documentation! We also have a thriving community on Discord and would love to have you join us!

About

Sample Application built using Flask, Anthropic and Toolhouse

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published