Skip to main content
POST
/
agent
/
chat
Chat with Agent
curl --request POST \
  --url https://geekai.dev/api/v1/agent/chat \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "uuid": "29db255d-211c-4fc6-8fbe-af97fa59cafa",
  "question": "How do I apply for XXX?",
  "messages": [
    {
      "text": "How long is the warranty period for your products?",
      "role": "human"
    },
    {
      "text": "Our products come with a standard one-year warranty.",
      "role": "ai"
    }
  ],
  "stream": true,
  "sess_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}'
{
  "message_id": "msg_123456789",
  "content": "Our return and exchange policy is as follows:...",
  "reference": [
    {
      "content": "<string>",
      "source": "<string>",
      "confidence": 123
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}
Once the agent training is complete (status=done), you can ask it questions through the chat interface.
The response data varies depending on whether it is a streaming response or not. You can refer to the following request examples for clarification:

cURL Request Example

curl --location --request POST 'https://geekai.dev/api/v1/agent/chat' \
--header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "uuid": "Agent ID",
    "question": "User Question",
    "messages": [
        {
            "text": "Historical Question 1",
            "role": "human"
        },
        {
            "text": "Historical Answer 1",
            "role": "ai"
        }
    ],
    "stream": true
}'

Authorizations

Authorization
string
header
required

token

Body

application/json
uuid
string<uuid>
required

agent UUID

Example:

"29db255d-211c-4fc6-8fbe-af97fa59cafa"

question
string
required

chat question

Example:

"How do I apply for XXX?"

messages
object[]

chat messages

Example:
[
{
"text": "How long is the warranty period for your products?",
"role": "human"
},
{
"text": "Our products come with a standard one-year warranty.",
"role": "ai"
}
]
stream
boolean
default:false

enable stream output

Example:

true

sess_id
string<uuid>

Session ID implemented by the third-party application.

Response

successful response

message_id
string<uuid>
required

message ID

Example:

"msg_123456789"

content
string
required

chat response

Example:

"Our return and exchange policy is as follows:..."

reference
object[]

reference information

usage
object

usage information

I