Skip to content

Add openai-360: a warranty claims desk on six OpenAI endpoints - #11

Open
pierrebrunelle wants to merge 1 commit into
mainfrom
pierre/openai-360
Open

pierrebrunelle wants to merge 1 commit into
mainfrom
pierre/openai-360

Conversation

@pierrebrunelle

Copy link
Copy Markdown
Member

A warranty claim arrives as a photo and a voice note. openai-360/app.py runs six OpenAI endpoints in one table:

Column Call
transcript openai.transcriptions()
flagged openai.moderations()
triage, then damaged, consistent, cause, severity openai.decisions(): four questions about the transcript and photo in one request
route route_claim(): approve, review or escalate
reply_text openai.responses(), approved claims only
voice_reply openai.speech()
index on transcript openai.embeddings(), for similar_claims()

reply_prompt() returns None unless the claim is approved, and a None argument skips the call, so a claim sent to review never reaches responses() or speech(). seed.py generates four demo claims with image_generations() and speech().

Version floors

decisions() needs pixeltable 0.7.22. tests/test_config.py requires one floor across apps that matches each lockfile, so chat-agent and video-search move to >=0.7.23 too. Their relock changes only pixeltable and pixeltable-pgserver.

Verified

Live against OpenAI, in an isolated Pixeltable home:

               product    route  damaged  consistent
0               laptop   review     0.00        0.00
1           smartphone  approve     1.00        0.95
2  wireless headphones  approve     1.00        0.96
3         coffee maker   review     0.04        0.51
  • Replies and voice replies exist only for the two approved claims. pxt errors reports no failed cells.
  • pxt describe, computed, history and the dashboard's Lineage tab show each column with its call.
  • After loosening route_claim(), pxt recompute claims/claims route -f approved the coffee maker and generated its reply. Restoring the gate cleared it.
  • POST /api/claims (multipart photo and mp3), GET /api/review and POST /api/similar answered over HTTP.
  • On Python 3.12: ruff, pytest tests/ (80 passed, 1 skipped), pytest tests/test_schema.py --run-slow, and pxt schema update then pxt schema diff for all three apps on 0.7.23.

Not covered

  • The Docker image was not built.
  • The weekly app-smoke job does not run this app; it would need an OPENAI_API_KEY secret.
  • .devcontainer/cloud.sh and uvx pixeltable-new do not know this app, so it is clone only.

A warranty claim arrives as a photo and a voice note. One computed-column
chain transcribes it, runs moderation, asks the Decisions API four questions
about the transcript and photo, routes the claim, and drafts and speaks a reply
only for approved claims. A null prompt skips responses() and speech() for the
rest. An embedding index on the transcript backs similar-claim search. seed.py
generates four demo claims with image_generations() and speech().

decisions() needs pixeltable 0.7.22, and the kit holds one floor that matches
each lockfile, so chat-agent and video-search move to 0.7.23 as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The seed script files claims for all stored demo inputs rather than only newly inserted ones, causing duplicate claims and repeated paid API calls on subsequent runs.

1 open issue
What changed in this PR

Adds openai-360 as the starter kit’s third single-file app: a warranty claims desk that processes photos and voice notes through six OpenAI endpoints.

Changes:

  • Adds claim triage, approval-gated text and voice replies, similarity search, and HTTP routes.
  • Provides synthetic demo inputs, deployment configuration, and usage documentation.
  • Extends CI and structural checks to the new app and aligns Pixeltable dependencies across apps.
File Description
video-search/​uv.lock Updates Pixeltable and its PostgreSQL server dependency.
video-search/​pyproject.toml Raises the Pixeltable minimum version.
tests/​test_structure.py Includes the new app in structural checks.
tests/​test_schema.py Adds the new app’s schema import smoke check.
tests/​conftest.py Registers the app and its required files.
README.md Introduces the claims app and quickstart.
openai-360/​seed.py Generates and files four synthetic demo claims.
openai-360/​README.md Documents processing, inspection, HTTP, and deployment.
openai-360/​pyproject.toml Defines dependencies and Python modules.
openai-360/​pixeltable.toml Declares the Pixeltable project configuration.
openai-360/​Dockerfile Packages schema application and foreground serving.
openai-360/​docker-compose.yml Configures service access, API credentials, and persistence.
openai-360/​app.py Defines claim processing, demo models, queries, and routes.
openai-360/​.dockerignore Excludes local artifacts from Docker builds.
CONTRIBUTING.md Includes the app in lint commands.
chat-agent/​uv.lock Updates Pixeltable and its PostgreSQL server dependency.
chat-agent/​pyproject.toml Raises the Pixeltable minimum version.
AGENTS.md Updates app layout and validation instructions.
.github/​workflows/​test.yml Adds lint, import, and schema application checks for the app.

Review effort: Balanced

Comment thread openai-360/seed.py
Comment on lines +35 to +37
app.DemoInputs.insert(DEMO_CLAIMS)
demo = app.DemoInputs.select(app.DemoInputs.product, app.DemoInputs.photo, app.DemoInputs.voice_note)
app.Claims.insert(list(demo.collect()))

@pierrebrunelle pierrebrunelle left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 15824a3..46ef51d against installed pixeltable 0.7.23.

No blocking issues. Verified the whole API surface on the installed package rather than trusting the floor: decisions (question shapes, answers[i].probability/choice/score, the refusal type degrading through your None -> review path), moderations (results[0].flagged), transcriptions (.text), responses, speech (-> pxt.Audio), image_generations (data: list[PIL.Image], so .data[0] is a real image), embeddings.using, pxt.Column(value=pxtf.uuid.uuid7(), primary_key=True). All present with matching signatures.

The null-propagation design is correct end to end: a NULL transcript short-circuits moderations, reply_prompt returning None skips responses(), and NULL reply_text skips speech() — the "approved only" cost claim in the README is real. Dockerfile layering (--no-install-project first), the bare OPENAI_API_KEY compose pass-through, and the service run vs service update comment are all right. CI/tests/docs extended consistently.

Limits: did not run the app (no OPENAI_API_KEY); uv.lock not audited line-by-line; trusting the body's live verification for gpt-6-luna/gpt-image-2 availability.

Comment thread openai-360/app.py

TableModel = pxt.model_base()

MODEL = "gpt-6-luna"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MODEL reads like it governs the app's model choices; it feeds only decisions(). DECISION_MODEL, or inline it like the six other calls?

Comment thread openai-360/seed.py
app.TableModel.bind_all(target)
app.DemoInputs.insert(DEMO_CLAIMS)
demo = app.DemoInputs.select(app.DemoInputs.product, app.DemoInputs.photo, app.DemoInputs.voice_note)
app.Claims.insert(list(demo.collect()))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running seed.py twice files the four claims twice. Worth a one-line note in the docstring (demo input, not idempotent), or a count check?

Comment thread openai-360/app.py
questions=QUESTIONS,
model=MODEL,
)
damaged = triage.answers[0].probability

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

triage.answers[i] can have type == 'refusal' with no value — your columns land as NULL and route to review, which is the right degradation. A comment saying so would save the next reader the trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants