Home Explore Blog CI



ragit

docs/commands/merge.txt
403f51dfaf90bc2ec5ef60e8140e03014112306c79c458b60000000300000753
rag-merge(1)
==========

NAME
----
rag-merge - Merge another knowledge-base into the current base

SYNOPSIS
--------
[verse]
'rag merge' <path> [--prefix <path>]
            [--force | -f | --ignore | --interactive | --reject] [--quiet | -q]

DESCRIPTION
-----------
It has 2 use cases: merging another complete knowledge-base, merging 2
half-built knowledge-bases and continue building.

1. Merging 2 complete knowledge-bases

Let's say you have cloned 2 knowledge-bases: `rag clone http://ragit.baehyunsol.com/sample/git`
and `rag clone http://ragit.baehyunsol.com/sample/ragit`.
It would create 2 directories `git/` and `ragit/`, and each is a complete
knowledge-base. If you wanna know about git, you `cd git` and
`rag query <QUERY>`. Or, you can `cd ragit` and ask how ragit works. But this
is not ergonomic. If you have 10 different topics, there would be 10 different
directories and you would have to change directory each time.

That's where `rag merge` shines. Below is how it works.

1) run `mkdir merged; cd merged; rag init` to create an empty knowledge-base
2) run `rag merge ../git/ --prefix=git` and
   `rag merge ../ragit/ --prefix=ragit` to merge the 2 knowledge-bases.

When you merge a base, it reads the list of processed files of the base, then
copies all the chunks of the processed files. Since it identifies chunks based
on paths, it's easy to introduce collisions. For example, if both
knowledge-bases have a file `doc/index.txt`, there's no way to distinguish the
two. That's why you need `--prefix`. It adds prefixes to the paths. For example,
if `--prefix=git` is enabled, `doc/index.txt` of the knowledge-base will be
copied to `git/doc/index.txt`. Giving appropriate prefixes makes the lives of you
(RAG user), LLM and the engine easier.

2. Merging 2 half-built knowledge-bases and continue building

This feature is still under construction.

Chunks
c0de48d4 (1st chunk of `docs/commands/merge.txt`)
Title: Rag-Merge Command
Summary
The rag-merge command is used to merge another knowledge-base into the current base, allowing for the combination of complete or half-built knowledge-bases, with options to handle collisions and customize the merge process.