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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ppx_openai-0.1.0a4.tar.gz
Algorithm Hash digest
SHA256 2b61134e83fd84d5e7c278f791799e179a93ed622d704ab293f47b0d6ada5075
MD5 d2a5b5acdae1b976f9cc9eb1c290eadb
BLAKE2b-256 7bf785d77199aeefcaaac0f21ad39086aaee9e5d21b923aa46216f8723446f08

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ppx_openai-0.1.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 26d9cf935346771ec0612932f953564a563223808cb5f6566f842099c83b6d68
MD5 bbf56fe040823e63df97535a56e62bf5
BLAKE2b-256 9dd4ae4f1d98bc75e3073cfd7092ff3ef5d8ea1a3b0f3895c6f69480b95bb85c

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