Create AI Agent

You can interact with this API by sending a POST request that allows you to create a new AI agent.

API Endpoint

The following endpoint/URL should be used in order to access this API:

https://app.stammer.ai/en/chatbot/api/v1/create-chatbot/

Request Headers

The API must have the following request headers:

Content-Type: application/json
Authorization: Token <Your-API-Token>

Request Body

The API requires the following parameters in the request body:

Required Parameters

  • name (Type: String) The name of the chatbot.

  • display_name (Type: String) Name shown on the Chat Widget.

  • base_system_message (Type: String) Base message given to ChatGPT.

Optional Parameters

  • chatgpt_model_key (Type: Choice) The key for the version of the ChatGPT (OpenAI) model being used.

  • temperature (Type: Decimal) Temperature parameter for the GPT Chatbot Completion API. Determines the randomness of the response.

  • support_email (Type: Email) Set this email to override the default agency support email for the chatbot.

  • conversation_starter_message (Type: String) Enter chatbot's starter messages, separated by new lines. These are displayed to the user at the beginning of the conversation.

  • initial_message (Type: String) Chatbot's initial messages shown to the user, each message is separated by new line.

  • show_data_sources (Type: Boolean) Flag to indicate if the chatbot should show data sources in the chat widget.

  • persistent_conversation_starter_message (Type: Boolean) Maintains the visibility of the conversation starter messages throughout the conversation.

  • debug_mode (Type: Boolean) Enabling this option will display the sources/matched data from Redisearch for a given query.

  • audio_io_enabled (Type: Boolean) Enable audio and input/output for chatbot.

Request Example

Here's an example of the request:

import requests

# Define the API endpoint
url = "https://app.stammer.ai/en/chatbot/api/v1/create-chatbot/"

# Set up authentication and headers
headers = {
    'Authorization': 'Token <YOUR-API-TOKEN>',
    'Content-Type': 'application/json',
    'Accept': 'application/json'
}



# Data is passed in the request body as JSON
data = {

    "name": "Your message/string here.",

    "display_name": "Your message/string here.",

    "chatgpt_model_key": "Choices:['GPT-3.5', 'GPT-4', 'GPT-4-Turbo', 'GPT_4_TURBO_2024_04_09', 'GPT_4_O_2024_05_13', 'GPT-4O-mini', 'GPT-4O-2024-08-06']",

    "temperature": "1.1",

    "support_email": "john@example.com",

    "base_system_message": "Your message/string here.",

    "conversation_starter_message": "Your message/string here.",

    "initial_message": "Your message/string here.",

    "show_data_sources": True,

    "persistent_conversation_starter_message": True,

    "debug_mode": True,

    "audio_io_enabled": True

}
response = requests.post(url, headers=headers, json=data)



# Process the response
if response.status_code in (200, 201, 202):
    result = response.json()
    print("Response data:", result)
else:
    try:
        error_data = response.json()
        error_message = error_data.get('message') or error_data.get('error', 'Unknown error')
        print(f"Error: {error_message}")
    except ValueError:
        print(f"Error: Status code {response.status_code}")

Learn More - https://app.stammer.ai/en/api-docs/chatbot-create

Last updated