SplitDoc: Text chunking and vectorization

Updated at:

Description: Splits text into chunks and vectorizes the chunks.

Request syntax

POST /v3/openapi/apps/{app_group_identity}/actions/knowledge-split

Note: app_group_identity specifies the application name.

Request parameters

SplitDoc

Parameter

Type

Description

Remarks

title

String

The title of the data.

Optional

content

String

The content of the data to be processed.

Required

use_embedding

Boolean

Specifies whether to perform vectorization:

  • true: yes

  • false: no

Default value: false

model

String

The vectorization model to use.

None

Sample request body

{
  "title":"Test title",
  "content":"Test text",
  "use_embedding":true,
}

Response parameters

Response parameter

Type

Description

chunks

List<ChunkContext>

The chunked text data objects.

ChunkContext

Response parameter

Type

Description

chunk_id

String

The chunk ID.

chunk

String

The chunked text data.

embedding

String

The vector generated by vectorization.

type

String

The data type:

Text type: text. Image type: image.

img_url

String

If the data is of the image type, the image URL is required.

Sample response body

{
  "request_id":"111111111",
  "status":"OK";
  "errors":[],
  "result":[
  {
    "chunk_id":"1",
    "chunk":"Test chunk text 1",
    "embedding":"-0.010441,-0.002826,-0.022911,0.000847,0.025610,0.019213,-0.019912,0.008210,0.011974,-0.010120,-0.003866,-0.008091,-0.006889,-0.034774,...-0.012572,0.009668,0.010963,-0.005273,-0.005072,-0.002190,-0.001554,-0.000058",
    "type":"text"
  },
  {
    "chunk_id":"2",
    "chunk":"Test chunk text 2",
    "embedding":"-0.010441,-0.002826,-0.022911,0.000847,0.025610,0.019213,-0.019912,0.008210,0.011974,-0.010120,-0.003866,-0.008091,-0.006889,-0.034774,...-0.012572,0.009668,0.010963,-0.005273,-0.005072,-0.002190,-0.001554,-0.000058",
    "type":"image",
    "img_url":"http://127.0.0.1"
  },
  {
    "chunk_id":"3",
    "chunk":"Test chunk text 3",
    "type":"text"
  }
]
}
Note

The vectors generated by vectorizing text chunks have 1,536 dimensions.