Skip to content

Commit 726a295

Browse files
committed
update readme
1 parent 9233539 commit 726a295

File tree

1 file changed

+33
-10
lines changed

1 file changed

+33
-10
lines changed

README.md

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# MongoDB-RAG
66

77
![NPM Version](https://img.shields.io/npm/v/mongodb-rag?color=blue&label=npm)
8-
![Build Status](https://github.com/mongodb-developer/mongodb-rag/actions/workflows/test.yml/badge.svg)
98
![License](https://img.shields.io/github/license/mongodb-developer/mongodb-rag)
109
![Issues](https://img.shields.io/github/issues/mongodb-developer/mongodb-rag)
1110
![Pull Requests](https://img.shields.io/github/issues-pr/mongodb-developer/mongodb-rag)
@@ -34,8 +33,31 @@ npm install mongodb-rag dotenv
3433
```
3534

3635
### **2️⃣ Set Up MongoDB Atlas**
37-
1. **Create a MongoDB Atlas Cluster** ([MongoDB Atlas](https://www.mongodb.com/atlas))
38-
2. **Enable Vector Search** under Indexes:
36+
1. **Initialize Your App** using the CLI:
37+
```sh
38+
npx mongodb-rag init
39+
```
40+
This will guide you through setting up your MongoDB connection and save the configuration to `.mongodb-rag.json`. Make sure to add `.mongodb-rag.json` to your `.gitignore` file to keep your credentials secure.
41+
42+
```bash
43+
% npx mongodb-rag init
44+
✔ Enter your MongoDB connection string: · mongodb+srv://<username>:<password>@cluster0.mongodb.net/
45+
✔ Enter the database name: · mongodb-rag
46+
✔ Enter the collection name: · documents
47+
✔ Select an embedding provider: · openai
48+
✔ Enter your API key (skip if using Ollama): · your-embedding-api-key
49+
✔ Enter the model name: · text-embedding-3-small
50+
✔ Enter the embedding dimensions: · 1536
51+
✅ Configuration saved to .mongodb-rag.json
52+
53+
🔍 Next steps:
54+
1. Run `npx mongodb-rag test-connection` to verify your setup
55+
2. Run `npx mongodb-rag create-index` to create your vector search index
56+
```
57+
58+
2. **Create a MongoDB Atlas Cluster** ([MongoDB Atlas](https://www.mongodb.com/atlas))
59+
60+
3. **Enable Vector Search** under Indexes:
3961
```json
4062
{
4163
"definition": {
@@ -45,14 +67,15 @@ npm install mongodb-rag dotenv
4567
}
4668
}
4769
```
48-
3. **Get Your Connection String** and store it in `.env`:
49-
```env
50-
MONGODB_URI=mongodb+srv://<username>:<password>@cluster0.mongodb.net/
51-
EMBEDDING_PROVIDER=openai # Options: openai, deepseek
52-
EMBEDDING_API_KEY=your-embedding-api-key
53-
EMBEDDING_MODEL=text-embedding-3-small # Change based on provider
54-
VECTOR_INDEX=default
70+
or, use the CLI to create the index:
71+
```sh
72+
npx mongodb-rag create-index
73+
```
74+
4. **Create a `.env` File** using:
75+
```sh
76+
npx mongodb-rag create-env
5577
```
78+
This command reads the `.mongodb-rag.json` file and generates a `.env` file with the necessary environment variables.
5679
5780
### **3️⃣ Quick Start with CLI**
5881
You can generate a fully working RAG-enabled app with **MongoDB Atlas Vector Search** using:

0 commit comments

Comments
 (0)