|
| 1 | +--- |
| 2 | +title: 'Create Memory from Git Repository' |
| 3 | +description: "Create a memory from a git repository using BaseAI CLI." |
| 4 | +tags: |
| 5 | + - baseai |
| 6 | + - memory |
| 7 | + - git |
| 8 | + - langbase |
| 9 | +section: 'Memory' |
| 10 | +published: 2024-10-08 |
| 11 | +modified: 2024-10-08 |
| 12 | +--- |
| 13 | + |
| 14 | +# Create a Memory from git Repository |
| 15 | + |
| 16 | +Create a memory from a git repository using BaseAI CLI. |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## Step #1 Create memory in your existing git repository |
| 21 | + |
| 22 | +Create a new memory using the `memory` command in root of project. It will ask you for name and description of the memory. |
| 23 | + |
| 24 | +Let's use the name `chat-with-repo` for this example. |
| 25 | + |
| 26 | +```bash |
| 27 | +npx baseai@latest memory |
| 28 | +``` |
| 29 | + |
| 30 | +## Step #2 Allow memory to track git repository |
| 31 | + |
| 32 | +It will also prompt you if you want to create a memory from the current project git repository. Select `yes`. |
| 33 | +``` |
| 34 | +Do you want to create memory from current project git repository? (yes/no) yes |
| 35 | +``` |
| 36 | + |
| 37 | +## Step #3 Provide directory |
| 38 | + |
| 39 | +Next, it will ask you which directory or subdirectory you want to use for the memory. You can select the current directory or any subdirectory. |
| 40 | + |
| 41 | +``` |
| 42 | +Enter the path to the directory to track (relative to current directory): |
| 43 | +``` |
| 44 | + |
| 45 | +Provide the path relative to the root of the project directory that you want to use for the memory. E.g., `src/content/docs`, to use the `docs` directory in the `src/content` directory. |
| 46 | + |
| 47 | +## Step #4 Provide file extensions |
| 48 | + |
| 49 | +Next, it will ask you which files extensions you want to track. You can provide a comma-separated list of file extensions. E.g., `.mdx,.md` to track markdown files. Alternatively, you can provide `*` to track all files. |
| 50 | + |
| 51 | +``` |
| 52 | +Enter file extensions to track (use * for all, or comma-separated list, e.g., .md,.mdx) |
| 53 | +``` |
| 54 | + |
| 55 | +That's it! It creates a memory at `baseai/memory/chat-with-repo` in your current directory that tracks the git repository directory and file extensions you provided. |
| 56 | + |
| 57 | +## Step #5 Deploy the memory |
| 58 | + |
| 59 | +Commit all the changes to git and deploy. |
| 60 | + |
| 61 | +```bash |
| 62 | +npx baseai@latest deploy -m chat-with-repo |
| 63 | +``` |
| 64 | + |
| 65 | +Next time you want to update the memory with the latest changes from the git repository, you can run the `deploy` command again. Make sure to commit all the changes before deploying. |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +## Running the memory locally |
| 70 | + |
| 71 | +You can embed the memory locally using the `embed` command. Just like any other memory and use it with a Pipe. Follow the [quickstart guide](/docs/memory/quickstart) to see how to embed and use the memory. |
| 72 | + |
| 73 | +--- |
0 commit comments