ai-chatbot icon indicating copy to clipboard operation
ai-chatbot copied to clipboard

All non OpenAI providers giving errors like Type 'GoogleGenerativeAILanguageModel' is not assignable to type 'LanguageModelV1'.

Open retired-Hurt opened this issue 1 year ago • 4 comments

All non-OpenAI providers are giving error like Type 'GoogleGenerativeAILanguageModel' is not assignable to type 'LanguageModelV1'...Steps to reproduce

  1. Clone the repo to local
  2. On lib --> chat --> actions.tsx write following code

import { google } from '@ai-sdk/google';

  1. Replace the code model: openai('gpt-3.5-turbo'), with the code google('models/gemini-pro'), and it shows the above compilation error on vscode.

I have tried this with other providers like mistral, anthropic and all of them give the same error. However the groq provider doesn't give the same error as it uses the OpenAI provider.

Is there an underlying problem with the SDK or is there something I am missing here?

retired-Hurt avatar Jun 16 '24 13:06 retired-Hurt

I came across the same issue and the problem was that there was a mismatch between the ai package and @ai-sdk/openai in my case. Updating both to the latest versions solved the issue, might help you too.

paulbremer avatar Jun 28 '24 12:06 paulbremer

I had the same issue and upgrading my ai package with npm update ai --save fixed it. I had cloned a Vercel template where the package{-lock}.json specified an older version "ai": "^3.0.17".

pringshia avatar Jun 29 '24 17:06 pringshia

All non-OpenAI providers are giving error like Type 'GoogleGenerativeAILanguageModel' is not assignable to type 'LanguageModelV1'...Steps to reproduce

  1. Clone the repo to local
  2. On lib --> chat --> actions.tsx write following code

import { google } from '@ai-sdk/google';

  1. Replace the code model: openai('gpt-3.5-turbo'), with the code google('models/gemini-pro'), and it shows the above compilation error on vscode.

I have tried this with other providers like mistral, anthropic and all of them give the same error. However the groq provider doesn't give the same error as it uses the OpenAI provider.

Is there an underlying problem with the SDK or is there something I am missing here?

How did you use the GROQ API without errors? @retired-Hurt

VENKADESHKUMAR-VK avatar Dec 07 '24 19:12 VENKADESHKUMAR-VK

Just an FYI, if anybody had recently faced this issue with OpenAI provider package @ai-sdk/openai check the versions of both ai and @ai-sdk/openai packages. Make sure their are compactable. I just fixed my issue by downgrading the @ai-sdk/openai package to 0.0.40, ai package used 3.2.36. Just matched the versions date on npm directory https://www.npmjs.com/package/package

ankit4451 avatar Jan 19 '25 14:01 ankit4451