Chat API
Last updated
Was this helpful?
Last updated
Was this helpful?
Our Chat API allows a user to have a conversation with your AI agent via a simple API call.
The messages array should contain the conversation between the user and the AI agent. You can send the entire conversation within the API request.
Each message object has a role (user or assistant) and content.
In the example below you can see a short conversation between a user and an AI agent.
The message from the user has the role: user and all replies from the AskAI have the role: assistant.
If your AI agent doesn't know the answer, the API will also return an additional field to confirm an answer wasn't found as well as 3 suggested questions the user can retry (these have a very high likelihood of being answered correctly):
"unknown_answer": "yes",
"suggestedQuestions": ["Example question", ...]
The query
field has a 750 character limit. If this is exceeded, you will see an error: {"error":"This question is too long. Please ensure questions are less than 750 characters."}