Skip to main content

langchain-amu

LangChain integration for amu-pgvector: a VectorStore and Retriever backed by lineage-gated Analytical Memory Units on PostgreSQL + pgvector, part of a reference implementation of Lineage-Aware Memory Governance (Sangaraju & Vissa, IEEE Access, 10.1109/ACCESS.2026.3730363).

Every read runs under the store's own Postgres role, so row-level security gates LangChain retrieval exactly the same way it gates raw SQL or the MCP server — there is no separate access-control path to keep in sync.

Full project docs, the SQL schema, and benchmarks live in the main repository: https://github.com/sangaraju1988/amu-pgvector

Install

pip install langchain-amu

This depends on and reuses amu-pgvector's client. You'll also need the schema installed in Postgres — see the 60-second quickstart in the main README.

Quickstart

from amu_pgvector import AMUStore
from langchain_amu import AMUVectorStore, AMURetriever
from langchain_core.embeddings import DeterministicFakeEmbedding

store = AMUStore("postgresql://finance_agent:finance_pw@localhost:5433/amu_dev")
embedding = DeterministicFakeEmbedding(size=1536)  # swap for a real embeddings model

vectorstore = AMUVectorStore(store, embedding)
vectorstore.similarity_search("average customer income", k=5)

retriever = AMURetriever(vectorstore=vectorstore, k=5)
retriever.invoke("average customer income")

A restricted role (one never granted the sensitive column a cached result was derived from) gets nothing back from similarity_search, max_marginal_relevance_search, or the retriever — enforced by Postgres, not by this library.

What's in this package

  • AMUVectorStore(VectorStore) -- similarity_search, similarity_search_by_vector, max_marginal_relevance_search, add_texts/add_documents (with ids=[...] upsert), delete, get_by_ids. Document.metadata carries metric_name, owner_department, definition_hash, and value alongside whatever metadata the caller supplied.
  • AMURetriever(BaseRetriever) -- wraps an AMUVectorStore.

Tested against LangChain's own standard VectorStoreIntegrationTests suite; see the main repo's docs/design.md for the handful of tests that don't apply here and why (every AMU necessarily exposes governance fields in Document.metadata, which conflicts with a few of the suite's generic exact-metadata-echo assertions — content, ids, add/delete/mutate/search all genuinely work).

Release files for langchain-amu 0.1.3

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-amu 0.1.3
File Size Uploaded
langchain_amu-0.1.3.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-amu 0.1.3
File Interpreter ABI Platform
langchain_amu-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / langchain_amu-0.1.3.tar.gz

Download URL langchain_amu-0.1.3.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
52428d68ab08dbc309d05260db7cf5eaf08c8b3862057ee2379302bf7e4bb64b
BLAKE2b-256 checksum
How to use checksums
6665e6ef5142a248d0c8ae677600cc52a053cd10dc9f4da36c6da3e6bec26902
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / langchain_amu-0.1.3-py3-none-any.whl

Download URL langchain_amu-0.1.3-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da2834f059be91b433d465e70f34d916066e9b226c79a741a3aa0944f92bbeef
BLAKE2b-256 checksum
How to use checksums
48b7ee0d30d5760da0432bee18dea35bff53cd5e7558231bb0d6e4b23f94d882
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

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