Skip to content

Commit 61da2fe

Browse files
msaaddevsaqibameen
andauthored
πŸ“¦ NEW: Deploy Single Doc to Memory
* πŸ“¦ NEW: Single document command * πŸ“¦ NEW: Build single document * πŸ“¦ NEW: Deploy single document * πŸ‘Œ IMPROVE: Code * πŸ‘Œ IMPROVE: Code * πŸ“¦ NEW: Create build directory if doesn't exists * πŸ‘Œ IMPROVE: Code * πŸ‘Œ IMPROVE: Code * πŸ“– DOC: Deploy a document in memory * πŸ‘Œ IMPROVE: Command * πŸ‘Œ IMPROVE: Docs * πŸ‘Œ IMPROVE: Code * πŸ‘Œ IMPROVE: review * πŸ“¦ NEW: package.json * πŸ‘Œ IMPROVE: memory files fetch --------- Co-authored-by: Saqib Ameen <[email protected]>
1 parent 9678892 commit 61da2fe

File tree

22 files changed

+690
-158
lines changed

22 files changed

+690
-158
lines changed

β€Žapps/baseai.dev/content/docs/deployment/deploy.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,5 @@ baseai deploy --overwrite # or -o
6868
When you deploy a project to prod that uses BaseAI, ensure that `LANGBASE_API_KEY` is set in the production environment. This key is required to authenticate with Langbase and access deployed AI agents and memory.
6969

7070
Use appropriate [Org or User API key](https://langbase.com/docs/api-reference/api-keys) to authenticate with Langbase.
71+
72+
---
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: 'Deploy a document to memory'
3+
description: "Deploy a document to memory on Langbase using the BaseAI CLI."
4+
tags:
5+
- baseai
6+
- auth
7+
- langbase
8+
- deploy
9+
- document
10+
section: 'Deployment'
11+
published: 2024-09-24
12+
modified: 2024-09-24
13+
---
14+
15+
# Deploy a document to memory
16+
17+
Deploy a document to memory on [Langbase](https://langbase.com/) using the BaseAI CLI. Before you deploy a document, make sure you are [authenticated](/docs/deployment/authentication) with the BaseAI CLI.
18+
19+
---
20+
21+
## Deploy a document
22+
23+
Pass the memory name and document name to the `deploy` command using the `--memory` flag or `-m` for short and `--document` flag or `-d` for short.
24+
25+
```bash
26+
npx baseai@latest deploy -m <memory-name> -d <document-name>
27+
```
28+
29+
### Document doesn't exist in memory on Langbase?
30+
31+
The BaseAI CLI will add the missing provided document in memory.
32+
33+
### Document exist in memory on Langbase?
34+
35+
The BaseAI CLI will exit with message to run the command again with `--overwrite` flag to overwrite the document in memory.
36+
37+
---
38+
39+
## Overwrite a document in memory
40+
41+
Overwrite the existing document in memory on Langbase using the `overwrite` flag or `-o` for short.
42+
43+
```bash
44+
npx baseai@latest deploy -m <memory-name> -d <doc-name> -o
45+
```
46+
47+
---
48+
49+
## Example
50+
51+
Here is an example of the command to deploy a document to memory on Langbase.
52+
53+
```bash
54+
npx baseai@latest deploy -m chat-with-docs -d langbase.md
55+
```
56+
57+
---

β€Žapps/baseai.dev/content/docs/memory/create.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Create a new memory using the `memory` command. It will ask you for name and des
2323
Let's use the name `chat-with-docs` for this example.
2424

2525
```bash
26-
baseai memory
26+
npx baseai@latest memory
2727
```
2828

2929
It creates a memory at `baseai/memory/chat-with-docs` in your current directory. Add documents to `baseai/memory/chat-with-docs/documents` for use.

β€Žapps/baseai.dev/content/docs/memory/embed-document.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Please make sure to add `OPENAI_API_KEY` to `.env` file in the root of your proj
2828
Pass the memory name and document name to the `embed` command using the `--memory` flag or `-m` for short and `--document` flag or `-d` for short.
2929

3030
```bash
31-
baseai embed -m chat-with-docs -d document-name
31+
npx baseai@latest embed -m chat-with-docs -d document-name
3232
```
3333

3434
It will generate embeddings and update the memory index. If the document is already embedded, it will update the embeddings for the document.

β€Žapps/baseai.dev/content/docs/memory/embed.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Make sure you have a memory [created](/docs/memory/create) a memory and added do
3232
Embed all memory documents and create a semantic index for the memory. Pass the memory name to the `embed` command using the `--memory` flag or `-m` for short.
3333

3434
```bash
35-
baseai embed -m chat-with-docs
35+
npx baseai@latest embed -m chat-with-docs
3636
```
3737

3838
It will generate embeddings for the documents and create an index for search. Your memory is now ready to be used with a Pipe.

β€Žapps/baseai.dev/content/docs/memory/list.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ List all memory in your current project directory.
2020
Use the `memory list` command to list all memory in your current project directory.
2121

2222
```bash
23-
baseai memory --list
23+
npx baseai@latest memory --list
2424
```
2525

2626
It will list all memory in the current project directory.

β€Žapps/baseai.dev/content/docs/memory/retrieve.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The output is from memory created in [quickstart guide](/docs/memory/quickstart)
3737

3838

3939
```bash
40-
baseai retrieve -m chat-with-docs -q "Default LLM"
40+
npx baseai@latest retrieve -m chat-with-docs -q "Default LLM"
4141
```
4242

4343
---

β€Žapps/baseai.dev/src/data/navigation.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,12 @@ const navigationData: NavigationItem[] = [
176176
href: '/docs/deployment/authentication'
177177
},
178178
{
179-
title: 'Deploy',
179+
title: 'Deploy All',
180180
href: '/docs/deployment/deploy'
181+
},
182+
{
183+
title: 'Deploy Document',
184+
href: '/docs/deployment/document'
181185
}
182186
]
183187
},

β€Žexamples/nodejs/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,7 @@ assets/img/.DS_Store
7575
.next
7676
# baseai
7777
/.baseai/
78+
# baseai
79+
**/.baseai/
80+
# env file
81+
.env

β€Žpackages/baseai/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"dotenv": "^16.4.5",
6767
"execa": "^9.4.0",
6868
"figures": "^6.1.0",
69+
"find-up": "^7.0.0",
6970
"get-package-json-file": "^2.0.0",
7071
"hono": "^4.5.11",
7172
"js-tiktoken": "^1.0.14",

0 commit comments

Comments
Β (0)