UNPKG

@ai-sdk/google

Version:

The **[Google Generative AI provider](https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the [Google Generative AI](https://ai.google/discover/generativeai/)

21 lines (17 loc) 537 B
export function isSupportedFileUrl(url: URL): boolean { const urlString = url.toString(); // Google Generative Language files API if ( urlString.startsWith( 'https://generativelanguage.googleapis.com/v1beta/files/', ) ) { return true; } // YouTube URLs (public or unlisted videos) const youtubeRegexes = [ /^https:\/\/(?:www\.)?youtube\.com\/watch\?v=[\w-]+(?:&[\w=&.-]*)?$/, /^https:\/\/youtu\.be\/[\w-]+(?:\?[\w=&.-]*)?$/, ]; return youtubeRegexes.some(regex => regex.test(urlString)); }