Skip to main content

moca-reader-llamaindex

A LlamaIndex retriever over MOCA packages, built on the MOCA Reader for Python.

pip install moca-reader-llamaindex
from moca_reader import LexicalBackend, Library, Search, read_package
from moca_reader_llamaindex import MocaRetriever

pkg = read_package("support-kb.moca", trust_root="trust-root.json")
library = Library().add(pkg)
search = Search(library, LexicalBackend(library), audiences=["public"])

retriever = MocaRetriever(search, limit=3)
for result in retriever.retrieve("How long is the refund window?"):
    print(result.node.metadata["moca_node_ref"], result.score)
    print(result.node.get_content()[:80])

MocaRetriever wraps the Search you build: its backend (lexical, dense, hybrid or your own store), its audiences and its hooks. Every call goes through the Reader's gate, so content that is out of force, superseded, deprecated or outside your audiences never comes back, and nothing a caller passes can widen that. Use it anywhere LlamaIndex takes a retriever, such as a RetrieverQueryEngine.

Each result is a NodeWithScore holding a TextNode:

Field Holds
text The text of the node, or of a sidecar chunk
node_id The node's versioned reference and byte span
metadata["moca_citation"] The whole citation record: package, version and digest, trust signals, evidence
metadata["moca_*"] The flat fields of the consuming guide (moca_node_ref, moca_package_digest, moca_status, moca_signed, ...)
score The search score

The MOCA metadata keys are excluded from the text LlamaIndex sends to a model or an embedder, so they travel with the node without filling the prompt.

Package text is untrusted input. Present it to a model as quoted reference material to cite, never as instructions (Reader contract §12). Show users the source (moca_node_ref, the package version) with each answer.

Licence

Apache-2.0.

Metadata

Release files for moca-reader-llamaindex 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moca-reader-llamaindex 0.6.0
File Size Uploaded Provenance Actions
moca_reader_llamaindex-0.6.0.tar.gz 4.0 kB Without provenance Details for moca_reader_llamaindex-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for moca-reader-llamaindex 0.6.0
File Interpreter ABI Platform Actions
moca_reader_llamaindex-0.6.0-py3-none-any.whl Python 3 none any Details for moca_reader_llamaindex-0.6.0-py3-none-any.whl

Total release size: 7.8 kB

Release files / moca_reader_llamaindex-0.6.0.tar.gz

Download URL moca_reader_llamaindex-0.6.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1ce05ca1dbaa68b8c0c9a0f82aa00695453b87bc3171606007947f2f27a68ad8
BLAKE2b-256 checksum
How to use checksums
a3230306c0fa11858e5de9f764805a169a51f924a78931ba7169ff0fa9f3311f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / moca_reader_llamaindex-0.6.0-py3-none-any.whl

Download URL moca_reader_llamaindex-0.6.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc76a859c9de568abb688cd73490baf5435482a5e63aca133e454b31bb3f4306
BLAKE2b-256 checksum
How to use checksums
e28a0abaf5072035f4133cc1a02235c29dca0acbf4a80f5b93933cdc9bb657be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for moca-reader-llamaindex 0.6.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.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page