In this guide, we will walk through the process of creating a chatbot using an API.

Prerequisites

Before you begin, make sure you have the following:

  1. An API key for accessing the GPT-trainer API.
  2. A development environment or tool for making HTTP requests, such as Curl or a programming language like Python.

API Endpoint

The API endpoint for creating a chatbot is:

https://app.gpt-trainer.com/api/v1/chatbot/create

Request Body

To create a chatbot, you need to send a POST request to the API endpoint with a JSON request body. Here’s an example request body:

{
  "model": "gpt-3.5-turbo",
  "name": "Your Chatbot's Name",
  "prompt": "A sample prompt for your chatbot.",
  "rate_limit": [
    20,
    240
  ],
  "rate_limit_message": "Too many messages",
  "show_citations": false,
  "temperature": 0,
  "visibility": "private"
}
  • model (string, optional): Specify the model you want to use. In this example, we’re using gpt-3.5-turbo.

    Options available gpt-3.5-turbo, gpt-3.5-turbo-16k, gpt-4

  • name (string, required): Provide a name for your chatbot.

  • prompt (string, optional): You can provide an initial prompt for your chatbot.

  • rate_limit (array, optional): Set the rate limit for the chatbot in messages per minute. It’s an array with two values: [20, 240].

    First number: amount of messages. Min 1 - Max 100 Second number: amount of seconds. Min 1 - Max 360

  • rate_limit_message (string, optional): Define a message to display when the rate limit is exceeded.

  • show_citations (boolean, optional): Set to true if you want the chatbot to show citations for its responses.

  • temperature (float, optional): You can adjust the temperature parameter for response randomness. A value of 0 makes responses deterministic, while higher values increase randomness.

    Options are values as a float between 0 and 1

  • visibility (string, optional): Set the visibility of your chatbot. Options are “private” or “public.”

    Options available private, public, hybrid

Example Request

Here’re example command sto create a chatbot using the GPT-trainer API:

Replace token with your actual API key.

That’s it! You’ve now learned how to create your own chatbot using the GPT-trainer API.