CoolFace
Apppublic

Contentwise/langchain-streamlit-demo

sourceHugging Faceupdated 3y agoView on Hugging Face
1likes
App README

langchain-streamlit-demo

![License: MIT](https://opensource.org/licenses/MIT) ![python](https://www.python.org)

![Push to Docker Hub](https://github.com/joshuasundance-swca/langchain-streamlit-demo/actions/workflows/docker-hub.yml) ![Docker Image Size (tag)](https://hub.docker.com/r/joshuasundance/langchain-streamlit-demo)

![Push to HuggingFace Space](https://github.com/joshuasundance-swca/langchain-streamlit-demo/actions/workflows/hf-space.yml) ![Open HuggingFace Space](https://huggingface.co/spaces/joshuasundance/langchain-streamlit-demo)

Code Climate maintainability Code Climate issues Code Climate technical debt

![pre-commit](https://github.com/pre-commit/pre-commit) ![Ruff](https://github.com/charliermarsh/ruff) ![Checked with mypy](http://mypy-lang.org/) ![Code style: black](https://github.com/psf/black)

![security: bandit](https://github.com/PyCQA/bandit) Known Vulnerabilities

![Update AI Changelog on Push to Main](https://github.com/joshuasundance-swca/langchain-streamlit-demo/actions/workflows/ai_changelog.yml)

This project shows how to build a simple chatbot UI with Streamlit and LangChain.

This README was originally written by Claude 2, an LLM from Anthropic.

Features

  • Chat interface for talking to AI assistant
  • Supports models from
  • OpenAI
  • gpt-3.5-turbo
  • gpt-4
  • Anthropic
  • claude-instant-v1
  • claude-2
  • Anyscale Endpoints
  • meta-llama/Llama-2-7b-chat-hf
  • meta-llama/Llama-2-13b-chat-hf
  • meta-llama/Llama-2-70b-chat-hf
  • codellama/CodeLlama-34b-Instruct-hf
  • mistralai/Mistral-7B-Instruct-v0.1
  • Azure OpenAI Service
  • [configurable]
  • Streaming output of assistant responses
  • Leverages LangChain for dialogue and memory management
  • Integrates with LangSmith for tracing conversations
  • Allows giving feedback on assistant's responses
  • Tries reading API keys and default values from environment variables
  • Parameters in sidebar can be customized
  • Includes various forms of document chat
  • Question/Answer Pair Generation
  • Summarization
  • Standard retrieval chains

Deployment

langchain-streamlit-demo is deployed as a Docker image based on the `python:3.11-slim-bookworm` image. CI/CD workflows in .github/workflows handle building and publishing the image as well as pushing it to Hugging Face.

Run on HuggingFace Spaces

![Open HuggingFace Space](https://huggingface.co/spaces/joshuasundance/langchain-streamlit-demo)

With Docker (pull from Docker Hub)

  1. 1.Optional: Create a .env file based on .env-example
  2. 2.Run in terminal:

docker run -p 7860:7860 joshuasundance/langchain-streamlit-demo:latest

or

docker run -p 7860:7860 --env-file .env joshuasundance/langchain-streamlit-demo:latest

  1. 1.Open http://localhost:7860 in your browser

Docker Compose (build locally)

  1. 1.Clone the repo. Navigate to cloned repo directory
  2. 2.Optional: Create a .env file based on .env-example
  3. 3.Run in terminal:

docker compose up

  1. 1.Open http://localhost:7860 in your browser

Kubernetes

  1. 1.Clone the repo. Navigate to cloned repo directory
  2. 2.Create a .env file based on .env-example
  3. 3.Run bash script: /bin/bash ./kubernetes/deploy.sh
  4. 4.Get the IP address for your new service: kubectl get service langchain-streamlit-demo

Links