Skip to content

feat: instrument AI SDK generateImage - #2402

Open
Laith Munir (laithmunir9) wants to merge 1 commit into
braintrustdata:mainfrom
laithmunir9:feat/ai-sdk-generate-image-instrumentation
Open

feat: instrument AI SDK generateImage#2402
Laith Munir (laithmunir9) wants to merge 1 commit into
braintrustdata:mainfrom
laithmunir9:feat/ai-sdk-generate-image-instrumentation

Conversation

@laithmunir9

Copy link
Copy Markdown

Summary

Adds Braintrust instrumentation for Vercel AI SDK image generation.

  • supports experimental_generateImage in AI SDK v5
  • supports stable generateImage in AI SDK v6 and v7
  • instruments manual wrapAISDK() usage and supported auto-instrumentation paths
  • converts generated image data to Braintrust Attachments instead of logging raw base64 or byte payloads
  • preserves model/provider metadata and usage metrics when exposed by the AI SDK version
  • adds deterministic, provider-free unit and E2E coverage

AI SDK v3 and v4 are unchanged because they do not expose the image generation API.

Testing

  • focused generateImage E2E: 8/8 passed
  • full AI SDK E2E: 280/280 passed
  • full AI SDK E2E replay: 280/280 passed twice
  • AI SDK plugin generateImage tests: 4 passed
  • auto-instrumentation tests: 43 passed
  • wrapper generateImage test: passed
  • TypeScript typecheck: passed
  • Prettier: passed on touched files
  • ESLint: 0 errors

No paid provider calls are required for the new image generation coverage.

Fixes #1626

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.

Vercel AI SDK generateImage not instrumented (wrapper and auto-instrumentation)

1 participant