Skip to content

Commit 903e8d4

Browse files
πŸ‘Œ IMPROVE: Docs and Examples (#9)
* πŸ› FIX: Examples * πŸ‘Œ IMPROVE: Memory docs * πŸ‘Œ IMPROVE: Env docs
1 parent e204225 commit 903e8d4

File tree

11 files changed

+27
-29
lines changed

11 files changed

+27
-29
lines changed

β€Žapps/baseai.dev/content/docs/getting-started/environment-variables.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ Read more about [Langbase LLM Keysets](https://langbase.com/docs/features/keyset
4848
LANGBASE_API_KEY=
4949

5050
# TODO: ADD: LOCAL ONLY. Add only to local env files.
51-
# Following keys are needed for local pipe runs. For providers you are using.
52-
# For Langbase, please add the key to your LLM keysets.
51+
# Following keys are needed for local pipe runs. Add keys of providers you are using.
52+
# For Langbase, please add the keys in your LLM keysets on Langbase Studio.
5353
# Read more: Langbase LLM Keysets https://langbase.com/docs/features/keysets
5454
OPENAI_API_KEY=
5555
ANTHROPIC_API_KEY=

β€Žapps/baseai.dev/content/docs/guides/nextjs-with-baseai.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ Refer to [Next.js with BaseAI](https://github.com/LangbaseInc/baseai/tree/main/e
335335

336336
## Step #9: Add environment variables
337337

338-
To be able to run and later deploy your Next.js app, you need to add providers and Langbase API keys.
338+
To be able to run and later deploy your Next.js app, you need to add your Langbase and LLM provider keys. Add the following environment variables to your `.env` file at the root of your app.
339339

340340
```bash
341341
# !! SERVER SIDE ONLY !!
@@ -347,8 +347,8 @@ To be able to run and later deploy your Next.js app, you need to add providers a
347347
LANGBASE_API_KEY=
348348

349349
# TODO: ADD: LOCAL ONLY. Add only to local env files.
350-
# Following keys are needed for local pipe runs. For providers you are using.
351-
# For Langbase, please add the key to your LLM keysets.
350+
# Following keys are needed for local pipe runs. Add the providers you are using.
351+
# For Langbase, please add the keys in your LLM keysets on Langbase Studio.
352352
# Read more: Langbase LLM Keysets https://langbase.com/docs/features/keysets
353353
OPENAI_API_KEY=
354354
ANTHROPIC_API_KEY=
@@ -370,7 +370,10 @@ TOGETHER_API_KEY=
370370
Run BaseAI dev server and start the Next.js app.
371371

372372
```bash
373+
# Terminal 1
373374
npx baseai@latest dev # Start BaseAI dev server
375+
376+
# Terminal 2
374377
npm run dev # Start Next.js app
375378
```
376379

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Let's create a chat with docs system for [Pipe FAQs](https://langbase.com/docs/p
4242
Create a new memory using the `memory` command. It will ask you for name and description of the memory. Use `chat-with-docs` as the memory name.
4343

4444
```bash
45-
baseai memory
45+
npx baseai@latest memory
4646
```
4747

4848
It creates a memory at `baseai/memory/chat-with-docs` in your current directory. Add documents to `baseai/memory/chat-with-docs/documents` to use them in the memory.
@@ -60,7 +60,7 @@ OPENAI_API_KEY=your-openai-api-key
6060
Save [Pipe FAQs](https://langbase.com/docs/pipe/faqs) page as a `.pdf` or `.txt` and add it to the memory. Next, create embeddings for the documents using the `embed` command. It will embed the 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.
6161

6262
```bash
63-
baseai embed -m chat-with-docs
63+
npx baseai@latest embed -m chat-with-docs
6464
```
6565

6666
Once the embeddings are created, it will print a success message in the terminal.
@@ -72,7 +72,7 @@ Let's create a [Pipe](/docs/pipe/quickstart) and connect memory to it. Use the `
7272
Use `chat-with-docs-rag` as the pipe name and select the memory `chat-with-docs` to connect it to the pipe.
7373

7474
```bash
75-
baseai pipe
75+
npx baseai@latest pipe
7676
```
7777

7878
It will create a pipe in your current directory under `baseai/pipes/chat-with-docs-rag.ts`. It prints the path in the terminal. You can open the file and see the details.

β€Žexamples/astro/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ BaseAI Astro example.
55
Please read the [documentation](https://baseai.dev/docs) for more information.
66

77
```sh
8+
# Install the dependencies
9+
npm install
10+
811
# Make sure to copy .env.baseai.example file and
912
# create .env file and add all the API keys in it
1013
cp .env.baseai.example .env

β€Žexamples/nodejs/.env.example

Lines changed: 0 additions & 16 deletions
This file was deleted.

β€Žexamples/nodejs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,5 @@ assets/img/.DS_Store
7373

7474
# Next.js
7575
.next
76+
# baseai
77+
/.baseai/

β€Žexamples/nodejs/baseai/pipes/chat-with-docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {PipeI} from '@baseai/core';
22
import chatWithDocsMemory from '../memory/chat-with-docs';
33

44
const buildPipe = (): PipeI => ({
5-
apiKey: 'process.env.LANGBASE_USER_ORG_API_KEY', // Replace with your API key https://langbase.com/docs/api-reference/api-keys
5+
apiKey: process.env.LANGBASE_API_KEY!, // Replace with your API key https://langbase.com/docs/api-reference/api-keys
66
name: 'chat-with-docs',
77
description: '',
88
status: 'private',

β€Žexamples/nodejs/baseai/pipes/summary.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {PipeI} from '@baseai/core';
22

33
const buildPipe = (): PipeI => ({
4-
apiKey: 'process.env.LANGBASE_USER_ORG_API_KEY', // Replace with your API key https://langbase.com/docs/api-reference/api-keys
4+
apiKey: process.env.LANGBASE_API_KEY!, // Replace with your API key https://langbase.com/docs/api-reference/api-keys
55
name: 'summary',
66
description: '',
77
status: 'private',

β€Žexamples/nodejs/readme.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ BaseAI Node.js examples.
55
Please read the [documentation](https://baseai.dev/docs) for more information.
66

77
```sh
8-
# Make sure to copy .env.example file and create .env file and add all the API keys in it
9-
cp .env.example .env
8+
# Install the dependencies
9+
npm install
10+
11+
# Make sure to copy .env.baseai.example file and
12+
# create .env file and add all the API keys in it
13+
cp .env.baseai.example .env
1014

1115
# Run the local baseai dev server to test the examples (uses localhost:9000 port)
1216
npx baseai dev

β€Žexamples/remix/.env.example

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
Β (0)