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.0a1on PyPI and0.1.0-alpha.1on 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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ppx_langchain-0.1.0a1.tar.gz.
File metadata
- Download URL: ppx_langchain-0.1.0a1.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d6c438d48e4f61a55d725319fc5aab1d53a66f498037ac52a05592375a47b06
|
|
| MD5 |
0d268d83a9f8fd237695a51b63b5f7c1
|
|
| BLAKE2b-256 |
bdbb11d206298ba8cc6a02847299c6a566efc595050b7c5bd40843952ab8a82f
|
File details
Details for the file ppx_langchain-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: ppx_langchain-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a66c00c718c6351fff92a1b4e639c8a3cbb79bf8f164888ca7f278cc9ecd3b78
|
|
| MD5 |
7002d0939053c2d07057605a9f3721fd
|
|
| BLAKE2b-256 |
07ee3b73c15c50860b00ea3a889469b5c7bddacf97ced8f9fb1fe7c50b333cd6
|