BREAKING CHANGE(vercel-ai-sdk): migrate to Vercel AI SDK v6 and introduce provider registry (getModel) returning LanguageModelV3

This commit is contained in:
2026-03-05 19:37:29 +00:00
parent 27cef60900
commit c24010c9bc
61 changed files with 4789 additions and 9083 deletions

29
ts_vision/index.ts Normal file
View File

@@ -0,0 +1,29 @@
import * as plugins from './plugins.js';
import type { LanguageModelV3 } from '@ai-sdk/provider';
export interface IVisionOptions {
model: LanguageModelV3;
image: Buffer | Uint8Array;
prompt: string;
mediaType?: 'image/jpeg' | 'image/png' | 'image/webp' | 'image/gif';
}
export async function analyzeImage(options: IVisionOptions): Promise<string> {
const result = await plugins.generateText({
model: options.model,
messages: [
{
role: 'user',
content: [
{ type: 'text', text: options.prompt },
{
type: 'image',
image: options.image,
mediaType: options.mediaType ?? 'image/jpeg',
},
],
},
],
});
return result.text;
}