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.0a4.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.0a4-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ppx_langchain-0.1.0a4.tar.gz
Algorithm Hash digest
SHA256 814b3b1c77309798db466d1dbb090e778c0916a3e360707f8baf0c9aba609268
MD5 d32dc4d1dfc165586d10fa11c4366243
BLAKE2b-256 aafc9d1fb0ce146f82b6ca28ee60afc42f871c93d1af7da87cb91573e32170a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppx_langchain-0.1.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 4f4de12980b35eda44d7c88b6f0a1ea28992cf51f1f8beba6883e36f46ac3c07
MD5 c458858f8717bca6010daae50c6b0252
BLAKE2b-256 1d2e220ea15c2067789f307edfefd7f30e5669c0e80350f6d5cac7c8a7427637

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