Agent Chat API

After creating an Agent and uploading data into it, you can start chatting with it.
By sending a simple API call to the following endpoint, you can initiate a new conversation.

Example

Request

curl --location 'https://api.oneai.com/agent/v1/agents/<YOUR-AGENT-NAME-HERE>/chat' \
--header 'Content-Type: application/json' \
--header 'api-key: <YOUR-API-KEY-HERE>' \
--data '{
    "message": "What is your name?"
}'

Response

event: content
data: I

event: content
data:  am

event: content
data:  One

event: content
data: Agent

event: content
data: .

event: chat_id
data: 996b1e92-fe3b-4l62-8a21-4226402c6an2

event: fact_check
data: {"references": [], "sources": []}


  • Note the response is streamed back to you as words are formatted into sentences and paragraphs.

Apart from a response to your question, it will also include "chat_id" parameter. This information should be added to any follow-up questions for the rest of the conversation.

Follow-up Request

curl --location 'https://api.oneai.com/agent/v1/agents/<YOUR-AGENT-NAME-HERE>/chat' \
--header 'Content-Type: application/json' \
--header 'api-key: <YOUR-API-KEY-HERE>' \
--data '{
    "message": "Are you human?",
    "chat_id": "996b1e92-fe3b-4l62-8a21-4226402c6an2"
}'