Giter Club home page Giter Club logo

bentochain's Introduction

๐Ÿฑ๐Ÿ”— BentoChain - LangChain Deployment on BentoML

Reference: Medium post


BentoChain is a ๐Ÿฆœ๏ธ๐Ÿ”— LangChain deployment example using ๐Ÿฑ BentoML inspired by langchain-gradio-template. This example demonstrates how to create a voice chatbot using the OpenAI API, Transformers speech models, Gradio, and BentoML. The chatbot takes input from a microphone, which is then converted into text using a speech recognition model.

The chatbot responds to the user's input with text, which can be played back to the user using a text-to-speech model.

Demo

demo.mp4

Why deploy LangChain applications with BentoML?

๐Ÿณ Containerizes LangChain applications as standard OCI images.

๐ŸŽฑ Generates OpenAPI and gRPC endpoints automatically.

โ˜๏ธ Deploys models as microservices running on the most optimal hardware and scaling independently.

Instructions

Install Python dependencies.

poetry install
poetry shell

Create SSL certificate and key (this helps establish an HTTPS connexion that is needed to allow using the microphone on modern browers)

mkdir ssl
cd ssl
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -nodes

Download and save speech recognition and text-to-speech models.

python train.py

Start the application locally.

bentoml serve service:svc --reload --ssl-certfile ssl/cert.pem --ssl-keyfile ssl/key.pem

Visit http://0.0.0.0:3000 for an OpenAPI Swagger page and http://0.0.0.0:3000/chatbot for a Gradio UI for the chatbot.

Build application into a distributable Bento artifact.

bentoml build

Containerize the application as an OCI image. This step requires Docker running.

bentoml containerize voicegpt:ahbt5xwxqsivkcvj

Run in Docker container.

docker run -it --rm -p 3333:3000 voicegpt:ahbt5xwxqsivkcvj serve --production

Push to yatai

bentoml push voicegpt:ahbt5xwxqsivkcvj

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.