Skip to content

fix(ai/core): properly handle custom separator in provider registry#5713

Merged
lgrammel merged 3 commits intovercel:mainfrom
anatolzak:fix-provider-registry-custom-separator
Apr 13, 2025
Merged

fix(ai/core): properly handle custom separator in provider registry#5713
lgrammel merged 3 commits intovercel:mainfrom
anatolzak:fix-provider-registry-custom-separator

Conversation

@anatolzak
Copy link
Copy Markdown
Contributor

@anatolzak anatolzak commented Apr 12, 2025

closes #5712

Background

The docs provide the following example that does not work

import { anthropic } from '@ai-sdk/anthropic';
import { openai } from '@ai-sdk/openai';

export const customSeparatorRegistry = createProviderRegistry(
  {
    anthropic,
    openai,
  },
  { separator: ' > ' },
);

When I try to use this, I get NoSuchModelError [AI_NoSuchModelError]: No such languageModel: > gpt-4o

Summary

The issue was that we only handled custom separators with a length of 1 character. I updated the code to accommodate any character length, as demonstrated in the documentation.

Tasks

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • If required, a patch changeset for relevant packages has been added
  • You've run pnpm prettier-fix to fix any formatting issues

Future Work

@anatolzak anatolzak force-pushed the fix-provider-registry-custom-separator branch from c3acd5f to 1b126ab Compare April 12, 2025 16:57
@lgrammel lgrammel merged commit bd41167 into vercel:main Apr 13, 2025
6 of 7 checks passed
@anatolzak anatolzak deleted the fix-provider-registry-custom-separator branch April 13, 2025 07:40
lgrammel added a commit that referenced this pull request Apr 13, 2025
…5713)

Co-authored-by: Lars Grammel <lars.grammel@gmail.com>
lgrammel added a commit that referenced this pull request Apr 13, 2025
…5713) (#5732)

Co-authored-by: Anatol Zakrividoroga <53095479+anatolzak@users.noreply.github.com>
samdenty pushed a commit that referenced this pull request Apr 13, 2025
…derOptions

* origin/v5:
  chore (ai): remove provider re-exports (#5734)
  chore (provider): extract shared provider options and metadata (spec) (#5733)
  fix(ai/core): properly handle custom separator in provider registry (#5713) (#5732)
  chore (providers/xai): update grok-3 model aliases (#5646)
samdenty pushed a commit that referenced this pull request Apr 15, 2025
* origin/v5: (36 commits)
  fix (provider): remove deprecated `Experimental_LanguageModelV2Middleware` (#5775)
  fix (ai): remove deprecated `options.throwErrorForEmptyVectors` from `cosineSimilarity()` (#5772)
  fix (ai/core): filter out empty content/text assistant messages (#5767) (#5783)
  fix (ai): remove deprecated `CoreTool*` types (#5768)
  chore: refactor text parts (spec) (#5759)
  feat(embedding-model-v2): add response body field (#5700)
  feat(embedding-model-v2): add providerOptions (#5698)
  chore: refactor reasoning parts (spec) (#5756)
  chore: update .gitignore (#5755)
  chore: refactor source parts (spec) (#5753)
  chore: refactor file parts (spec) (#5750)
  chore: refactor tool call and tool call delta parts (spec) (#5746)
  fix(providers/xai): edit supported models for structured output (#5715) (#5741)
  chore (ai): remove provider re-exports (#5734)
  chore (provider): extract shared provider options and metadata (spec) (#5733)
  fix(ai/core): properly handle custom separator in provider registry (#5713) (#5732)
  chore (providers/xai): update grok-3 model aliases (#5646)
  chore(embedding-model-v2): rename rawResponse to response (#5699)
  chore(providers/mistral): convert to providerOptions (#5675)
  chore: refactor file towards source pattern (spec) (#5709)
  ...
samdenty pushed a commit that referenced this pull request Apr 15, 2025
…der-options

* origin/v5: (36 commits)
  fix (provider): remove deprecated `Experimental_LanguageModelV2Middleware` (#5775)
  fix (ai): remove deprecated `options.throwErrorForEmptyVectors` from `cosineSimilarity()` (#5772)
  fix (ai/core): filter out empty content/text assistant messages (#5767) (#5783)
  fix (ai): remove deprecated `CoreTool*` types (#5768)
  chore: refactor text parts (spec) (#5759)
  feat(embedding-model-v2): add response body field (#5700)
  feat(embedding-model-v2): add providerOptions (#5698)
  chore: refactor reasoning parts (spec) (#5756)
  chore: update .gitignore (#5755)
  chore: refactor source parts (spec) (#5753)
  chore: refactor file parts (spec) (#5750)
  chore: refactor tool call and tool call delta parts (spec) (#5746)
  fix(providers/xai): edit supported models for structured output (#5715) (#5741)
  chore (ai): remove provider re-exports (#5734)
  chore (provider): extract shared provider options and metadata (spec) (#5733)
  fix(ai/core): properly handle custom separator in provider registry (#5713) (#5732)
  chore (providers/xai): update grok-3 model aliases (#5646)
  chore(embedding-model-v2): rename rawResponse to response (#5699)
  chore(providers/mistral): convert to providerOptions (#5675)
  chore: refactor file towards source pattern (spec) (#5709)
  ...
jacobkerber pushed a commit to jacobkerber/ai that referenced this pull request Jul 15, 2025
jacobkerber pushed a commit to jacobkerber/ai that referenced this pull request Jul 15, 2025
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.

custom separator ' > ' in provider registry doesn't work and throws NoSuchModelError

2 participants