Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Deepseek reasoner model results in error #4727

Closed
pangmaowang opened this issue Feb 6, 2025 · 1 comment · Fixed by #4804
Closed

Using Deepseek reasoner model results in error #4727

pangmaowang opened this issue Feb 6, 2025 · 1 comment · Fixed by #4804
Labels
ai/provider bug Something isn't working

Comments

@pangmaowang
Copy link

Description

I used the ai chatbot vercel holds, i added the deepseek r1 model..
I tried two ways
first is too use the wrapLanguageModel as it is...
it errored me out like

I got the error Error [AI_APICallError]: deepseek-reasoner does not support Function Calling
    at <unknown> (turbopack://[project]/node_modules/.pnpm/@ai-sdk+provider-utils@2.1.6_zod@3.23.8/node_modules/@ai-sdk/provider-utils/src/response-handler.ts:59:15)
    at async postToApi (turbopack://[project]/node_modules/.pnpm/@ai-sdk+provider-utils@2.1.6_zod@3.23.8/node_modules/@ai-sdk/provider-utils/src/post-to-api.ts:81:27)
    at async OpenAICompatibleChatLanguageModel.doStream (turbopack://[project]/node_modules/.pnpm/@ai-sdk+openai-compatible@0.1.8_zod@3.23.8/node_modules/@ai-sdk/openai-compatible/src/openai-compatible-chat-language-model.ts:346:49)
    at async fn (turbopack://[project]/node_modules/.pnpm/ai@4.1.21_react@19.0.0-rc-45804af1-20241021_zod@3.23.8/node_modules/ai/core/generate-text/stream-text.ts:925:24)
    at async (turbopack://[project]/node_modules/.pnpm/ai@4.1.21_react@19.0.0-rc-45804af1-20241021_zod@3.23.8/node_modules/ai/core/telemetry/record-span.ts:18:21)
    at async _retryWithExponentialBackoff (turbopack://[project]/node_modules/.pnpm/ai@4.1.21_react@19.0.0-rc-45804af1-20241021_zod@3.23.8/node_modules/ai/util/retry-with-exponential-backoff.ts:36:11)
    at async streamStep (turbopack://[project]/node_modules/.pnpm/ai@4.1.21_react@19.0.0-rc-45804af1-20241021_zod@3.23.8/node_modules/ai/core/generate-text/stream-text.ts:880:14)
    at async fn (turbopack://[project]/node_modules/.pnpm/ai@4.1.21_react@19.0.0-rc-45804af1-20241021_zod@3.23.8/node_modules/ai/core/generate-text/stream-text.ts:1306:8)
    at async (turbopack://[project]/node_modules/.pnpm/ai@4.1.21_react@19.0.0-rc-45804af1-20241021_zod@3.23.8/node_modules/ai/core/telemetry/record-span.ts:18:21)
  57 |       return {
  58 |         responseHeaders,
> 59 |         value: new APICallError({
     |               ^
  60 |           message: errorToMessage(parsedError),
  61 |           url,
  62 |           requestBodyValues, {

then i remove the wrapLanguageModel and use model directly..
the error is

I got the error Error [AI_APICallError]: deepseek-reasoner does not support successive user or assistant messages (messages[1] and messages[2] in your input). You should interleave the user/assistant messages in the message sequence.
    at <unknown> (turbopack://[project]/node_modules/.pnpm/@ai-sdk+provider-utils@2.1.6_zod@3.23.8/node_modules/@ai-sdk/provider-utils/src/response-handler.ts:59:15)
    at async postToApi (turbopack://[project]/node_modules/.pnpm/@ai-sdk+provider-utils@2.1.6_zod@3.23.8/node_modules/@ai-sdk/provider-utils/src/post-to-api.ts:81:27)
    at async OpenAICompatibleChatLanguageModel.doStream (turbopack://[project]/node_modules/.pnpm/@ai-sdk+openai-compatible@0.1.8_zod@3.23.8/node_modules/@ai-sdk/openai-compatible/src/openai-compatible-chat-language-model.ts:346:49)
    at async fn (turbopack://[project]/node_modules/.pnpm/ai@4.1.21_react@19.0.0-rc-45804af1-20241021_zod@3.23.8/node_modules/ai/core/generate-text/stream-text.ts:925:24)
    at async (turbopack://[project]/node_modules/.pnpm/ai@4.1.21_react@19.0.0-rc-45804af1-20241021_zod@3.23.8/node_modules/ai/core/telemetry/record-span.ts:18:21)
    at async _retryWithExponentialBackoff (turbopack://[project]/node_modules/.pnpm/ai@4.1.21_react@19.0.0-rc-45804af1-20241021_zod@3.23.8/node_modules/ai/util/retry-with-exponential-backoff.ts:36:11)
    at async streamStep (turbopack://[project]/node_modules/.pnpm/ai@4.1.21_react@19.0.0-rc-45804af1-20241021_zod@3.23.8/node_modules/ai/core/generate-text/stream-text.ts:880:14)
    at async fn (turbopack://[project]/node_modules/.pnpm/ai@4.1.21_react@19.0.0-rc-45804af1-20241021_zod@3.23.8/node_modules/ai/core/generate-text/stream-text.ts:1306:8)
    at async (turbopack://[project]/node_modules/.pnpm/ai@4.1.21_react@19.0.0-rc-45804af1-20241021_zod@3.23.8/node_modules/ai/core/telemetry/record-span.ts:18:21)
  57 |       return {
  58 |         responseHeaders,
> 59 |         value: new APICallError({
     |               ^
  60 |           message: errorToMessage(parsedError),
  61 |           url,
  62 |           requestBodyValues, {
  cause: undefined,
  url: 'https://api.deepseek.com/v1/chat/completions',
  requestBodyValues: [Object],
  statusCode: 400,
  responseHeaders: [Object],
  responseBody: '{"error":{"message":"deepseek-reasoner does not support successive user or assistant messages (messages[1] and messages[2] in your input). You should interleave the user/assistant messages in the message sequence.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}',
  isRetryable: false,
  data: [Object]
}

Code example

No response

AI provider

@ai-sdk/deepseek

Additional context

No response

@pangmaowang pangmaowang added the bug Something isn't working label Feb 6, 2025
@smoothdvd
Copy link

deepseek-reasoner does not support tool function (Function Call). Not Supported Features:Function Call、Json Output、FIM (Beta)

https://sdk.vercel.ai/docs/foundations/providers-and-models#model-capabilities needs to be correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/provider bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants