Skip to main content

Eunomia extension for LangChain

This package provides an extension of Eunomia for LangChain, allowing you to:

Installation

Install the eunomia-langchain package via pip:

pip install eunomia-langchain

Usage

Document Loader

The EunomiaLoader class is a wrapper around any loader class from LangChain that sends documents to the Eunomia server.

from eunomia_langchain import EunomiaLoader
from langchain_community.document_loaders.csv_loader import CSVLoader

# Create a document loader
loader = CSVLoader("data.csv")

# Wrap the loader with Eunomia
wrapped_loader = EunomiaLoader(loader)

# Load documents and register them with the Eunomia server
docs = wrapped_loader.load(additional_metadata={"group": "financials"})

All loaded documents will be automatically sent to the Eunomia server which will assign an identifier to each document and store their metadata. The identifiers and metadata can then be used to configure or reference policies in the Eunomia server.

Document Retriever

The EunomiaRetriever class wraps any LangChain retriever and filters allowed documents using the Eunomia server.

from eunomia_core import schemas
from eunomia_langchain import EunomiaRetriever
from langchain_community.retrievers import BM25Retriever
from langchain_core.documents import Document

# Create a retriever with some documents
retriever = BM25Retriever.from_documents([
    Document(page_content="foo", metadata={"confidentiality": "public"}),
    Document(page_content="bar", metadata={"confidentiality": "public"}),
    Document(page_content="foo bar", metadata={"confidentiality": "private"}),
])

# Wrap the retriever with Eunomia
wrapped_retriever = EunomiaRetriever(
    retriever=retriever,
    principal=schemas.PrincipalCheck(uri="test-uri"),
)

# Only documents the principal has access to will be returned
docs = wrapped_retriever.invoke("foo")

Documentation

For detailed usage, check out the SDK's documentation.

Metadata

Release files for eunomia-langchain 0.3.10

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

Source distribution (sdist)

Source distribution for eunomia-langchain 0.3.10
File Size Uploaded Provenance
eunomia_langchain-0.3.10.tar.gz 3.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for eunomia-langchain 0.3.10
File Interpreter ABI Platform
eunomia_langchain-0.3.10-py3-none-any.whl Python 3 none any Details

Total release size: 8.6 kB

Release files / eunomia_langchain-0.3.10.tar.gz

Download URL eunomia_langchain-0.3.10.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
450007c62d47f0accf8c7928be3f46df533fcfe7beaeb6f24d940b1b400b6019
BLAKE2b-256 checksum
How to use checksums
db5dadce4781b6e6ceef997d5cfc7de8239139228a57accf664bd7f9aff0347f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Release files / eunomia_langchain-0.3.10-py3-none-any.whl

Download URL eunomia_langchain-0.3.10-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55588cb216e78330d3ed93a49476d6211ef82ace22bf8ac1d5ded2e606b3bee5
BLAKE2b-256 checksum
How to use checksums
ff6273d6c25291f8bae0bf201697b95b392200749e723f1f5a9eecffd7ec7f41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Security for eunomia-langchain 0.3.10

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