# RAG.CREATE

> Create a RAG pipeline with a vector dimension and a chunking strategy.

URL: https://docs.hotkv.com/commands/rag-create/

```
RAG.CREATE pipeline dimensions [STRATEGY fixed | sentence | paragraph] [CHUNK_SIZE n] [CHUNK_OVERLAP n]
```

- Group: RAG
- Complexity: O(1)
- HotKV Cloud: Performance and Scale plans
- On-Premise: requires the rag-pipeline license feature

A RAG pipeline splits your documents into chunks, keeps each chunk with the embedding you computed for it, and answers searches that combine keyword (BM25) relevance with vector similarity, all inside HotKV. `RAG.CREATE` creates a pipeline whose chunk embeddings have
`dimensions` values. The chunking settings decide how [RAG.INGEST](https://docs.hotkv.com/commands/rag-ingest/index.md)
splits each document.

## Options

| Option | Effect |
| --- | --- |
| `STRATEGY fixed` | Split into chunks of `CHUNK_SIZE` characters, each overlapping the previous one by `CHUNK_OVERLAP` characters. The default. |
| `STRATEGY sentence` | Split at sentence ends (`.`, `!` or `?` followed by a space, a newline or the end of the text), joining sentences until a chunk reaches at least `CHUNK_SIZE` characters. |
| `STRATEGY paragraph` | Split at blank lines, one chunk per paragraph. `CHUNK_SIZE` and `CHUNK_OVERLAP` are not used. |
| `CHUNK_SIZE n` | Target chunk size in characters. Must be positive. Default `512`. |
| `CHUNK_OVERLAP n` | Overlap between consecutive `fixed` chunks, in characters. Default `64`. |

The strategy name must be written in all lower case or all upper case
(`fixed` or `FIXED`); `fixed_size` is also accepted.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Pipeline created | Simple string `OK` | Same |

Errors:

- `ERR invalid dimensions` if `dimensions` is not a positive integer.
- `ERR unknown strategy: use fixed|sentence|paragraph` for any other strategy.
- `ERR invalid CHUNK_SIZE` or `ERR invalid CHUNK_OVERLAP` if the value is not a valid integer (or `CHUNK_SIZE` is `0`).
- `ERR pipeline already exists or limit reached` if the pipeline exists, or the server already holds its maximum number of pipelines (`max_pipelines` under `[rag]`).
- `ERR wrong number of arguments for 'rag.create' command` if the argument count is wrong.
- `NOLICENSE rag-pipeline requires a HotKV license. Contact sales@hotkv.com` if your license does not include the `rag-pipeline` feature.

## Examples

```
127.0.0.1:6379> RAG.CREATE kb 384
OK
127.0.0.1:6379> RAG.CREATE faq 3 STRATEGY paragraph
OK
127.0.0.1:6379> RAG.CREATE docs 1536 STRATEGY sentence CHUNK_SIZE 800
OK
```

## Compatibility

HotKV-only command. Redis and Valkey have no equivalent.

## See also

[RAG.INGEST](https://docs.hotkv.com/commands/rag-ingest/index.md), [RAG.SEARCH](https://docs.hotkv.com/commands/rag-search/index.md), [RAG.STATS](https://docs.hotkv.com/commands/rag-stats/index.md), [RAG.DROP](https://docs.hotkv.com/commands/rag-drop/index.md), [RAG.LIST](https://docs.hotkv.com/commands/rag-list/index.md), [AI features guide](https://docs.hotkv.com/ai-features/index.md)