POST
/
agent
/
chat
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

Response

200
application/json

successful response

The response is of type object.