Home Explore Blog CI



ragit

2nd chunk of `docs/quick_guide.md`
1eb1decb70b9a808391089d3bd6dcfe13e9d556517c042b900000001000008a6
After it's built, you'll see many data files in the `.ragit/` directory. You can ask queries on the knowledge-base now.

NOTE: You can ask queries on an incomplete knowledge-base, too.

## 2. (Optional) Clone Knowledge-Bases from web

This is the key part. You can download knowledge-bases from the internet and extend your knowledge-base with those. You can also share your knowledge-base with others.

First, let's make a fresh directory. Run `mkdir playground; cd playground`.

```
playground
```

Before downloading knowledge-bases, we have to init a rag index. Run `rag init`.

```
playground
  |
  *-- .ragit/
      |
      *-- chunks/
      |
      *-- configs/
      |
      *-- files/
      |
      *-- prompts/
      |
      *-- index.json
      |
      *-- models.json
```

You'll see an empty rag index. Now we have to download knowledge-bases from the web. I have uploaded a few sample knowledge-bases for you. You can `rag clone` them, like `rag clone http://ragit.baehyunsol.com/sample/git`

- [git](http://ragit.baehyunsol.com/sample/git)
- [ragit](http://ragit.baehyunsol.com/sample/ragit)
- [rustc-dev-guide](http://ragit.baehyunsol.com/sample/rustc)

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`.

Title: Cloning and Merging Knowledge-Bases
Summary
This section describes how to clone knowledge-bases from the web, create a new empty knowledge-base, and merge the cloned knowledge-bases into the empty one, allowing for the extension and combination of existing knowledge-bases using the Rag tool.