Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ppx-langchain

LangChain integration for the Preference Profile Exchange (PPX).

Install

pip install ppx-langchain

Requires Python 3.11+. Published version: 0.1.0a1 (PyPI).

Alpha, tracking a draft specification. Expect breaking changes. The version is 0.1.0a1 on PyPI and 0.1.0-alpha.1 on npm — the same release in each ecosystem's required format.

Pulls in ppx-client and langchain-core. No LangChain models are required — bring your own (OpenAI, Anthropic, Ollama, etc.).

Three ways to use PPX in a LangChain app

1. As a document loader — load claims once

from ppx_client import PpxClient
from ppx_langchain import PpxClaimLoader

client = PpxClient("https://api.provider.app")
loader = PpxClaimLoader(client, user_token=my_keycloak_token)
docs = loader.load()  # one Document per claim

2. As a retriever — query claims per question

from ppx_langchain import PpxRetriever

retriever = PpxRetriever(
    client=client,
    grant_token=my_grant_token,
    default_context={"climate": "hot_humid"},
    requested_namespaces=["core", "fragrance"],
)

docs = retriever.invoke("What scent profile suits this user?")

3. As a tool — let the agent call it

from langchain_openai import ChatOpenAI
from ppx_langchain import ppx_preference_tool

llm = ChatOpenAI(model="gpt-4o-mini")
tool = ppx_preference_tool(client, grant_token=my_grant_token)
agent = llm.bind_tools([tool])

response = agent.invoke(
    "Recommend a fragrance. Use lookup_user_preference to check core + fragrance traits."
)

Every read is grant-scoped. The agent can never see claims the user's grant doesn't permit.

License

Apache-2.0.

Metadata

Release files for ppx-langchain 0.1.0a4

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

Source distribution (sdist)

Source distribution for ppx-langchain 0.1.0a4
File Size Uploaded
ppx_langchain-0.1.0a4.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ppx-langchain 0.1.0a4
File Interpreter ABI Platform
ppx_langchain-0.1.0a4-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / ppx_langchain-0.1.0a4.tar.gz

Download URL ppx_langchain-0.1.0a4.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
814b3b1c77309798db466d1dbb090e778c0916a3e360707f8baf0c9aba609268
BLAKE2b-256 checksum
How to use checksums
aafc9d1fb0ce146f82b6ca28ee60afc42f871c93d1af7da87cb91573e32170a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / ppx_langchain-0.1.0a4-py3-none-any.whl

Download URL ppx_langchain-0.1.0a4-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f4de12980b35eda44d7c88b6f0a1ea28992cf51f1f8beba6883e36f46ac3c07
BLAKE2b-256 checksum
How to use checksums
1d2e220ea15c2067789f307edfefd7f30e5669c0e80350f6d5cac7c8a7427637
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3
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