Skip to content

feat: add premise fallback to Vercel schema selection#48

Merged
rlippmann merged 1 commit into
mainfrom
vercel-premise-example
Jul 6, 2026
Merged

feat: add premise fallback to Vercel schema selection#48
rlippmann merged 1 commit into
mainfrom
vercel-premise-example

Conversation

@rlippmann

Copy link
Copy Markdown
Owner

Summary

Adds premise-driven fallback schema selection to the Vercel AI SDK generateObject schema-selection example.

The example still selects schemas from explicit policy first:

  • use refund_intake
  • use technical_support

When no policy-selected schema exists, the host can now fall back to saved factual premise state:

  • damaged physical delivery premise -> refund_intake
  • digital subscription login failure premise -> technical_support

Schema selection remains host-owned and happens before generateObject runs.

Why

The generic schema-selection examples now demonstrate both policy-driven and premise-driven schema selection.

This keeps the Vercel AI SDK example aligned with that same-domain story and shows the runtime path:

authoritative state -> selected schema -> generateObject request

without deriving schema selection from model output.

Example metadata

  • Enforcement point: schema selection
  • Domain: customer order/support intake
  • Technology/runtime: Vercel AI SDK generateObject
  • Example type: minimal example
  • Does this use directive drafter? should normally be no: no
  • Does this derive state from model output? must be no for primary examples: no

Checklist

  • Repository scaffolding / governance change
  • One primary enforcement point
  • Explicit authoritative state
  • No model-derived state mutation
  • Adversarial stub or equivalent test
  • Observable runtime behavior change
  • Domain vocabulary is natural
  • Framework is secondary to the enforcement point
  • Docs updated
  • Tests/smoke checks added where practical

Notes

Validation performed:

  • cd typescript/examples/schema_selection/vercel_ai_sdk_generate_object && npm run build — passed
  • cd typescript/examples/schema_selection/vercel_ai_sdk_generate_object && npm run typecheck — passed
  • cd typescript/examples/schema_selection/vercel_ai_sdk_generate_object && npm test — passed, 15 passed, 1 skipped
  • ./scripts/validate_typescript_fast.sh — passed
  • npx --yes markdownlint-cli2 typescript/examples/schema_selection/vercel_ai_sdk_generate_object/README.md typescript/examples/schema_selection/README.md — passed
  • cd typescript/examples/schema_selection/vercel_ai_sdk_generate_object && RUN_VERCEL_AI_SDK_LIVE_MODEL=1 OPENAI_API_KEY="$OPENAI_API_KEY" npm test — passed, 16 passed

@rlippmann
rlippmann merged commit 16e1127 into main Jul 6, 2026
6 checks passed
@rlippmann
rlippmann deleted the vercel-premise-example branch July 6, 2026 05:02
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.

1 participant