Home Explore Blog CI



ragit

1st chunk of `docs/config.md`
71e7099a997ae0e86a000cd8064883d0ee31794dc34a24a3000000010000099a
# Configuration

Ragit is highly configurable. The config files can be found at `.ragit/configs`, but I don't recommend you modifying it manually. If you have modified it manually and have trouble accessing a knowledge-base, try `rag check --recover`.

## Global Configuration

You can set global configuration defaults by placing configuration files in `~/.config/ragit/`. When initializing a new ragit repository, it will check for the following files:

- `~/.config/ragit/api.json` - For API configuration
- `~/.config/ragit/build.json` - For build configuration
- `~/.config/ragit/query.json` - For query configuration

These files can contain a subset of the configuration fields that you want to override. You don't need to include all fields - any fields not specified will use the default values. For example, if you only want to override the `model` and `dump_log` fields in api.json, your file might look like:

```json
{
  "model": "gpt-4o",
  "dump_log": true
}
```

Any values found in these files will override the default values when creating a new repository. This allows you to have consistent configuration across all your ragit repositories.

## `config` command

A recommended way of reading/writing config is `rag config` command.

`rag config --get <KEY>` shows you a value. For example, `rag config --get model` tells you which model you're using.

`rag config --get-all` shows you all the configs.

`rag config --set <KEY> <VALUE>` allows you to set a value.

## Reference

- chunk_size: int (number of characters)
    - default: 4000
    - Ragit tries its best to make each chunk smaller than this.
    - `chunk_size` and `slide_len` isn't always perfect because ragit can handle images. It cannot divide an image into 2 pieces, so an image at the end might make a chunk bigger than `chunk_size`.
- slide_len: int (number of characters)
    - default: 1000
    - There's a sliding window between 2 chunks. Each sliding window has this length.
    - `chunk_size` and `slide_len` isn't always perfect because ragit can handle images. It cannot divide an image into 2 pieces, so an image at the end might make a chunk bigger than `chunk_size`.
- image_size: int
    - default: 2000
    - If it's 2000, ragit treats an image as 2000 characters (when calculating `chunk_size` and `slide_len`).
- min_summary_len: int (number of characters)
    - default: 200
    - Ragit uses pdl schema to force LLMs generate summaries longer than this.

Title: Ragit Configuration Options
Summary
Ragit is highly configurable, allowing users to set global configuration defaults and override specific fields through various methods, including configuration files and the 'rag config' command, with options for customizing chunk size, slide length, image size, and minimum summary length.