OpenAI Assistants API integration for the Preference Profile Exchange (PPX).
Project description
ppx-openai
OpenAI Assistants API integration for the Preference Profile Exchange (PPX).
Install
pip install ppx-openai
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.
Assistants API — minimal example
from openai import OpenAI
from ppx_client import PpxClient
from ppx_openai import ppx_tool_schema, handle_run
oai = OpenAI()
ppx = PpxClient("https://api.provider.app")
assistant = oai.beta.assistants.create(
name="scent-advisor",
model="gpt-4o-mini",
instructions=(
"Recommend fragrances. Use lookup_user_preference before suggesting "
"anything opinionated — the user's PPX profile has their preferences."
),
tools=[ppx_tool_schema()],
)
thread = oai.beta.threads.create()
oai.beta.threads.messages.create(
thread_id=thread.id, role="user",
content="Suggest something for a hot, humid evening.",
)
run = oai.beta.threads.runs.create(thread_id=thread.id, assistant_id=assistant.id)
# Handler loops over requires_action → tool output → continue
final = handle_run(
thread_id=thread.id,
run=run,
openai_client=oai,
ppx_client=ppx,
grant_token=my_grant_token,
)
messages = oai.beta.threads.messages.list(thread_id=thread.id)
print(messages.data[0].content[0].text.value)
Every tool call routes through the same grant-scoped read path as the browser flow. The model can never see claims the user didn't authorize.
License
Apache-2.0.
Project details
Release history Release notifications | RSS feed
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_openai-0.1.0a1.tar.gz.
File metadata
- Download URL: ppx_openai-0.1.0a1.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9a6f629b26fc23134da6ee1da620da176157259edab35d122564a4dd998ab0a
|
|
| MD5 |
364a20d01072aed034ad6733b9132464
|
|
| BLAKE2b-256 |
b7fb4c48b11613997d83dd4cb4c65a8dcac5c1b6744777960f0321d5f92f602b
|
File details
Details for the file ppx_openai-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: ppx_openai-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 8.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 |
d728b7ed5895e8463093b798e3b244f37ff8377265ebe09a5537321e8fe819e1
|
|
| MD5 |
a3f510604786a16d172abd3717d0a6e7
|
|
| BLAKE2b-256 |
b59582acdee95a81724e9990695be0a95ff940d2ffc80e67c01b79076f4c7ab7
|