This is an API built with ChromaDB and OpenAI API (GPT 3.5). You can:
- Create a user
- Create chatbots for that user
- Train chatbots individually with CSV files, and persist their training
- Chat with the chatbots
- Clone the repo in your local machine
- Cd into the project folder
- Make an .env file and fill the variables like in the .env.example file. The superuser_token can be any random string, that you will later use to authenticate.
- Run docker compose up --build
- Start testing! Follow the guide below.
This README provides an overview of the endpoints available in the FastAPI application and demonstrates how to use them.
To access all /client endpoints, you need to include an Authorization header with a bearer token. The token is the same you use in your .env file, and should be included as follows:
Authorization: Bearer <superuser_token>
All the chatbot related endpoints require the same Authorization header, but with the client's token instead of the superuser token. To get your client's token, you need to create a client first, and then retrieve it with the /client/{clientId} or /clients endpoints.
Authorization: Bearer <client_token>
Clear the Chroma database.
- Endpoint:
/clear - HTTP Method: GET
- Usage: Clears the Chroma database.
Check the heartbeat of the Chroma service.
- Endpoint:
/heartbeat - HTTP Method: GET
- Usage: Checks the heartbeat of the Chroma service.
Create a new client.
- Endpoint:
/client/create - HTTP Method: POST
- Usage: Create a new client with the specified name and the maximum number of allowed bots.
Parameters:
name(Form Parameter): The name of the client.max_bots_allowed(Form Parameter): The maximum number of bots allowed for the client.
Retrieve a list of bots for an authorized client.
- Endpoint:
/bots - HTTP Method: GET
- Usage: Retrieves a list of bots associated with an authorized client.
Retrieve a paginated list of clients.
- Endpoint:
/clients - HTTP Method: GET
- Usage: Retrieves a paginated list of clients.
Parameters:
page(Query Parameter, Default: 1): The page number for pagination.perPage(Query Parameter, Default: 10, Max: 100): The number of clients per page.
Retrieve client details by client ID.
- Endpoint:
/client/{clientId} - HTTP Method: GET
- Usage: Retrieves details of a client by client ID.
Parameters:
clientId(Path Parameter): The unique identifier of the client.
Create a new bot for an authorized client.
- Endpoint:
/bot/create - HTTP Method: POST
- Usage: Create a new bot for an authorized client with the specified name.
Parameters:
name(Form Parameter): The name of the bot.
Ingest data from an uploaded CSV file into the Chroma database for a specific bot.
- Endpoint:
/bot/ingest - HTTP Method: POST
- Usage: Ingest data from an uploaded CSV file into the Chroma database for a specific bot.
Parameters:
token(Form Parameter): The bot's token.source_id(Form Parameter): The source ID for the data.file(File Upload): The CSV file to be ingested.
Query a bot for responses.
- Endpoint:
/bot/query - HTTP Method: POST
- Usage: Query a bot for responses based on user input.
Parameters:
body(JSON Body Parameter): The user's query.bot_token(JSON Body Parameter, Optional): The bot's token.auth_token(JSON Body Parameter, Optional): The authentication token.