Skip to main content

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.0a1 on PyPI and 0.1.0-alpha.1 on 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


Download files

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

Source Distribution

ppx_openai-0.1.0a2.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

ppx_openai-0.1.0a2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ppx_openai-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 063ed14480c96382a115ce068a25eb28b19b82d8fb9efd10f058763ce42670f9
MD5 d13b780c528f0b8390050f553b722d65
BLAKE2b-256 5e713be74f06fbf5c7bfca9022dea3a293ca3af5ba62fcc9d614fd4bbc86a485

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ppx_openai-0.1.0a2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for ppx_openai-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 44b46ffc1efc2382ddac5457e2fb5300cc3ff1284861de88c5963694a0693dbc
MD5 a9a67138d1e977e126afa857b3ae30be
BLAKE2b-256 ae36ae46f5f5c4f20befc2e4a8c83140fbd349367a1b02102c98e27c761e6061

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 Pingdom Monitoring Sentry Error logging StatusPage Status page