llama-index-maskena
LlamaIndex integration for Maskena: load documents with hidden text and personal data removed, and stop prompt injection in retrieved nodes before they reach the LLM.
| Component | Where it goes | What it does |
|---|---|---|
MaskenaReader |
Ingestion | Loads files through RAG sanitization: only safe content, already split into chunks |
MaskenaNodePostprocessor |
Query engine | Drops dangerous retrieved nodes; cleans suspicious ones (indirect prompt injection) |
Installation
pip install llama-index-maskena
export MASKENA_API_KEY="sfk_..." # create a key in the dashboard, under API
Requires Python 3.11 or later and llama-index-core 0.14.
Quickstart
from llama_index.core import VectorStoreIndex
from llama_index_maskena import MaskenaNodePostprocessor, MaskenaReader
documents = MaskenaReader().load_data(["contract.pdf", "manual.docx"])
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine(node_postprocessors=[MaskenaNodePostprocessor()])
response = query_engine.query("How long do refunds take?")
Loading documents
MaskenaReader sends each file to Maskena's RAG sanitization. Hidden text (white, microscopic, off-page or covered by
other elements) is removed based on how each page renders, and malicious sentences are removed according to policy:
reader = MaskenaReader(policy="redact", ocr="auto", chunk_size=1200, chunk_overlap=150, personal_data=True)
documents = reader.load_data("contract.pdf", extra_info={"tenant": "acme"})
documents = await reader.aload_data(["a.pdf", "b.pdf"]) # files processed in parallel
Each chunk becomes a Document with file_path, file_name, page_start, page_end, maskena_risk,
maskena_status and maskena_job_id in its metadata. The Maskena keys are excluded from the text sent to the LLM and
to the embedding model. Chunks in quarantine (policy="drop") are not returned.
Guarding retrieved nodes
Documents in an index can carry instructions planted by whoever wrote them. MaskenaNodePostprocessor checks every
retrieved node before the LLM reads it:
dangerousnodes are dropped;suspiciousnodes continue with the clean version (dangerous passages removed, personal data replaced by placeholders such as[EMAIL 1]);- kept nodes carry
maskena_verdict,maskena_scoreandmaskena_cleanedin their metadata.
MaskenaNodePostprocessor(block_on="flagged") # also drop suspicious nodes
MaskenaNodePostprocessor(use_clean_text="always") # remove personal data from every node
MaskenaNodePostprocessor(max_concurrency=8) # parallel checks in async query engines
| Option | Values | Default |
|---|---|---|
block_on |
"dangerous", "flagged" (also suspicious), "never" |
"dangerous" |
use_clean_text |
"flagged", "always", "never" |
"flagged" |
Texts longer than 32,000 characters are split and checked in parts.
Configuration and costs
MaskenaNodePostprocessor(api_key="sfk_...", base_url="https://maskena.com", language="en", depth="standard")
Each retrieved node uses one text check from the monthly quota, and MaskenaReader uses one RAG page per page. To
reuse a configured client, pass client=maskena.Maskena(...) and async_client=maskena.AsyncMaskena(...).
Links
License
MIT
Metadata
Release files for llama-index-maskena 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llama_index_maskena-0.1.0.tar.gz | 11.0 kB | Without provenance | Details for llama_index_maskena-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_maskena-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for llama_index_maskena-0.1.0-py3-none-any.whl |
Total release size: 20.0 kB
Release files / llama_index_maskena-0.1.0.tar.gz
| Download URL | llama_index_maskena-0.1.0.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11784f61023745558f268e6d657f98b06b7a0190656a4871ca60f54cf0cc817e
|
|
BLAKE2b-256 checksum How to use checksums |
652fa2d85e7f4ee72f0fc5dc5511b9cb0d9cb40aba7b1b87635161d13a8e4578
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.9
|
Release files / llama_index_maskena-0.1.0-py3-none-any.whl
| Download URL | llama_index_maskena-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4f1cfb3835f34ea1e93e05a958066203b30f3f16f606729a05693c973df45d4
|
|
BLAKE2b-256 checksum How to use checksums |
43204f62fb6b25badba00c36b36b5d044220f6ab17b19728c9756ccf60a920bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.9
|
Security for llama-index-maskena 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.