Add OpenAI Autofix example - #1193
Open
ankur-mittal95 wants to merge 5 commits into
Open
ankur-mittal95 wants to merge 5 commits into
ankur-mittal95 wants to merge 5 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What
Add a runnable AgentInterface example that generates UI with OpenAI directly and automatically repairs invalid OpenUI Lang through Autofix. A natural-language prompt streams into an interface; valid output skips repair, and repaired output replaces the preview in the same assistant reply.
Changes
examples/miscellaneous/autofix, using the OpenAI SDK withOPENAI_API_KEYand configurableOPENAI_MODEL(defaultgpt-4.1-mini). Autofix uses a separateTHESYS_API_KEY.fetchLLM()andagUIAdapter()with standard AG-UI SSE events. Keep request-scoped cancellation and incomplete-stream guards, and use a message-format hook to forward final UI code as history.The API documentation fixes are already merged in #1200. This PR changes only files under
examples/.Test Plan
npm run verify: generated spec, ESLint, 36 tests, TypeScript, and production Next.js build passed.Headingrepaired toHeader, output passed local validation, and valid input returned unchanged with zero model tokens.31d2d37.Tests exercise the real OpenAI SDK, parser, renderer, and HTTP route with stubbed network responses, including disconnected streams, authentication/quota errors, failed repairs, and cancellation. Browser fixtures are outside the example and are not shipped.
A fully live OpenAI generation-to-repair run remains blocked by OpenAI returning
429 credit_balance_exhausted. The real Autofix repair path has passed independently and through the browser with controlled generation; no fully live OpenAI-to-Autofix success is claimed.Checklist