Updated on 2025-08-13 GMT+08:00

Web AI Search Q&A

Function

Web AI Search Q&A

URI

POST /v1/{project_id}/applications/{application_id}/uni-search/web/chat

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Constraints:

N/A

Value range:

The value can contain 1 to 64 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter.

Default value:

N/A

application_id

Yes

String

Definition:

Application ID. For details about how to obtain the application ID, see Obtaining an Application ID.

Constraints:

Character string

Value range:

The value can contain 1 to 64 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter.

Default value:

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Token

No

String

Definition:

After a user logs in, a token is created for authentication based on the user login information.

The user validity is verified through authentication.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

repo_id

Yes

String

Definition:

Knowledge base ID.

Constraints:

N/A

Value range:

The value can contain 1 to 64 characters. It can only contain letters, digits, underscores (_), and hyphens (-).

Default value:

N/A

chat_id

No

String

Definition:

Chat ID.

Constraints:

N/A

Value range:

The value can contain 1 to 64 characters. It can only contain letters, digits, underscores (_), and hyphens (-).

Default value:

N/A

query

Yes

String

Definition:

User question.

Constraints:

N/A

Value range:

The value cannot be empty. It can contain a maximum of 20,480 characters.

Default value:

N/A

history

No

Array of strings

Definition:

Chat history.

Implementation logic:

  1. Only the last five rounds of dialogs are considered.

  2. Only 300 to 500 characters are considered in a single round of dialog.

Constraints:

  1. The number of elements must be an even number, for example, [Question1, Answer1, Question2, Answer2].

  2. The chats are ordered from old to new.

  3. Question is mandatory.

  4. Answer can be an empty string but must be placed.

Value range:

The list length cannot exceed 40.

Default value:

N/A

engine

No

String

Definition:

Web search engine.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

mode

No

String

Definition:

AI search mode.

simple: simple mode. Only one round of search and Q&A is performed. The expected time to first token (TTFT) is 2 seconds.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

stream

No

Boolean

Definition:

Streaming output switch.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

model_options

No

Map<String,Object>

Definition:

Parameters of the generative model.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

max_documents

No

Integer

Definition:

Maximum number of web pages to be retrieved. This is used to control the context of the generated model.

Constraints:

N/A

Value range:

1-20

Default value:

5

max_chunk_size

No

Integer

Definition:

Maximum size of a web page fragment. For a long web page, internal fragment selection is preferred.

Constraints:

N/A

Value range:

200-2000

Default value:

500

prompt_template

No

String

Definition:

Prompt template, which provides the query and docs context.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

extra_repo_ids

No

Array of strings

Definition:

ID of the common search knowledge base.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

file_ids

No

Array of strings

Definition:

File-based Q&A.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

thinking_enabled

No

Boolean

Definition:

Deep thinking.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

search_enabled

No

Boolean

Definition:

Online search.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

chat_id

String

Definition:

Chat ID.

chat_result

ChatResult object

Definition:

Dialog result.

documents

Array of Document objects

Definition:

Web search result.

Table 5 ChatResult

Parameter

Type

Description

index

Integer

Definition:

No.

Value range:

N/A

message

String

Definition:

Text content.

Value range:

N/A

question_id

String

Definition:

Q&A ID.

Value range:

N/A

Table 6 Document

Parameter

Type

Description

title

String

Definition:

Title. Use this name and URL to create a hyperlink. Clicking the hyperlink will take the user to the web page.

Value range:

N/A

content

String

Definition:

Content.

Value range:

N/A

url

String

Definition:

Hyperlink.

Value range:

N/A

score

Float

Definition:

Relevance.

Value range:

N/A

timestamp

String

Definition:

Update time (time when the web page is captured last time). The date format is YYYY-MM-DDTHH:MM:SS.

Value range:

N/A

category

String

Definition:

Directory, single value.

Value range:

N/A

tags

Array of strings

Definition:

Tag list.

Value range:

N/A

query

String

Definition:

Query.

Value range:

N/A

type

String

Definition:

Search type.

Value range:

N/A

id

String

Definition:

ID.

Value range:

N/A

file_id

String

Definition:

File ID.

Value range:

N/A

size

Long

Definition:

Size.

Value range:

N/A

has_html

Boolean

Definition:

Whether HTML is used.

Value range:

N/A

rank

String

Definition:

Ranking of the documents during web search recall.

Value range:

N/A

source

String

Definition:

Source

Value range:

N/A

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition:

Error Code.

Value range:

N/A

error_msg

String

Definition:

Error message.

Value range:

N/A

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Definition:

Error Code.

Value range:

N/A

error_msg

String

Definition:

Error message.

Value range:

N/A

Example Requests

Web AI search Q&A.

/v1/b25446daeb1a41a7953c5deba2b2677a/applications/be9b19bf-4865-4fb8-b9f8-2fd1fea98d76/uni-search/web/chat

{
  "repo_id" : "0c3fae2d-428e-454c-ad80-2e5c5fa7b33a",
  "query" : "Who are you?",
  "chat_id" : "e561df11-50ba-42f0-a7fe-9bdb0e17be85",
  "file_ids" : [ ],
  "history" : [ ],
  "stream" : true,
  "mode" : "simple",
  "thinking_enabled" : false,
  "search_enabled" : false
}

Example Responses

None

Status Codes

Status Code

Description

200

AI search response.

400

Client error.

500

Server error.

Error Codes

See Error Codes.