Name Last Update
.github/workflows Loading commit data...
api-website Loading commit data...
examples Loading commit data...
tests Loading commit data...
website Loading commit data...
.env.example Loading commit data...
.gitignore Loading commit data...
CHANGELOG.txt Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
MANIFEST.in Loading commit data...
Makefile Loading commit data...
README-api.md Loading commit data...
README.md Loading commit data...
poetry.lock Loading commit data...
pyproject.toml Loading commit data...
run.py Loading commit data...
run_api.py Loading commit data...
test01.py Loading commit data...

API Guide

Installation

There are two methods for installing the required packages:

Method 1: Using requirements.txt

append the following packages to the requirements.txt:

uvicorn~=0.23.2
fastapi~=0.99.1
pydantic~=1.10.12
setuptools~=68.0.0

Then, run:

pip install -r requirements.txt

Method 2: Direct Installation

Execute the following command:

pip install "fastapi[all]"

Running the API

To run the API, execute:

python run_api.py

Testing the API

To test if your API setup is working correctly, use the following curl request:

curl --location 'http://127.0.0.1:8000/chat' \
--header 'Content-Type: application/json' \
--data '{
    "human_say": "my pain always pain, so I cannot sleep well",
    "conversation_history": [
        "Ted Lasso: Hey, good morning! How are you? <END_OF_TURN>",
        "User: hi, how are you? why calling? <END_OF_TURN>",
        "Ted Lasso: Hi there! I'\''m Ted Lasso from Sleep Haven. I'\''m calling to see if you'\''re looking to achieve better sleep by purchasing a premium mattress. How have you been sleeping lately? <END_OF_TURN>"
    ]
}'

If everything is set up correctly, you should receive an appropriate response from your API.