Let's clone all of them. You cannot clone them inside `playground/`, because you knowledge-bases cannot be nested. Please make sure to `cd ..;` before you clone them.
Run `cd ..; rag clone http://ragit.baehyunsol.com/sample/git; rag clone http://ragit.baehyunsol.com/sample/ragit; rag clone http://ragit.baehyunsol.com/sample/rustc;`
```
<cwd>
|
*-- playground
| |
| *-- .ragit/
| |
| *-- .. many files and directories
|
*-- git
| |
| *-- .ragit/
| |
| *-- .. many files and directories
|
*-- ragit
| |
| *-- .ragit/
| |
| *-- .. many files and directories
|
*-- rustc
|
*-- .ragit/
|
*-- .. many files and directories
```
Now we have 1 empty knowledge-base and 3 complete knowledge-bases. We're gonna use the empty knowledge-base as the main one. Let's extend the empty one (playground).
Run `cd playground`. `rag merge ../git --prefix=git`, `rag merge ../ragit --prefix=ragit` and `rag merge ../rustc --prefix=rustc`.
## 3. Change Configs
Before asking a question or building a knowledge-base, you may want to change configurations. Configurations are very important because most commands cost money and you can optimize it with proper configurations.
### Per Knowledge-Base Configuration
Run `rag config --get model`. You'll see which model is used to answer your queries and build a knowledge-base.
Let's say you have free credits for Anthropic. By running `rag config --set model claude-3.5-sonnet`, you can change your default model.
Run `rag config --get-all` to see all the keys and values.
### Global Configuration
If you want to set default configurations for all your repositories, you can create configuration files in `~/.config/ragit/`:
- `~/.config/ragit/api.json` - For API configuration (model, timeout, etc.)
- `~/.config/ragit/build.json` - For build configuration (chunk size, etc.)
- `~/.config/ragit/query.json` - For query configuration (max titles, etc.)
These files can contain just the specific fields you want to override - you don't need to include all configuration options. For example, if you only want to set a default model, your `~/.config/ragit/api.json` could be as simple as:
```json
{
"model": "claude-3.5-sonnet"
}
```
When you run `rag init` to create a new repository, these global configurations will be used as defaults. This is especially useful if you always want to use a specific model or have specific build parameters.
## 4. Build an inverted-index
[Inverted-index](https://en.wikipedia.org/wiki/Inverted_index) is a special kind of data structure that makes full-text searching much faster. By running `rag ii-build`, you can build an inverted index. Once you're done, run `rag ii-status` and see if it says "complete". If so, you're good to go. Text retrieval will get much faster.
## 5. Ask questions on a Knowledge-Base
Asking query is straight forward: `rag query "Tell me how the rust compiler uses git"`
If you want an interactive chat, run `rag query --interactive`.