--- task_categories: - text-retrieval language: - en - code tags: - macaulay2 - rag - documentation - vector-database pretty_name: Macaulay2 RAG Chunks license: gpl-2.0 --- # Macaulay2 RAG Chunks A comprehensive knowledge base extracted directly from the official Macaulay2 source code and documentation packages (`M2/Macaulay2/packages`). Designed to be ingested into Vector Databases (e.g., ChromaDB, FAISS) for Retrieval-Augmented Generation (RAG). ## 📊 Dataset Statistics - **Total Chunks:** 15,711 - **Size:** ~45MB - **Code Density:** ~85% of chunks contain executable Macaulay2 examples. - **Source:** Parsed from 2,208 `.m2` files using a custom AST/Regex-aware parser (`https://gitlab.com/frupniew/llm_macaulay/src/extract_m2_docs_v2.py`) that groups documentation per mathematical symbol. ## 🏷️ Metadata & Filtering Each chunk is enriched with metadata to allow for highly targeted retrieval: ```json { "id": "chunk_8492", "symbol": "primaryDecomposition", "package": "PrimaryDecomposition", "has_code": true, "headline": "compute the primary decomposition of an ideal", "usage": "primaryDecomposition I", "example_code": "R = QQ[x,y,z]; I = ideal(x^2, x*y); primaryDecomposition I" } This structure allows RAG pipelines to filter out purely theoretical text when the user explicitly asks for code implementation, or filter by specific algebraic packages (e.g., Schubert2). 🧩 Recommended Embedding Model Tested and optimized with sentence-transformers/all-MiniLM-L6-v2 for a balance of semantic mathematical understanding and low-latency retrieval.