feat(examples): a runnable Next.js example that needs no API key - #8
Merged
Conversation
The repo had nothing a visitor could run. Evaluating the library meant wiring a provider into your own app first, which is the wrong order — the behaviour has to be visible before anyone invests that. `examples/next` is a real job-posting form: prose fills it, follow-up instructions patch it. It runs with zero configuration because `complete` is caller-supplied, so the example ships a deterministic offline pattern matcher for the no-key case. That matcher is NOT a language model and the UI says so in plain words — it exists so the library's own contribution (merge intent, sanitizing, field discipline) is visible without a provider in the way. Set GROQ_API_KEY or OPENAI_API_KEY for real model behaviour. Verified end to end against the running example: - fill from one sentence -> 9 fields set, salary parsed as 130000-160000 - "make it principal" -> changed == ["seniority"], everything else survives - "set the posting id" -> postingId unchanged; it is aiExcluded - unknown target -> rejected before any model call Root package unaffected: 14/14 tests green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The repo had nothing a visitor could run. Evaluating ai-forms meant wiring a provider into your own app first — the wrong order, since the behaviour has to be visible before anyone invests that.
examples/nextis a real job-posting form: prose fills it, follow-up instructions patch it.It runs with zero configuration.
completeis caller-supplied, so the example ships a deterministic offline pattern matcher for the no-key case. That matcher is not a language model and the UI says so in plain words — it exists so the library's own contribution (merge intent, sanitizing, field discipline) is visible without a provider in the way. SetGROQ_API_KEYorOPENAI_API_KEYfor real model behaviour.Verified against the running example
changed["seniority"]["title"]postingIdunchanged —aiExcludedholdssecret_admin_formRoot package untouched: 14/14 tests green.
🤖 Generated with Claude Code