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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ppx_langchain-0.1.0a2.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ppx_langchain-0.1.0a2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file ppx_langchain-0.1.0a2.tar.gz.

File metadata

  • Download URL: ppx_langchain-0.1.0a2.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for ppx_langchain-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 5265a95823f9ddf5e7c50843f2042a18543387678e0c43ce033be58604283aee
MD5 14c5d0098248203768f842d7be274df0
BLAKE2b-256 e2cecd2ae6cb2a06cdb1aaad45b7a2e657c19ff4d54f9c1eaaa63ffd56402422

See more details on using hashes here.

File details

Details for the file ppx_langchain-0.1.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for ppx_langchain-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 1cd79898dc45cfbe519a9d88d0046b1642454047ead4d8df26291fffdb7632c7
MD5 8a170ec877b84419e1d15f9be3683e84
BLAKE2b-256 a5f1da434f5166f45c5107828526b4fcb409f69227b4a306f28833ba287e576a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page