Revectorize

Re-vectorize enabled segments in the source’s current snapshot. The service returns the document snapshot after it has finished writing the vector.

HTTP
POST $CLOUDSIGMA_API_BASE/semantic-models/{model_id}/sources/{source_row_id}/segments/re-embedding

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First query the knowledge base document details, confirm that the source has been segmented and obtain data.etag. Prepare a personal access token and target workspace ID that can access the target workspace.

The source must be a file source, have kb_file_id, and have a vector index available. Table sources do not support segmented writes.

Request body

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/semantic-models/$MODEL_ID/sources/$SOURCE_ROW_ID/segments/re-embedding" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "if_match": "<DOCUMENT_ETAG>"
  }'

Path parameters

Field

Type

Required

Description

model_id

integer

Yes

knowledge base ID.

source_row_id

string

Yes

Source record ID.

Request body

Submit the ETag of the current snapshot. When the request body does not provide a non-empty if_match, the ETag can be passed in through the If-Match request header. Provide at least one. When both are provided, the request body takes precedence. The request body can be omitted when using only request headers.

Field

Type

Required

Description

if_match

string

Conditional

data.etag read before calling. It can be omitted when using If-Match request header.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "document": {
      "source": {
        "row_id": "src_01",
        "model_id": 401
      },
      "segment_status": {
        "available": true,
        "total": 2
      },
      "etag": "<DOCUMENT_ETAG_AFTER_WRITE>",
      "segments": [
        {
          "segment_id": "seg_01",
          "enabled": true
        }
      ]
    }
  }
}

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data

object

The return data of this operation.

data.document

object

Updated source document snapshot.

data.document.source

object

Source records. For complete fields, see Query document details.

data.document.preview

object

Preview objects, including available, content, reason.

data.document.file_info

object

File information. Contains label, expiration and activation status. For fields, see Query Document Details.

data.document.segment_status

object

Segment availability status and quantity.

data.document.etag

string

The ETag of the current snapshot after writing. Returned when there is a value, used for subsequent condition writing.

data.document.segments

array of object

The segments in the current snapshot.

data.document.source.row_id

string

Source record ID.

data.document.source.model_id

integer

Belonging knowledge base ID.

data.document.segment_status.available

boolean

Whether the segment is available.

data.document.segment_status.reason

string

The reason why the segment is unavailable. Returned if there is a value.

data.document.segment_status.total

integer

The current number of segments.

data.document.segments[].segment_id

string

Segment ID.

data.document.segments[].start_ms

integer

Starting time or location. Returned if there is a value.

data.document.segments[].end_ms

integer

End time or location. Returned if there is a value.

data.document.segments[].level

string

Segment level.

data.document.segments[].chunk_index

integer

Segment number. Returned if there is a value.

data.document.segments[].chunk_id

string

Block ID. Returned if there is a value.

data.document.segments[].content

string

Segmented content. Returned if there is a value.

data.document.segments[].ocr_text

string

OCR text. Returned if there is a value.

data.document.segments[].image_description

string

Image description. Returned if there is a value.

data.document.segments[].image_file_id

string

Image file ID. Returned if there is a value.

data.document.segments[].page_image_file_id

string

Page image file ID. Returned if there is a value.

data.document.segments[].word_count

integer

Number of Unicode characters combined for text, OCR text, and image descriptions, including delimiting newlines.

data.document.segments[].recall_count

integer

Number of recalls.

data.document.segments[].enabled

boolean

Whether to participate in the search.

data.document.segments[].metadata

object

Information about the source volume. Returned when volume_id is included, other information submitted during creation will not be returned completely.

Error response

When no valid ETag is provided, or the source does not have a current segment, 400 and ErrParamInvalid are returned. When the ETag is inconsistent with the current snapshot, 409 and ErrConflict are returned. An error description is returned in the requested language.

JSON
{
  "code": "ErrConflict",
  "msg": "<ERROR_MESSAGE>",
  "data": null
}

Field

Type

Description

code

string

error code.

msg

string

Error description.

data

null

null on error.

Last updated on