Skip to main content

langchain-ragmir

LangChain and LangGraph retrieval with exact citations, on your infrastructure.

Ragmir gives LangChain chains and agents cited local retrieval over a project's code, PDFs, Office files, scans, and more. Every document carries its citation, and a question the documents cannot answer returns nothing, so the agent can say so instead of guessing.

  • Any model: the index does not depend on the LLM that writes the answer, so you can switch between Claude, GPT, Gemini, Mistral, or a local model without re-indexing.
  • No GPU, no vector database: the default retrieval runs offline on the CPU, and the index is an embedded store in the project's git-ignored .ragmir/ folder.
  • Your data stays where you run it: no account, telemetry, or hosted store.
  • Measured: rgr evaluate scores retrieval on your own questions and fails CI when it regresses.
pip install langchain-ragmir

Requires Python 3.11 or later; Ragmir runs through Node.js 22.12 or later or Docker. See ragmir to index a project from Python, and the system requirements for semantic models and OCR.

Retriever

from langchain_ragmir import RagmirRetriever

retriever = RagmirRetriever(project_root="my-project", k=4, include_paths=["docs"])
for document in retriever.invoke("Who approves a production release?"):
    print(document.metadata["citation"], document.page_content)

Each document's metadata holds source, citation, context_path, line or page ranges, weak_evidence, and source_status when the file changed after indexing.

Agent tools

Let the agent decide what to search and which passages to read:

from langchain.agents import create_agent
from langchain_ragmir import RagmirToolkit

tools = RagmirToolkit(project_root="my-project").get_tools()
agent = create_agent(
    "anthropic:claude-sonnet-5-5",
    tools=tools,
    system_prompt="Answer from the project documents and cite every claim.",
)
agent.invoke({"messages": [{"role": "user", "content": "What is the refund policy?"}]})

ragmir_search answers with numbered citations and passage text, and keeps the documents as the tool message artifact; the model may add searches, its own keyword, paraphrase, or likely-answer formulations of the question. ragmir_expand reads a citation with its neighbours and the citation to read on, and answers a citation the index no longer holds with the nearest passage or the files with a close name. Retrievers and tools over the same project share one Ragmir server; pass client=ragmir.Ragmir(...) to manage it yourself.

Read the Python guide. Open source under AGPL-3.0-only, with a commercial license available from JCode Works.

Metadata

Release files for langchain-ragmir 6.17.2

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

Source distribution (sdist)

Source distribution for langchain-ragmir 6.17.2
File Size Uploaded Provenance Actions
langchain_ragmir-6.17.2.tar.gz 19.7 kB Without provenance Details for langchain_ragmir-6.17.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-ragmir 6.17.2
File Interpreter ABI Platform Actions
langchain_ragmir-6.17.2-py3-none-any.whl Python 3 none any Details for langchain_ragmir-6.17.2-py3-none-any.whl

Total release size: 39.8 kB

Release files / langchain_ragmir-6.17.2.tar.gz

Download URL langchain_ragmir-6.17.2.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c94d068615d53964eeffda7e9c5cebb44c8551f20d2900774947f68fef9e3368
BLAKE2b-256 checksum
How to use checksums
d5143ff11576cbdc04c0f178ccd03be4d79f77425f095caca46500ffe1a606c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / langchain_ragmir-6.17.2-py3-none-any.whl

Download URL langchain_ragmir-6.17.2-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d31842aeebac332cec517ba8cad4fd957ca3df0b4e40ef75b5bc73fca5858dd
BLAKE2b-256 checksum
How to use checksums
7ce9da41f8026093ff3795d66bdd0181ac34b665ef9a4d3e965b35d84d0657d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for langchain-ragmir 6.17.2

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.

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