{"record":{"id":"b879ff56d7ef2149","repo":"vercel/ai","slug":"embeddingmodel-b879ff","errorCode":null,"errorMessage":"embeddingModel","messagePattern":"embeddingModel","errorType":"exception","errorClass":"NoSuchModelError","httpStatus":null,"severity":"error","filePath":"packages/deepseek/src/deepseek-provider.ts","lineNumber":116,"sourceCode":"\n  const createFiles = () =>\n    new DeepSeekFiles({\n      provider: 'deepseek.files',\n      baseURL,\n      headers: getHeaders,\n      fetch: options.fetch,\n    });\n\n  const provider = (modelId: DeepSeekChatModelId) =>\n    createLanguageModel(modelId);\n\n  provider.specificationVersion = 'v4' as const;\n  provider.languageModel = createLanguageModel;\n  provider.chat = createLanguageModel;\n  provider.files = createFiles;\n\n  provider.embeddingModel = (modelId: string) => {\n    throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n  };\n  provider.textEmbeddingModel = provider.embeddingModel;\n  provider.imageModel = (modelId: string) => {\n    throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n  };\n\n  return provider;\n}\n\nexport const deepSeek = createDeepSeek();\n","sourceCodeStart":98,"sourceCodeEnd":127,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/deepseek/src/deepseek-provider.ts#L98-L127","documentation":"The DeepSeek provider does not support embedding models, so its embeddingModel/textEmbeddingModel factory always throws NoSuchModelError. The provider only implements languageModel (chat) and files capabilities; this stub exists so the provider satisfies the Provider interface and fails fast with a clear message instead of returning undefined.","triggerScenarios":"Calling embed(), embedMany(), or provider.embeddingModel('some-id') / provider.textEmbeddingModel('some-id') on the DeepSeek provider (deepseek('id').embeddingModel).","commonSituations":"Developers assume every AI SDK provider supports embeddings and try generate embeddings with DeepSeek (which offers no embedding API), or share generic provider-agnostic code that resolves embedding models from any configured provider.","solutions":["Switch embedding workloads to a provider that implements embeddings (e.g. @ai-sdk/openai, @ai-sdk/azure, @ai-sdk/amazon-bedrock).","Create a separate embedding provider instance just for embed() calls and keep DeepSeek for chat.","Feature-check at runtime: only call embed()/embeddingModel if the provider actually supports it, otherwise surface a clear configuration error."],"exampleFix":"// before\nimport { createDeepSeek } from '@ai-sdk/deepseek';\nimport { embed } from 'ai';\nconst deepseek = createDeepSeek({ apiKey });\nawait embed({ model: deepseek.embeddingModel('x'), value: 'hi' });\n\n// after\nimport { createOpenAI } from '@ai-sdk/openai';\nconst openai = createOpenAI({ apiKey: openaiKey });\nawait embed({ model: openai.embedding('text-embedding-3-small'), value: 'hi' });","handlingStrategy":"validation","validationCode":"import { NoSuchModelError } from '@ai-sdk/provider';\nfunction supportsEmbeddings(provider: unknown): boolean {\n  return typeof (provider as any)?.embeddingModel === 'function' &&\n    !/deepseek/i.test((provider as any)?.provider ?? '');\n}","typeGuard":"function isEmbeddingCapable(p: any): p is { embeddingModel: (id: string) => unknown } {\n  return typeof p?.embeddingModel === 'function';\n}","tryCatchPattern":"try {\n  await embed({ model: provider.embeddingModel(id), value });\n} catch (e) {\n  if (NoSuchModelError.isInstance(e) && e.modelType === 'embeddingModel') {\n    throw new Error(`Provider ${id} does not support embeddings; configure an embedding provider.`);\n  }\n  throw e;\n}","preventionTips":["Check the provider's README capability matrix before wiring embed() to it.","Keep separate provider instances for chat and embedding workloads.","Wrap model resolution in a helper that maps NoSuchModelError to a clear config error."],"tags":["provider-capability","embeddings","no-such-model"],"backgroundTag":"provider-does-not-support-model-type","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}