ajosh0504 commited on
Commit
1dcacff
·
verified ·
1 Parent(s): 104fdc3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +76 -3
README.md CHANGED
@@ -1,3 +1,76 @@
1
- ---
2
- license: cc-by-3.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-3.0
3
+ task_categories:
4
+ - question-answering
5
+ - text-retrieval
6
+ language:
7
+ - en
8
+ tags:
9
+ - vector search
10
+ - retrieval augmented generation
11
+ size_categories:
12
+ - <1K
13
+ ---
14
+
15
+ ## Overview
16
+
17
+ This dataset consists of chunked and embedded versions of a subset of articles from the MongoDB Developer Center.
18
+
19
+ ## Dataset Structure
20
+
21
+ The dataset consists of the following fields:
22
+
23
+ - sourceName: The source of the article. This value is `devcenter` for the entire dataset.
24
+ - url: Link to the article
25
+ - action: Action taken on the article. This value is `created` for the entire dataset.
26
+ - body: Content of the chunk in Markdown format
27
+ - format: Format of the content. This value is `md` for all articles.
28
+ - metadata: Metadata such as tags, content type etc. associated with the articles
29
+ - title: Title of the article
30
+ - updated: The last updated date of the article
31
+ - embedding: The embedding of the chunk's content, created using the [thenlpr/gte-small](https://huggingface.co/thenlper/gte-small) open-source model from Hugging Face.
32
+
33
+ ## Usage
34
+
35
+ This dataset can be useful for prototyping RAG applications. This is a real sample of data we have used to build the AI chatbot on our official documentation website.
36
+
37
+ ## Ingest Data
38
+
39
+ To experiment with this dataset using MongoDB Atlas, first [create a MongoDB Atlas account](https://www.mongodb.com/cloud/atlas/register?utm_campaign=devrel&utm_source=community&utm_medium=organic_social&utm_content=Hugging%20Face%20Dataset&utm_term=apoorva.joshi).
40
+
41
+ You can then use the following script to load this dataset into your MongoDB Atlas cluster:
42
+
43
+ ```
44
+ import os
45
+ from pymongo import MongoClient
46
+ import datasets
47
+ from datasets import load_dataset
48
+ from bson import json_util
49
+
50
+
51
+ uri = os.environ.get('MONGODB_ATLAS_URI')
52
+ client = MongoClient(uri)
53
+ db_name = 'your_database_name' # Change this to your actual database name
54
+ collection_name = 'devcenter_articles-embedded'
55
+
56
+ collection = client[db_name][collection_name]
57
+
58
+ dataset = load_dataset("MongoDB/devcenter-articles-embedded")
59
+
60
+ insert_data = []
61
+
62
+ for item in dataset['train']:
63
+ doc = json_util.loads(json_util.dumps(item))
64
+ insert_data.append(doc)
65
+
66
+ if len(insert_data) == 1000:
67
+ collection.insert_many(insert_data)
68
+ print("1000 records ingested")
69
+ insert_data = []
70
+
71
+ if len(insert_data) > 0:
72
+ collection.insert_many(insert_data)
73
+ insert_data = []
74
+
75
+ print("Data ingested successfully!")
76
+ ```