Skip to main content
POST
/
v1
/
spaces
/
completions
/
{space_id}
Chat Completions
curl --request POST \
  --url https://api.duplik.cn/v1/spaces/completions/{space_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "session_id": "<string>",
  "external_user_id": "<string>",
  "conversation_id": "<string>",
  "message": "<string>",
  "stream": false,
  "refine_question": true,
  "copilot": true,
  "dataset_id": "<string>",
  "dataset_ids": [
    "<string>"
  ],
  "document_id": "<string>",
  "document_ids": [
    "<string>"
  ],
  "only_dataset_tool": false,
  "context_params": {},
  "context_documents_mode": 1,
  "retrieval_with_websearch": false
}
'
{
  "message_id": "<string>",
  "user_message": "<string>",
  "assistant_message": "<string>",
  "document_chunks": [],
  "token_usage": {
    "model_name": "",
    "total_tokens": 0,
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "successful_requests": 0
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

space_id
integer
required

Body

application/json
session_id
string
required
message
string
required
external_user_id
string
conversation_id
string
stream
boolean
default:false
refine_question
boolean
default:true
copilot
boolean
default:true
dataset_id
string
dataset_ids
string[]
document_id
string
document_ids
string[]
only_dataset_tool
boolean
default:false
context_params
object
context_documents_mode
integer
default:1
retrieval_with_websearch
boolean
default:false

Response

Successful Response

message_id
string
required
user_message
string
required
assistant_message
string
required
document_chunks
Document · object[]
token_usage
object