* Like `asImagePrompt`, but additionally requires at least one image part — * image-to-video endpoints need a start frame.
( prompt: MediaPrompt, )
| 55 | * image-to-video endpoints need a start frame. |
| 56 | */ |
| 57 | function asImageToVideoPrompt( |
| 58 | prompt: MediaPrompt, |
| 59 | ): Array<TextPart | ImagePart<MediaInputMetadata>> { |
| 60 | const narrowed = asImagePrompt(prompt) |
| 61 | if ( |
| 62 | typeof narrowed === 'string' || |
| 63 | !narrowed.some((part) => part.type === 'image') |
| 64 | ) { |
| 65 | throw new Error('Start image is required for image-to-video') |
| 66 | } |
| 67 | return narrowed |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Resolves the video adapter for a UI model id. The native grok-imagine |
no test coverage detected