Skip to content

Commit d9119fc

Browse files
labrenberazvan
andauthored
feat: OpenSearch RAG demo (#354)
* Add OpenSearch RAG demo * Change stacks/demos from local files to remote --------- Co-authored-by: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com>
1 parent 50cb81e commit d9119fc

File tree

13 files changed

+3326049
-1
lines changed

13 files changed

+3326049
-1
lines changed

demos/demos-v2.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,28 @@ demos:
286286
cpu: 6400m
287287
memory: 12622Mi
288288
pvc: 20Gi
289+
opensearch-rag:
290+
description: Retrieval Augmented Generation (RAG) demo with OpenSearch vector search and Llama 3.1 8B for semantic question answering
291+
documentation: https://docs.stackable.tech/home/stable/demos/opensearch-rag
292+
stackableStack: opensearch-rag
293+
labels:
294+
- opensearch
295+
- rag
296+
- vector-search
297+
- ai
298+
- llm
299+
- llama
300+
- ollama
301+
- jupyterlab
302+
- semantic-search
303+
manifests:
304+
- plainYaml: https://raw.githubusercontent.com/stackabletech/demos/main/demos/opensearch-rag/load-embeddings-from-git.yaml
305+
supportedNamespaces: []
306+
resourceRequests:
307+
cpu: 8000m
308+
memory: 16Gi
309+
pvc: 10Gi
310+
parameters:
311+
- name: branch
312+
description: Git branch to download demo files from
313+
default: main
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# OpenSearch RAG Demo - Embeddings Generation
2+
3+
This directory contains the script to regenerate embeddings for the Stackable documentation.
4+
5+
## Prerequisites
6+
7+
**Ollama with nomic-embed-text:v1.5 model** - Choose one of the following options:
8+
9+
### Option 1: Run Ollama locally
10+
11+
```bash
12+
# Install Ollama
13+
curl -fsSL https://ollama.com/install.sh | sh
14+
15+
# Pull the embedding model
16+
ollama pull nomic-embed-text:v1.5
17+
```
18+
19+
### Option 2: Port-forward from the demo
20+
21+
```bash
22+
# Deploy the demo if not already running
23+
stackablectl demo install opensearch-rag
24+
25+
# Port-forward Ollama (keep running in a separate terminal)
26+
kubectl port-forward deployment/ollama 11434:11434
27+
```
28+
29+
## Regenerate Embeddings
30+
31+
Run the script using uv to automatically handle Python dependencies:
32+
33+
```bash
34+
uv run --with requests --with beautifulsoup4 python generate-embeddings-local.py
35+
```
36+
37+
This will:
38+
39+
- Crawl docs.stackable.tech (defaults to `stable` release)
40+
- Extract and chunk documentation
41+
- Generate embeddings using nomic-embed-text
42+
- Save to `stackable-docs-embeddings.json` (~89 MB, ~4200 chunks)
43+
44+
The process can take more than 1 hour mainly depending on your CPU.
45+
46+
### Configuration
47+
48+
You can customize the crawling behavior with environment variables:
49+
50+
```bash
51+
# Crawl a specific Stackable release (default: stable)
52+
RELEASE=24.11 uv run --with requests --with beautifulsoup4 python generate-embeddings-local.py
53+
54+
# Crawl nightly documentation
55+
RELEASE=nightly uv run --with requests --with beautifulsoup4 python generate-embeddings-local.py
56+
```

0 commit comments

Comments
 (0)