Streamlit Template logo

Streamlit Template

Free

template for how to deploy a LangChain on Streamlit ![GitHub Repo stars](https://img.shields.io/github/stars/hwchase17/langchain-streamlit-template?style=social)

FreeFree tier
Inputs: textOutputs: text
Type
Open Source

About Streamlit Template

A template repository for quickly deploying a LangGraph agent as a Streamlit application. It includes a main.py file with a chatbot implementation template that users can customize by modifying the load_chain function. The template supports local development and easy deployment to the Streamlit platform, with instructions for setting up an OpenAI API key and integrating LangSmith for monitoring and debugging LLM apps.

Key Features

Template for deploying a LangGraph agent on Streamlit
Includes a main.py file with a chatbot implementation template
Easy local run with `pip install -r requirements.txt` and `streamlit run main.py`
Simple deployment to Streamlit platform with OPENAI_API_KEY secret
Instructions for setting up LangSmith for trace data debugging and monitoring

Pros & Cons

Pros
  • Completely open source and free to use
  • Provides a ready-to-use template for a chatbot with Streamlit
  • Easy to customize by modifying the load_chain function
  • Supports local development before deployment
  • Integrates with LangSmith for performance monitoring
Cons
  • Requires an OpenAI API key for full functionality
  • Only provides a basic template; advanced features must be built separately
  • Limited to Streamlit as the deployment platform
  • No built-in authentication or user management

Best For

Quickly prototyping and deploying LangGraph-based chatbotsLearning how to integrate LangGraph with StreamlitBuilding and testing LLM-powered conversational agentsServing as a starter codebase for Streamlit LLM apps

FAQ

How do I customize the chatbot in this template?
To add your chain, change the load_chain function in main.py. Depending on the chain type, you may also need to adjust the inputs/outputs later in the file.
How can I deploy this template on Streamlit?
Deploying on Streamlit is straightforward. When setting up the app, make sure to add OPENAI_API_KEY as a secret environment variable.
How do I run this template locally?
After installing dependencies with `pip install -r requirements.txt`, run `streamlit run main.py` in the project directory.
What is LangSmith and how do I use it with this template?
LangSmith is a platform for debugging, testing, and monitoring LLM apps built with LangGraph. You can sign up and use trace data to quickly spot issues and improve performance.