You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/baseai.dev/content/docs/guides/memory-from-git.mdx
+30-19Lines changed: 30 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ tags:
8
8
- langbase
9
9
section: 'Memory'
10
10
published: 2024-10-08
11
-
modified: 2024-10-08
11
+
modified: 2024-11-26
12
12
---
13
13
14
14
# Create a Memory from git Repository
@@ -34,40 +34,51 @@ It will also prompt you if you want to create a memory from the current project
34
34
Do you want to create memory from current project git repository? (yes/no) yes
35
35
```
36
36
37
-
## Step #3 Provide directory
37
+
It will create a memory at `baseai/memory/chat-with-repo` and track files in the current git repository. It prints the path of the memory created.
38
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.
39
+
Open that file in your editor, it looks like this:
40
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.
41
+
```ts
42
+
import {MemoryI} from'@baseai/core';
46
43
47
-
## Step #4 Provide file extensions
44
+
const chatWithRepoMemory = ():MemoryI=> ({
45
+
name: 'chat-with-repo',
46
+
description: "My list of docs as memory for an AI agent pipe",
47
+
git: {
48
+
enabled: true,
49
+
include: ['**/*'],
50
+
gitignore: true,
51
+
deployedAt: '',
52
+
embeddedAt: ''
53
+
}
54
+
});
48
55
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)
56
+
exportdefaultchatWithRepoMemory;
53
57
```
54
58
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.
59
+
Below is the explanation of the fields in the memory file:
56
60
57
-
## Step #5 Deploy the memory
61
+
-`enabled`: Set to `true` to enable tracking of git repository.
62
+
-`include`: Follows glob pattern to include files from the git repository. You can change the pattern to include only specific files or directories.
63
+
-`gitignore`: Set to `true` to include `.gitignore` file in the memory.
64
+
-`deployedAt`: Set to the commit hash where the memory was last deployed. It is used to track the changes in the memory for deployment. Try to avoid changing this field manually.
65
+
-`embeddedAt`: Set to the commit hash where the memory was last embedded. It is used to track the changes in the memory for local development. Try to avoid changing this field manually.
66
+
67
+
## Step #3 Deploy the memory
58
68
59
69
Commit all the changes to git and deploy.
60
70
61
71
```bash
62
72
npx baseai@latest deploy -m chat-with-repo
63
73
```
64
74
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
75
---
68
76
69
-
## Running the memory locally
77
+
## Tracking changes from Git Repository
70
78
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.
79
+
That's it! Next time you make changes to the git repository, you can run the `deploy` command again to update the memory. Make sure to commit all the changes before deploying.
80
+
81
+
Similarly, if you are using memory locally, make sure to `embed` the memory again after commit before running the AI agent pipe. As a result, it automatically updates the memory with the latest changes and record the hashes in the memory file.
0 commit comments