Skip to content

Commit 211ec62

Browse files
author
ajosh0504
committed
Fixing broken code vlock
1 parent 1dd2a4a commit 211ec62

File tree

3 files changed

+123
-2
lines changed

3 files changed

+123
-2
lines changed

docs/10-rag/3-components-of-rag.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# 📘 Components of a RAG System
1+
# 📘 Components of a RAG system
22

33
TO-DO
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# 🦹 Combine pre-filtering with vector search
2+
3+
Pre-filtering a technique to optimize vector search by only considering documents that match certain criteria during vector search.
4+
5+
Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **🦹‍♀️ Combine pre-filtering with vector search** section in the notebook to get a sense of how to combine pre-filtering with MongoDB Atlas Vector Search.
6+
7+
:::caution
8+
**DO NOT** actually modify the existing vector index definitions in the Atlas UI, or the existing pipeline definitions in the code.
9+
:::
10+
11+
The answers for code blocks in this section are as follows:
12+
13+
**CODE_BLOCK_16**
14+
15+
<details>
16+
<summary>Answer</summary>
17+
<div>
18+
```python
19+
{
20+
"fields": [
21+
{
22+
"numDimensions": 1024,
23+
"path": "embedding",
24+
"similarity": "cosine",
25+
"type": "vector",
26+
},
27+
{
28+
"path": "metadata.language"
29+
"type": "filter",
30+
},
31+
]
32+
}
33+
```
34+
</div>
35+
</details>
36+
37+
**CODE_BLOCK_17**
38+
39+
<details>
40+
<summary>Answer</summary>
41+
<div>
42+
```python
43+
[
44+
{
45+
"$vectorSearch": {
46+
"index": ATLAS_VECTOR_SEARCH_INDEX_NAME,
47+
"queryVector": query_embedding,
48+
"path": "embedding",
49+
"numCandidates": 150,
50+
"limit": 5,
51+
"filter": {"metadata.language": "en"},
52+
}
53+
},
54+
{
55+
"$project": {
56+
"_id": 0,
57+
"page_content": 1,
58+
"score": {"$meta": "vectorSearchScore"},
59+
}
60+
},
61+
]
62+
```
63+
</div>
64+
</details>
65+
66+
**CODE_BLOCK_18**
67+
68+
<details>
69+
<summary>Answer</summary>
70+
<div>
71+
```python
72+
{
73+
"fields": [
74+
{
75+
"numDimensions": 1024,
76+
"path": "embedding",
77+
"similarity": "cosine",
78+
"type": "vector",
79+
},
80+
{
81+
"path": "metadata.language"
82+
"type": "filter",
83+
},
84+
{
85+
"path": "type"
86+
"type": "filter",
87+
},
88+
]
89+
}
90+
```
91+
</div>
92+
</details>
93+
94+
**CODE_BLOCK_19**
95+
96+
<details>
97+
<summary>Answer</summary>
98+
<div>
99+
```python
100+
[
101+
{
102+
"$vectorSearch": {
103+
"index": ATLAS_VECTOR_SEARCH_INDEX_NAME,
104+
"queryVector": query_embedding,
105+
"path": "embedding",
106+
"numCandidates": 150,
107+
"limit": 5,
108+
"filter": {"$and": [{"metadata.language": "en"}, {"type": "Document"}]},
109+
}
110+
},
111+
{
112+
"$project": {
113+
"_id": 0,
114+
"page_content": 1,
115+
"score": {"$meta": "vectorSearchScore"},
116+
}
117+
},
118+
]
119+
```
120+
</div>
121+
</details>

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const workshopName = 'ai-rag-lab';
99
const organizationName = "mongodb-developer";
1010

1111
// Main page config
12-
const title = "Building RAG Applications using MongoDB";
12+
const title = "Build RAG Applications using MongoDB";
1313
const tagLine = "";
1414
const startButtonTitle = "Start Lab";
1515
const favicon = "img/favicon.svg"

0 commit comments

Comments
 (0)