Checked at the door
Structured output is parsed against the calling feature’s own schema before any code sees it. Broken output fails loudly rather than leaking into a record.
Elk modelantwoord wordt tegen een schema gecontroleerd voordat het wordt gebruikt.
Gespreksextractie, Ask Growth Kit, contentconcepten en profielonderzoek bereiken een model via één serverfunctie. Het antwoord komt terug, ontleed tegen het schema dat dat onderdeel opgaf, zodat onbruikbare uitvoer al bij de grens sneuvelt in plaats van in een record te belanden. Sleutels blijven op de server, en welk model een onderdeel gebruikt is één regel instelling.
Interactief voorbeeld
Deze rondleiding toont het geïmplementeerde backendcontract zonder account, credentials of providercalls.
Interactief voorbeeld
Alleen deterministische voorbeelddata. De interactie gebruikt geen account-, provider- of netwerkverbinding.
Kernpunten
Structured output is parsed against the calling feature’s own schema before any code sees it. Broken output fails loudly rather than leaking into a record.
Provider credentials live in server environment variables. Nothing AI-related ships to the browser, and the browser talks only to authenticated routes.
config/ai.ts maps each feature key to a provider and model. Changing a model never touches the feature that uses it.
Zonder een gedeelde basis bouwt elk team deze randgevallen opnieuw, en anders.
A model returns something that is nearly the right shape and the code trusts it. The failure shows up later, inside a record someone relies on. Parsing at the boundary makes the failure immediate and obvious.
Model calls get added wherever it is convenient. One lands client-side and the credential ships to every visitor. Here the adapters are server-only, so there is nowhere for that to happen.
A provider retires a model and the change becomes a search across the codebase. Here it is one route entry, and every caller keeps its own key.
Het mechanisme van begin tot eind, zoals het in de repository is geïmplementeerd.
A feature calls with its own key
Server code asks for text or a structured object, tagged with a feature key such as fast, default or reasoning. Configuration decides which provider and model handle it.
The call runs on the server
The matching OpenAI, Gemini or Anthropic adapter runs with server credentials. Every route in config/ai.ts points at OpenAI today.
The answer is parsed at the boundary
Structured output is requested from the provider and then parsed with the declared schema before returning. Invalid output throws rather than passing through.
The caller gets a typed result
The feature receives a clean object plus token usage, provider and model, so cost and routing are observable without a raw string to re-parse.
Technische garanties
Drie provideradapters zijn aangesloten en er valt niets vanzelf over als er een uitvalt. Modeluitvoer is een concept dat een mens accepteert, nooit een feit op zichzelf, en deze pagina kan geen nauwkeurigheid beloven. Of een generatie überhaupt wordt aangenomen, hangt af van het recht van de werkruimte dat onder verbruikslimieten staat beschreven.
De grens hierboven is geen claim maar code. Deze bestanden dragen het contract:
src/features/ai/runtime.tssrc/features/ai/contracts.tsconfig/ai.tsDeze functies delen contracten en grenzen met deze pagina.
De documentatie beschrijft dezelfde contracten die deze pagina demonstreert.