Code Monkey home page Code Monkey logo

langchain-fastapi's Introduction

FastAPI for interacting with langchain and GPT-3.5 based chatbot, with Redis database as the vector store-backed retriever memory.

How to run

Using virtual environment:

  1. Set up a virtual environment: python -m venv myenv

  2. Create a .env file and add 'OPENAI_API_KEY', 'REDIS_URL', and 'HUGGINGFACEHUB_API_TOKEN as variables

  3. Navigate to the app directory: cd app

  4. Install the required dependencies: pip install -r requirements.txt

  5. Run the FastAPI server with uvicorn: uvicorn main:app --reload --port=8000 --host=0.0.0.0

Using Docker Compose:

  1. Build the Docker images: docker-compose build

  2. Start the Docker containers: docker-compose up

API Documentation

Changing User for Redis Vector Store

To change the Redis vector store retriever memory to a specific user, send a request to the following endpoint:

localhost:8000/api/{username}

Replace {username} with the desired username. This action ensures that the chatbot will only retrieve data from the Redis database specific to that user.

Accessing API Documentation

For detailed documentation on how to interact with the APIs in the application, visit: localhost:8000/docs

This endpoint provides comprehensive guidance on utilizing the APIs effectively.


You can seamlessly integrate this backend into your existing application, providing your users with access to a dedicated vector-based database chatbot. Remember to generate the repsective API keys.

langchain-fastapi's People

Contributors

sumsum1517 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.