Skip to content

Latest commit

 

History

History
61 lines (46 loc) · 1.19 KB

README.md

File metadata and controls

61 lines (46 loc) · 1.19 KB

Backend

chatbot-ui backend using FastAPI, LangChain and Lanarky.

Setup Instructions

The backend code is built with Python 3.11. Follow the steps below to get started.

  1. Create conda environment:

    conda create -n chatbot-ui python=3.11 -y
    conda activate chatbot-ui

    You can choose any other environment manager of your choice.

  2. Install dependencies:

    pip install -r requirements.in

    Note: All requirement files are generated using pip-tools.

Usage

Run the app locally:

uvicorn app:app --reload

You can the Swagger UI at http://localhost:8000/docs.

Sample curl request:

curl -X 'POST' \
  'http://localhost:8000/chat' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer $OPENAI_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "gpt-3.5-turbo",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant"
    },
    {
      "role": "user",
      "content": "hello!"
    }
  ],
  "max_tokens": 1000,
  "temperature": 0
}'