Skip to content

feat(ai/core): support plain string model IDs in rerank()#14203

Merged
R-Taneja merged 8 commits intomainfrom
feat/rerank-string-model-resolution
Apr 7, 2026
Merged

feat(ai/core): support plain string model IDs in rerank()#14203
R-Taneja merged 8 commits intomainfrom
feat/rerank-string-model-resolution

Conversation

@R-Taneja
Copy link
Copy Markdown
Contributor

@R-Taneja R-Taneja commented Apr 7, 2026

Summary

The rerank() function now accepts plain model strings in addition to RerankingModel objects, matching the behavior of generateText, embed, and other core functions.

// Before: required provider instance
const result = await rerank({
  model: gateway.rerankingModel('cohere/rerank-v3.5'),
  ...
});

// After: plain strings also work
const result = await rerank({
  model: 'cohere/rerank-v3.5',
  ...
});
  • Add string to RerankingModel type union
  • Add resolveRerankingModel() to resolve-model.ts (follows video model pattern — uses raw global provider since rerankingModel is not yet on ProviderV4 interface)
  • Wire resolution into rerank() function

Test plan

  • TypeScript compilation passes
  • resolveRerankingModel tests: v4 passthrough, v3→v4 conversion, string via gateway, string via global provider, unsupported provider error, unsupported version error
  • Existing rerank tests pass

Add resolveRerankingModel to resolve plain strings like
'cohere/rerank-v3.5' through the global default provider,
matching the pattern used by generateText, embed, etc.
@tigent tigent bot added ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. feature New feature or request labels Apr 7, 2026
@R-Taneja R-Taneja added the backport Admins only: add this label to a pull request in order to backport it to the prior version label Apr 7, 2026
@R-Taneja R-Taneja changed the title feat (ai/core): support plain string model IDs in rerank() feat(ai/core): support plain string model IDs in rerank() Apr 7, 2026
@R-Taneja R-Taneja requested a review from shaper April 7, 2026 19:14
@shaper shaper requested a review from gr2m April 7, 2026 19:20
@R-Taneja R-Taneja merged commit 664a0eb into main Apr 7, 2026
18 checks passed
@R-Taneja R-Taneja deleted the feat/rerank-string-model-resolution branch April 7, 2026 22:44
vercel-ai-sdk bot pushed a commit that referenced this pull request Apr 7, 2026
@vercel-ai-sdk vercel-ai-sdk bot removed the backport Admins only: add this label to a pull request in order to backport it to the prior version label Apr 7, 2026
@vercel-ai-sdk
Copy link
Copy Markdown
Contributor

vercel-ai-sdk bot commented Apr 7, 2026

⚠️ Backport to release-v6.0 created but has conflicts: #14214

@vercel-ai-sdk
Copy link
Copy Markdown
Contributor

vercel-ai-sdk bot commented Apr 7, 2026

🚀 Published in:

Package Version
ai 7.0.0-beta.72
@ai-sdk/angular 3.0.0-beta.72
@ai-sdk/langchain 3.0.0-beta.72
@ai-sdk/llamaindex 3.0.0-beta.72
@ai-sdk/otel 1.0.0-beta.18
@ai-sdk/react 4.0.0-beta.72
@ai-sdk/rsc 3.0.0-beta.73
@ai-sdk/svelte 5.0.0-beta.72
@ai-sdk/vue 4.0.0-beta.72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants