Skip to main content

moca-reader-langchain

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

pip install moca-reader-langchain
from moca_reader import LexicalBackend, Library, Search, read_package
from moca_reader_langchain 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=search, limit=3)
for doc in retriever.invoke("How long is the refund window?"):
    print(doc.metadata["moca_node_ref"], doc.metadata["moca_score"])
    print(doc.page_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. limit, locale, concepts, scope and include_all are set when you build the retriever.

Each result is a LangChain Document:

Field Holds
page_content The text of the node, or of a sidecar chunk
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, ...), for vector stores that need flat metadata
metadata["moca_score"] The search score

Package text is untrusted input. Put page_content in a prompt 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.

The async path (ainvoke) runs the same search.

Licence

Apache-2.0.

Metadata

Release files for moca-reader-langchain 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-langchain 0.6.0
File Size Uploaded Provenance Actions
moca_reader_langchain-0.6.0.tar.gz 4.0 kB Without provenance Details for moca_reader_langchain-0.6.0.tar.gz

Built distribution (wheel)

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

Total release size: 7.7 kB

Release files / moca_reader_langchain-0.6.0.tar.gz

Download URL moca_reader_langchain-0.6.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cf0e62ef27bbcb0ff4730f12428ca6f8111c3f88ec628afa02d6ea008b7be310
BLAKE2b-256 checksum
How to use checksums
ee7256c8d4f4f8a13d2cbb922ac8abdda33c07ccfc72fa32f8e63780c46e0a65
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_langchain-0.6.0-py3-none-any.whl

Download URL moca_reader_langchain-0.6.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71460deebeb120e7f5d204d658426d5d98366f2a33d155ddf1a3e5d3e1fdd453
BLAKE2b-256 checksum
How to use checksums
7e0918a4cca694c0d9ea54229c2fa4575f991ed9e0d435a883fb92fc17c2219e
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-langchain 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