---
title: "Chunk using semantic chunker"
method: POST
path: "/ai/async-chunking/semantic/{MODEL_ID}"
tags: ["Split content into chunks"]
---

# Chunk using semantic chunker

`POST /ai/async-chunking/semantic/{MODEL_ID}`

The semantic chunker (chunking strategy) creates chunks based on semantic similarity. 

Using the model defined in the URL request, the semantic chunker splits text into sentences, encodes the sentences, and then compares the sentence to the building chunk to determine if they are similar enough to group together. 

After merging two semantically-similar sentences into a pre-chunk, the semantic chunker needs to encode it to get its vector to compare with the next sentence vector. 

This chunker is the slowest of all of the chunkers even if you set the `approximate` field to true.

## Headers

- `Authorization` string, required
- `Content-Type` string

## Request body

- SemanticRequest
  - `batch` object[] — The batch of key:value pairs used in the chunking request.
    - `text` string — The content to be split into chunks based on the chunking strategy (`chunker`) sent in the request. The maximum text size allowed for input is approximately 1 MB.
  - `modelConfig` ModelConfig — Provides fields and values that specify ranges for tokens.
    - `vectorQuantizationMethod` string — Vector quantization compresses data size, as well as reducing memory usage. The methods are: * `min-max` - Creates tensors of the text and converts it to uint8 by normalizing it to the range [0, 255]. * `max-scale` - Finds the maximum absolute value for the encoded text, normalizes it by scaling the text to a range of -127 to 127, and then returns the quantized text as an 8-bit integer tensor.
    - `dimReductionSize` integer — Used to reduce vector size while maintaining good quality. This field allows any integer above 0, but less than or equal to the vector dimension of the model. If you send a vector dimension larger than the model, a 400 Bad Request error is returned. Not every model is designed to support this parameter. In this scenario, a warning message is generated that indicates quality can decrease.
  - `useCaseConfig` UseCaseConfigChunking
    - `dataType` string — This optional parameter enables model-specific handling in the Async Chunking API to help improve model accuracy. Use the most applicable fields based on available dataTypes and the dataType value that best aligns with the text sent to the Async Chunking API. The string values to use are: "dataType": "query" for the query. "dataType": "passage" for fields searched at query time.
  - `chunkerConfig` SemanticChunkerConfig — The semantic chunker (chunking strategy) creates chunks based on semantic similarity. Using the model defined in the URL request, the semantic chunker splits text into sentences, encodes the sentences, and then compares the sentence to the building chunk to determine if they are similar enough to group together. After merging two semantically-similar sentences into a pre-chunk, the semantic chunker needs to encode it to get its vector to compare with the next sentence vector. This chunker is the slowest of all of the chunkers even if you set the `approximate` field to true. This is the default chunker configuration if nothing is passed.
    - `maxChunkSize` integer — This field defines the maximum token limit for a chunker (chunking strategy). The default is 512 tokens, which matches the maximum context size of the Lucidworks-hosted embedding models.
    - `overlapSize` integer — This field sets the number of sentences that can overlap between consecutive chunks. The default is 1 sentence for most configurations.
    - `cosineThreshold` number, float — This field controls how similar a sentence must be to a chunk (based on cosine similarity), in order for the sentence to be merged into the chunk. This value is a decimal between 0 and 1. The default threshold is 0.5.
    - `approximate` boolean — If this field is set to true, the semantic chunker does not encode the split text to get its vector to compare with the next sentence vector. This greatly increases processing time with no loss in the result quality. However, even with the ability to specify true in the `approximate` field, the semantic chunker is the slowest of all the chunkers. If this field is set to false, the semantic chunking is, on average, 5 times slower than when set to true, with very minimal or no precision increase.

## Response `200`

OK

- POSTresponse — This is the response to the POST chunking request submitted for a specific `chunker` and `modelId`.
  - `chunkingId` string, uuid — The universal unique identifier (UUID) returned in the POST request. This UUID is required in the GET request to retrieve results.
  - `status` string — The current status of the request. Allowed values are: * SUBMITTED - The POST request was successful and the response has returned the `chunkingId` and `status` that is used by the GET request. * ERROR - An error was generated when the GET request was sent. * READY - The results associated with the `chunkingId` are available and ready to be retrieved. * RETRIEVED - The results associated with the `chunkingId` are returned successfully when the GET request was sent.

## Other responses

- `4XX` — The error varies based on the issue encountered regarding the `chunkingId` or related information.

---

[API](https://skmtc.dev/lucidworks/apis/rules-rewrites-api.md) · [All operations](https://skmtc.dev/lucidworks/apis/rules-rewrites-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/lucidworks/rules-rewrites-api/revisions/f2d3747848e8/schema)
