> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ragrails.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Embedding

> Embed CLI chunk JSON files.

`ragrails embed` reads chunk JSON from `--input-dir`, generates vectors, and writes `embedded.json` to `--output-dir`.

```bash theme={null}
pip install "ragrails[voyage]"
export VOYAGE_API_KEY="..."
```

## Command

```bash theme={null}
ragrails embed \
  --input-dir files/output/chunks/ \
  --output-dir files/output/embedded/ \
  --provider voyage \
  --model voyage-3 \
  --batch-size 64
```

Output:

```text theme={null}
Inputs   : 87
Embedded : 87
Failed   : 0
Saved to : files/output/embedded/embedded.json
```

The CLI embeds with document input type for indexing. Query-time embedding happens inside `query`, `retrieve`, and `chat`.

<Tip>Use the same embedding provider/model for indexing and retrieval. Vectors from different models are not comparable.</Tip>

## Options

| Option         | Default    | Description                         |
| -------------- | ---------- | ----------------------------------- |
| `--input-dir`  | required   | Folder containing chunk JSON files. |
| `--output-dir` | required   | Folder to write `embedded.json`.    |
| `--provider`   | `voyage`   | Embedding provider.                 |
| `--model`      | `voyage-3` | Embedding model.                    |
| `--batch-size` | `64`       | Chunks per embedding request.       |

## Next Stage

```bash theme={null}
ragrails store --input-dir files/output/embedded/ \
  --vector-db qdrant --collection support --url http://localhost:6333
```

<CardGroup cols={2}>
  <Card title="Chunking" icon="scissors" href="/usage/cli/chunking">Create chunks.</Card>
  <Card title="Storing" icon="database" href="/usage/cli/storing">Store embedded chunks.</Card>
</CardGroup>
