Document Processing
MachinaOs provides a complete RAG (Retrieval-Augmented Generation) pipeline for processing documents, generating embeddings, and storing vectors for semantic search.Pipeline Overview
| Stage | Node | Purpose |
|---|---|---|
| 1. Collect | HTTP Scraper | Scrape URLs from web pages |
| 2. Download | File Downloader | Download files in parallel |
| 3. Parse | Document Parser | Extract text from documents |
| 4. Chunk | Text Chunker | Split text into overlapping chunks |
| 5. Embed | Embedding Generator | Generate vector embeddings |
| 6. Store | Vector Store | Store and query vectors |
HTTP Scraper
Scrapes links from web pages with support for pagination and date ranges.Modes
| Mode | Description | Use Case |
|---|---|---|
| single | One request to the URL | Simple page scraping |
| date | Iterate through a date range | News archives, dated content |
| page | Iterate through page numbers | Multi-page listings |
Parameters
URL template. Use
{date} (date mode) or {page} (page mode) placeholders for iteration.Iteration mode: single, date, or page
CSS selector for links to extract from each fetched page
JSON string of request headers
Start date for date mode (YYYY-MM-DD)
End date for date mode (YYYY-MM-DD)
Token in the URL replaced with each date (date mode)
First page number (page mode)
Last page number, inclusive (page mode)
Safety cap on the number of pages fetched (1-1000)
Route requests through a residential proxy provider. When enabled, exposes
proxy_provider, proxy_country, and session_type (rotating/sticky).Output
Example: Scrape News Archive
File Downloader
Downloads files from URLs in parallel using semaphore-based concurrency.Parameters
Directory to save downloaded files. Defaults to a
downloads/ folder inside the workflow workspace.Maximum parallel downloads (1-32)
Skip files that already exist
Download timeout in seconds (1-600)
Input
Accepts an array ofitems with a url field (from HTTP Scraper), or a plain urls list:
Output
Counts plus afiles array describing the successful downloads:
Document Parser
Parses documents to extract text content using configurable parsers.Parsers
| Parser | Description | Supported Formats |
|---|---|---|
| PyPDF | Fast PDF parsing | |
| Marker | GPU-accelerated OCR | PDF (scanned documents) |
| Unstructured | Multi-format parsing | PDF, DOCX, HTML, TXT, MD |
| BeautifulSoup | HTML parsing | HTML |
Parameters
Parser to use: pypdf, marker, unstructured, beautifulsoup
Single file path to parse (takes precedence over
input_dir)Directory to scan for files matching
file_patternGlob pattern used when scanning
input_dir (e.g. *.pdf, *.html)Input
Setfile_path for a single file, or input_dir + file_pattern for a directory scan.
Output
Parser Comparison
| Feature | PyPDF | Marker | Unstructured | BeautifulSoup |
|---|---|---|---|---|
| Speed | Fast | Slow | Medium | Fast |
| Accuracy | Good | Excellent | Good | Good |
| OCR | No | Yes (GPU) | Optional | No |
| Formats | Many | HTML | ||
| GPU Required | No | Yes | No | No |
Text Chunker
Splits text into overlapping chunks for embedding generation.Strategies
| Strategy | Description | Best For |
|---|---|---|
| recursive | Split by paragraphs, sentences, words | Most documents |
| markdown | Preserve markdown structure | Markdown files |
| token | Falls back to recursive splitting | Consistent chunk sizes |
Parameters
Chunking strategy: recursive, markdown, or token
Target chunk size in characters (100-8000)
Overlap between chunks (0-1000)
Input
Accepts adocuments array (with a content field, from Document Parser) or a plain text string:
Output
Choosing Chunk Size
| Document Type | Recommended Size | Overlap |
|---|---|---|
| Technical docs | 500-1000 | 100-200 |
| Articles | 1000-1500 | 200-300 |
| Books | 1500-2000 | 300-400 |
| Code | 500-800 | 100-150 |
Embedding Generator
Generates vector embeddings from text chunks using various providers.Providers
| Provider | Model | Dimensions | Cost |
|---|---|---|---|
| HuggingFace | BAAI/bge-small-en-v1.5 | 384 | Free (local) |
| HuggingFace | BAAI/bge-large-en-v1.5 | 1024 | Free (local) |
| OpenAI | text-embedding-3-small | 1536 | Paid |
| OpenAI | text-embedding-3-large | 3072 | Paid |
| Ollama | nomic-embed-text | 768 | Free (local) |
Parameters
Embedding provider: huggingface (local), openai, or ollama (local server)
Model name for the chosen provider. Override when switching provider (e.g.
text-embedding-3-small for OpenAI).Batch size for embedding generation (1-256)
OpenAI API key. Passed as a node parameter (only used when provider is openai).
Input
Accepts achunks array (from Text Chunker), each with a content field:
Output
Parallel arrays:embeddings (one vector per chunk) plus the original chunks echoed back for pairing.
Vector Store
Stores and queries vector embeddings using various backends.Backends
| Backend | Description | Best For |
|---|---|---|
| ChromaDB | Local SQLite-based | Development, small datasets |
| Qdrant | High-performance | Production, large datasets |
| Pinecone | Cloud-hosted | Serverless, managed service |
Operations
| Operation | Description |
|---|---|
| store | Add embeddings to the store |
| query | Search for similar documents |
| delete | Remove documents by ID or filter |
Parameters
Vector store backend: chroma, qdrant, or pinecone
Operation: store, query, or delete
Collection/index name
Number of results for the query operation (1-100)
Single query vector for the query operation (from Embedding Generator)
Vector IDs to remove for the delete operation
ChromaDB persistence directory (chroma backend)
Qdrant server URL (qdrant backend)
Pinecone API key, passed as a node parameter (pinecone backend)
Store Operation
Input (from Embedding Generator) — pass bothembeddings and chunks:
Query Operation
Query with a precomputed embedding vector (embed your question first, then feed it here):distance for Chroma, score for Qdrant/Pinecone):
Complete RAG Pipeline Example
Workflow
Configuration
-
HTTP Scraper
- URL:
https://docs.example.com/api/{page} - Iteration Mode: page
- Link Selector:
a.pdf-link
- URL:
-
File Downloader
- Output Dir:
./downloads - Max Workers: 10
- Output Dir:
-
Document Parser
- Parser: pypdf
-
Text Chunker
- Strategy: recursive
- Chunk Size: 1000
- Overlap: 200
-
Embedding Generator
- Provider: huggingface
- Model: BAAI/bge-small-en-v1.5
-
Vector Store
- Backend: chroma
- Operation: store
- Collection: api-docs
Querying the Pipeline
Create a separate workflow for querying:Tips
Related
AI Agents
Use RAG context with AI agents
Webhooks
Trigger and respond over HTTP
AI Models
AI providers for generation
Schedulers & Triggers
Run the RAG pipeline on a schedule