A I Hub Knowledge Base

Chat with your knowledge base

POST
/chat-messages

This page will help you get started with GenAI Agent.

Authorization

bearerAuth
AuthorizationBearer <token>

JWT access token returned by Signing In (POST /auth/v1/tokens/).

In: header

Request Body

application/json

query*string

User Input/Question content

Default"hello"
response_mode*string

The mode of response return, supporting: streaming Streaming mode, implements a typewriter-like output through SSE (Server-Sent Events). blocking Blocking mode, returns result after execution is complete. (Requests may be interrupted if the process is long) Due to Cloudflare restrictions, the request will be interrupted without a return after 100 seconds. Note: blocking mode is not supported in Agent Assistant mode

Default"blocking"
user*string

User identifier, used to define the identity of the end-user for retrieval and statistics. Should be uniquely defined by the developer within the application.

Default"abc-123"
inputs*string

Allows the entry of various variable values defined by the App. The inputs parameter contains multiple key/value pairs, with each key corresponding to a specific variable and each value being the specific value for that variable. Default {}

Formatjson
Default"{}"
conversation_id?string

Converation ID, to continue the conversation based on previous chat records, it is necessary to pass the previous message's conversation_id.

files?array<unknown>

File list, suitable for inputting files (images) combined with text understanding and answering questions, available only when the model supports Vision capability.

type?string

Supported type: image (currently only supports image type)

transfer_method?string

Transfer method, remote_url for image URL / local_file for file upload

url?string

Image URL (when the transfer method is remote_url)

upload_file_id?string

Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is local_file)

auto_generate_name?boolean

Auto-generate title, default is true. If set to false, can achieve async title generation by calling the conversation rename API and setting auto_generate to true.

Response Body

application/json

text/plain

text/plain

curl -X POST "https://example.com/chat-messages" \  -H "Content-Type: application/json" \  -d '{    "query": "hello",    "response_mode": "blocking",    "user": "abc-123",    "inputs": "{}"  }'

"{\n  \"code\": \"invalid_param\",\n  \"message\": \"string is not a valid uuid.\",\n  \"params\": \"conversation_id\"\n}"