Document Classification Pipeline
Classify documents into custom business categories using layout-aware extraction and taxonomy enrichment. Handles invoices, contracts, reports, forms, and correspondence by analyzing both textual content and visual document structure.
from mixpeek import Mixpeekclient = Mixpeek(api_key="YOUR_API_KEY")# Create taxonomy for document typestaxonomy = client.taxonomies.create(namespace_id="ns_your_namespace",name="document_types",taxonomy_type="hierarchical",hierarchy=[{"node_id": "invoice", "collection_id": "col_invoice_examples"},{"node_id": "contract", "collection_id": "col_contract_examples"},{"node_id": "report", "collection_id": "col_report_examples"},{"node_id": "form", "collection_id": "col_form_examples"},{"node_id": "correspondence", "collection_id": "col_letter_examples"},])# Create document collection with layout extractioncollection = client.collections.create(namespace_id="ns_your_namespace",name="incoming_documents",extractors=["document-graph-extractor", "text-extractor"])# Apply taxonomy for automatic classificationclient.collections.apply_taxonomy(collection_id="col_incoming_documents",taxonomy_id=taxonomy["taxonomy_id"])# Upload documents for classificationclient.buckets.upload(bucket_id="bkt_docs", url="s3://your-bucket/incoming/")# Query classified documentsdocs = client.documents.list(collection_id="col_incoming_documents",filters={"taxonomy_enrichment.category": "invoice"})print(f"Found {len(docs['results'])} invoices")
Feature Extractors
Retriever Stages
aggregate
Compute aggregations (COUNT, SUM, AVG, etc.) on pipeline results
Use Cases Using This Recipe
Clinical NLP at Scale
Extract structured intelligence from clinical notes, pathology reports, and medical records
94% F1 on medical NER benchmarks
Entity extraction accuracy
Healthcare IT teams, clinical informatics departments, and health systems processing thousands of clinical documents daily
Related Recipes & Resources
Explore these related resources to deepen your understanding and discover more powerful features
Multimodal Content Moderation
Automated content moderation pipeline that analyzes text, images, and video for policy violations. Uses hierarchical taxonomy classification to label content as safe, sensitive, or prohibited across multiple categories simultaneously.
Document Intelligence Search
Extract and search through PDFs, presentations, and documents. Combines OCR, layout analysis, and semantic search for comprehensive document retrieval.
PDF Data Extraction Pipeline
Extract structured data from PDFs including tables, forms, and text. Convert unstructured documents into structured, queryable data.
Document RAG Pipeline
Retrieval-augmented generation for document collections. Extracts text, tables, and figures from PDFs using OCR and layout analysis, then retrieves relevant page sections to answer natural language questions with precise page and section citations.
BYO Embeddings Vector Search
Bring pre-computed embeddings from any provider (OpenAI, Cohere, Together, etc.) and upsert them directly into MVS for instant vector search. No feature extractors, no pipelines -- just embeddings in, results out.
Web Scraper
Extract structured data from webpages while maintaining semantic context and relationships