fix(workers-ai-provider): preserve structured output schema name#562
fix(workers-ai-provider): preserve structured output schema name#562slegarraga wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: a406b61 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks for this, @slegarraga — your diagnosis of #559 was correct, and the request-body regression test was a great instinct (we ended up adding similar wire-shape assertions). We've resolved #559 a different way, so I'm closing this as superseded. Two pieces landed:
That's the main reason we went this route over the envelope approach in this PR — applying the OpenAI envelope to Really appreciate you digging in and filing both the issue and the fix. 🙏 |
Summary
json_schemaenvelope before sending them to Workers AIOutput.object({ name, description })on the request body, defaulting the schema name toresponsewhen not providedworkers-ai-providerFixes #559.
Validation
corepack pnpm --filter workers-ai-provider exec vitest --watch=false test/structured-output.test.tscorepack pnpm --filter workers-ai-provider type-checkcorepack pnpm --filter workers-ai-provider test:cicorepack pnpm exec oxfmt --check packages/workers-ai-provider/src/workersai-chat-language-model.ts packages/workers-ai-provider/test/structured-output.test.ts