Create AI Agent
You can interact with this API by sending a POST request that allows you to create a new AI agent.
Last updated
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}")