feat: add Vercel AI Runner protocol implementation (AIC-2388)#1339
Draft
jsonbailey wants to merge 1 commit intojb/aic-2388/js-langchain-runnerfrom
Draft
feat: add Vercel AI Runner protocol implementation (AIC-2388)#1339jsonbailey wants to merge 1 commit intojb/aic-2388/js-langchain-runnerfrom
jsonbailey wants to merge 1 commit intojb/aic-2388/js-langchain-runnerfrom
Conversation
Adds VercelModelRunner and VercelRunnerFactory implementing the Runner protocol introduced in JS PR 6. The runner returns RunnerResult instead of the legacy ChatResponse / StructuredResponse and preserves the v4/v5 token field handling already present in VercelProvider. No agent runner is provided because the Vercel AI SDK is a thin model layer rather than an agent framework — the existing getAIMetricsFromStream helper covers the streaming use case and is exported alongside the new Runner classes. mapProvider is renamed to mapProviderName on both the helper module and the VercelProvider class; the old mapProvider name is kept as a deprecated alias. convertMessagesToVercel is added for parity with the other provider helpers. Co-Authored-By: Claude Opus 4.7 <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.
Summary
Adds Runner-protocol classes for the Vercel AI provider, completing the JS Runner migration for the three provider packages. New classes:
VercelModelRunner—Runnerfor chat completions;run(messages, outputType?)returnsRunnerResult { content, metrics, raw, parsed? }. Uses Vercel'sgenerateTextfor chat andgenerateObjectfor structured output. Preserves v4/v5 token field handling.VercelRunnerFactory— exposescreateModel(config). No agent runner is provided because the Vercel AI SDK is a thin model layer rather than an agent framework.convertMessagesToVercel,mapProviderName,mapUsageDataToLDTokenUsage,getAIMetricsFromResponse,getAIMetricsFromStream— helper functions.getAIMetricsFromStreamis preserved as-is for the streaming use case.mapProvideris renamed tomapProviderNameon both the helper module and theVercelProviderclass; the old name is preserved as a@deprecatedalias so existing callers continue to work.The legacy
VercelProviderclass is preserved soAIProviderFactory(also@deprecated) keeps working until the managed layer fully migrates toRunner.run().Stacked on
jb/aic-2388/js-langchain-runner(JS PR 8).Test plan
yarn workspace @launchdarkly/server-sdk-ai-vercel test— 54 tests pass (existing 34 + 20 new)yarn workspace @launchdarkly/server-sdk-ai-vercel lint— cleanyarn workspace @launchdarkly/server-sdk-ai-vercel run build— clean🤖 Generated with Claude Code