Metadata-Version: 2.4
Name: ppx-openai
Version: 0.1.0a1
Summary: OpenAI Assistants API integration for the Preference Profile Exchange (PPX).
Project-URL: Homepage, https://blazing-customs.github.io/ppx-spec/
Project-URL: Documentation, https://github.com/Blazing-Customs/ppx-sdks/tree/main/python/ppx-openai#readme
Project-URL: Source, https://github.com/Blazing-Customs/ppx-sdks/tree/main/python/ppx-openai
Project-URL: Repository, https://github.com/Blazing-Customs/ppx-sdks
Project-URL: Issues, https://github.com/Blazing-Customs/ppx-sdks/issues
Project-URL: Changelog, https://github.com/Blazing-Customs/ppx-sdks/blob/main/CHANGELOG.md
Author: Blazing Customs
License: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: openai>=1.0.0
Requires-Dist: ppx-client>=0.1.0a1
Description-Content-Type: text/markdown

# ppx-openai

> OpenAI Assistants API integration for the [Preference Profile Exchange (PPX)](https://blazing-customs.github.io/ppx-spec/).

## Install

```bash
pip install ppx-openai
```

Requires Python 3.11+. Published version: **0.1.0a1** ([PyPI](https://pypi.org/project/ppx-openai/)).

> 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

```python
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.
