-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Not able to integrate Deepseek with the multi modal architecture #733
Comments
Try something like the following, keep the models.ts the same: import { openai } from '@ai-sdk/openai'; import { customMiddleware } from './custom-middleware'; export const customModel = (apiIdentifier: string) => { const getProvider = (identifier: string): ((id: string) => LanguageModelV1) => {
}; const provider = getProvider(apiIdentifier); return wrapLanguageModel({ |
tried the same earlier, but it's not rendering any replies from api other than openai |
export interface Model {
id: string
label: string
apiIdentifier: string
description: string
}
export const models: Array<Model> = [
{
id: "gpt-4o-mini",
label: "GPT 4o mini",
apiIdentifier: "gpt-4o-mini",
description: "Small model for fast, lightweight tasks"
},
{
id: "gpt-4o",
label: "GPT 4o",
apiIdentifier: "gpt-4o",
description: "For complex, multi-step tasks"
},
{
id: "deepseek-chat",
label: "DeepSeek Chat",
apiIdentifier: "deepseek-chat",
description: "For deep research and analysis"
}
] as const
export const DEFAULT_MODEL_NAME: string = "gpt-4o-mini"
Install dependencies first:npm i @ai-sdk/deepseek import { deepseek } from "@ai-sdk/deepseek"
import { openai } from "@ai-sdk/openai"
import { experimental_wrapLanguageModel as wrapLanguageModel } from "ai"
import { customMiddleware } from "./custom-middleware"
export const customModel = (apiIdentifier: string) => {
let model
if (apiIdentifier.startsWith("deepseek")) {
model = deepseek(apiIdentifier)
} else if (apiIdentifier.startsWith("openai")) {
model = openai(apiIdentifier)
} else {
throw new Error(`Unsupported model: ${apiIdentifier}`)
}
return wrapLanguageModel({
model: model,
middleware: customMiddleware
})
}
export const imageGenerationModel = (apiIdentifier: string) => {
if (apiIdentifier.startsWith("openai")) {
return openai.image("dall-e-3")
} else {
throw new Error(`Unsupported image generation model: ${apiIdentifier}`)
}
} |
I'm getting the following error with trying to integrate deepseek.
The text was updated successfully, but these errors were encountered: