sanjeevafk commited on
Commit
0933532
·
verified ·
1 Parent(s): b869989

Add OPEA documentation chunks

Browse files
LICENSE_SUMMARY.md CHANGED
@@ -4,7 +4,7 @@ This dataset is mixed-license. Downstream consumers must respect the upstream li
4
 
5
  | Upstream License | Documents |
6
  | --- | ---: |
7
- | unknown | 5000 |
8
 
9
  ## Policy
10
 
 
4
 
5
  | Upstream License | Documents |
6
  | --- | ---: |
7
+ | unknown | 3134 |
8
 
9
  ## Policy
10
 
README.md CHANGED
@@ -1,205 +1,59 @@
1
  ---
2
  language:
3
  - en
4
- license: other
5
  tags:
6
  - rag
7
  - retrieval
8
  - technical-docs
9
  - programming
10
- - code
11
- - computer-science
12
- - embeddings
13
- - chunked
14
  size_categories:
15
  - 100K<n<1M
16
- pretty_name: DepthAPI Technical Corpus
17
  ---
18
 
19
  # depthapi_technical_corpus
20
 
21
- **260,954 chunks** of curated technical knowledge, purpose-built for hybrid RAG systems, embedding benchmarks, reranker evaluation, and coding agent retrieval experiments.
22
 
23
- ---
24
-
25
- ## Overview
26
-
27
- `depthapi_technical_corpus` is a mixed-license retrieval corpus assembled from technical books, engineering documentation, system design references, coding interview prep material, and post-mortem writeups. It is the backing knowledge store for the [DepthAPI](https://github.com/sanjeevafk/depthapi) hybrid RAG pipeline.
28
-
29
- The corpus is organized into **namespaces** that map to distinct retrieval modes, allowing downstream systems to scope queries to relevant knowledge domains.
30
-
31
- ---
32
-
33
- ## Data Sources
34
-
35
- | Source | Type | Namespace | License |
36
- |--------|------|-----------|---------|
37
- | Deep Learning with Python (Chollet) | Book | `default` | Manning fair-use |
38
- | Designing Data-Intensive Applications (Kleppmann) | Book | `default` | O'Reilly fair-use |
39
- | System Design resources | Docs / Markdown | `default` | Mixed / CC |
40
- | CPython Documentation | Official Docs | `default` | PSF-2.0 |
41
- | Engineering post-mortems | Blog / Web | `default` | CC-BY / Mixed |
42
- | [Coding Interview University – Cheat Sheets](https://github.com/jwasham/coding-interview-university) | PDF Cheat Sheets | `cs_fundamentals_knowledgeset` | CC BY-SA 4.0 |
43
-
44
- > ⚠️ This is a **mixed-license dataset**. Downstream users must inspect the `upstream_license` field and `SOURCES_MANIFEST.yaml` before redistribution or commercial use.
45
-
46
- ---
47
-
48
- ## Namespaces
49
-
50
- Namespaces act as logical partitions for routing retrieval queries. Each namespace is designed for a different knowledge vertical:
51
-
52
- | Namespace | Purpose | Approx. Chunks |
53
- |-----------|---------|----------------|
54
- | `default` | General ML, systems, engineering, and coding knowledge | ~259,800 |
55
- | `cs_fundamentals_knowledgeset` | CS fundamentals — DS&A, Big-O, OOP, STL, OS, design patterns | ~1,145 |
56
-
57
- ---
58
 
59
- ## Ingestion Pipeline
60
 
61
- The corpus was assembled from multiple upstream source types and normalized through a reproducible local pipeline backed by [Supabase](https://supabase.com) with pgvector.
62
 
63
- ### Tools Used
64
-
65
- - **[Scrapling](https://github.com/D4Vinci/Scrapling)** Stealth web crawler used for live documentation scraping and structured HTML extraction. Handles anti-bot mechanisms and extracts clean text from technical documentation sites.
66
- - **[opendataloader-pdf](https://github.com/opendataloader-project/opendataloader-pdf)** PDF-to-Markdown conversion library used for extracting content from book-like and document-style PDF sources. Outputs clean Markdown blocks with layout awareness.
67
-
68
- ### Processing Steps
69
-
70
- 1. **Extraction** — Raw content pulled from upstream sources via Scrapling (web) or `opendataloader_pdf.convert()` (PDF).
71
- 2. **Noise filtering** — OCR artifacts, page numbers, and garbled text filtered via regex heuristics before chunking.
72
- 3. **Chunking** — Text split semantically via `BaseIngestor.split_text_semantic(chunk_size=800)` with configurable overlap.
73
- 4. **Deduplication** — SHA-256 content hash (`content_hash`) deduplication. Duplicate chunks are skipped on upsert.
74
- 5. **Validation** — Minimum token count and quality threshold enforced before persistence.
75
- 6. **Persistence** — Chunks stored in local Supabase `knowledge_chunks` table with full metadata columns.
76
- 7. **Embedding backfill** — Dense embeddings computed via `BAAI/bge-base-en-v1.5` (768-dim) and stored in the `embedding` pgvector column.
77
- 8. **Export** — Parquet shards generated via `scripts/release/export_to_hf.py` and published to this repository.
78
-
79
- ---
80
 
81
  ## Schema
82
 
83
- Each row in the dataset represents one chunk:
84
-
85
- | Field | Type | Description |
86
- |-------|------|-------------|
87
- | `chunk_id` | `string` | UUID primary key |
88
- | `source_name` | `string` | Human-readable source title (e.g. `"Deep Learning with Python"`) |
89
- | `source_url` | `string` | Canonical upstream URL for the source document |
90
- | `namespace` | `string` | Retrieval namespace / knowledge domain |
91
- | `upstream_license` | `string` | SPDX license identifier or description |
92
- | `document_id` | `string` | Groups all chunks belonging to the same source document |
93
- | `chunk_index` | `int` | Ordinal position of chunk within its document |
94
- | `content_hash` | `string` | SHA-256 of chunk content — used for deduplication |
95
- | `content` | `string` | The raw chunk text |
96
- | `token_count` | `int` | Approximate token count (cl100k_base tokenizer) |
97
- | `chunker_version` | `string` | Version tag of the chunker that produced this chunk |
98
- | `retrieved_at` | `string` | ISO-8601 timestamp of when the chunk was ingested |
99
 
100
- ---
 
 
 
 
 
 
 
 
 
101
 
102
  ## Usage
103
 
104
- ### Load the full dataset
105
-
106
- ```python
107
- from datasets import load_dataset
108
-
109
- ds = load_dataset("sanjeevafk/depthapi_technical_corpus", split="train")
110
- print(ds[0])
111
- ```
112
-
113
- ### Stream for large-scale use
114
-
115
- ```python
116
- from datasets import load_dataset
117
-
118
- ds = load_dataset(
119
- "sanjeevafk/depthapi_technical_corpus",
120
- split="train",
121
- streaming=True,
122
- )
123
- for row in ds.take(5):
124
- print(row["source_name"], "|", row["namespace"], "|", row["content"][:120])
125
- ```
126
-
127
- ### Filter by namespace
128
-
129
  ```python
130
  from datasets import load_dataset
131
 
132
- ds = load_dataset("sanjeevafk/depthapi_technical_corpus", split="train")
133
-
134
- # Get only CS fundamentals chunks (Coding Interview University cheat sheets)
135
- cs_chunks = ds.filter(lambda x: x["namespace"] == "cs_fundamentals_knowledgeset")
136
- print(f"CS fundamentals chunks: {len(cs_chunks)}")
137
- ```
138
-
139
- ### Filter by source
140
-
141
- ```python
142
- ciu_chunks = ds.filter(
143
- lambda x: "Coding Interview University" in (x["source_name"] or "")
144
- )
145
  ```
146
 
147
- ### Build a simple BM25 retriever
148
-
149
- ```python
150
- from datasets import load_dataset
151
- from rank_bm25 import BM25Okapi
152
-
153
- ds = load_dataset("sanjeevafk/depthapi_technical_corpus", split="train")
154
- corpus = [row["content"] for row in ds]
155
- tokenized = [doc.split() for doc in corpus]
156
- bm25 = BM25Okapi(tokenized)
157
-
158
- results = bm25.get_top_n("binary search tree time complexity", corpus, n=5)
159
- for r in results:
160
- print(r[:200])
161
- ```
162
 
163
- ---
164
 
165
  ## Licensing
166
 
167
- This is a **mixed-license dataset**. Each chunk carries its own `upstream_license` value. Downstream users are responsible for verifying license compatibility before use.
168
-
169
- | License | Sources |
170
- |---------|---------|
171
- | `CC BY-SA 4.0` | Coding Interview University (CIU) cheat sheets |
172
- | `PSF-2.0` | CPython documentation |
173
- | Manning fair-use | Deep Learning with Python, DDIA |
174
- | Mixed / Unknown | Engineering blogs, post-mortems |
175
-
176
- See `SOURCES_MANIFEST.yaml` (included in this repository) for full per-source provenance.
177
-
178
- ---
179
-
180
- ## Export Workflow
181
-
182
- This dataset is published from the [DepthAPI](https://github.com/sanjeevafk/depthapi) pipeline using `scripts/release/export_to_hf.py`.
183
-
184
- **Incremental update** (recommended after new ingestion runs):
185
- ```bash
186
- python scripts/release/export_to_hf.py \
187
- --hf-repo-id "sanjeevafk/depthapi_technical_corpus" \
188
- --append \
189
- --commit-message "Add <source> chunks"
190
- ```
191
-
192
- **Full rebuild** (replaces all shards — use after major corpus restructuring):
193
- ```bash
194
- python scripts/release/export_to_hf.py \
195
- --hf-repo-id "sanjeevafk/depthapi_technical_corpus" \
196
- --force-rebuild
197
- ```
198
-
199
- A watermark is saved after each export to `data/hf_export/last_export_watermark.json`. The `--append` mode reads this to push only net-new chunks.
200
-
201
- ---
202
-
203
- ## Citation
204
-
205
- If you use this dataset, please cite the upstream sources where applicable. The corpus is provided as-is for research and development use.
 
1
  ---
2
  language:
3
  - en
 
4
  tags:
5
  - rag
6
  - retrieval
7
  - technical-docs
8
  - programming
 
 
 
 
9
  size_categories:
10
  - 100K<n<1M
 
11
  ---
12
 
13
  # depthapi_technical_corpus
14
 
15
+ ## Summary
16
 
17
+ `depthapi_technical_corpus` is a mixed-license retrieval corpus built from technical documentation, books, engineering writeups, and repository-derived reference material. It is intended for open-source RAG systems, embedding benchmarks, reranker evaluation, and enterprise retrieval experiments.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ ## Ingestion Process
20
 
21
+ The corpus was assembled from multiple upstream source types and normalized through a reproducible local pipeline backed by Supabase.
22
 
23
+ - `Scrapling` was used for live technical documentation crawling and structured HTML extraction from documentation websites.
24
+ - [`D4Vinci/Scrapling`](https://github.com/D4Vinci/Scrapling) was used for live technical documentation crawling and structured HTML extraction from documentation websites.
25
+ - [`opendataloader-project/opendataloader-pdf`](https://github.com/opendataloader-project/opendataloader-pdf) was used for PDF extraction when ingesting book-like and document-style technical sources into normalized markdown/text blocks.
26
+ - Source material was then normalized, rechunked deterministically, deduplicated, validated, and exported to parquet for Hugging Face datasets compatibility.
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  ## Schema
29
 
30
+ Each chunk includes:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
+ - `chunk_id`
33
+ - `source`
34
+ - `source_url`
35
+ - `upstream_license`
36
+ - `document_id`
37
+ - `chunk_index`
38
+ - `retrieved_at`
39
+ - `chunker_version`
40
+ - `content_hash`
41
+ - `content`
42
 
43
  ## Usage
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  ```python
46
  from datasets import load_dataset
47
 
48
+ dataset = load_dataset("sanjeevafk/depthapi_technical_corpus", split="train", streaming=True)
49
+ for row in dataset.take(3):
50
+ print(row["chunk_id"], row["source"], row["upstream_license"])
 
 
 
 
 
 
 
 
 
 
51
  ```
52
 
53
+ ## Retrieval Benchmark Example
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
+ Use `data/research_corpus/benchmarks/queries.jsonl` with your retriever and score against `qrels.jsonl`.
56
 
57
  ## Licensing
58
 
59
+ This is a mixed-license dataset. Downstream users must inspect `upstream_license` and `SOURCES_MANIFEST.yaml` before redistribution or commercial use.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SOURCES_MANIFEST.yaml CHANGED
@@ -1,12 +1,7 @@
1
  version: 1
2
  sources:
3
- - source: CPython Docs
4
- source_url: file://datasets/cpython/Doc/README.rst
5
  upstream_license: unknown
6
  retrieved_at: unknown
7
- documents: 4999
8
- - source: unknown
9
- source_url: unknown
10
- upstream_license: unknown
11
- retrieved_at: legacy-unknown
12
- documents: 1
 
1
  version: 1
2
  sources:
3
+ - source: OPEA Documentation
4
+ source_url: file://datasets/opea-docs/CONTRIBUTING.md
5
  upstream_license: unknown
6
  retrieved_at: unknown
7
+ documents: 3134
 
 
 
 
 
train-20260522T071112Z_all_append-00000.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ba2845f356b0e18d9d70521f5cf727d784db8c253aa3f3186057a080cae3269
3
+ size 1094195