MCPcopy Create free account
hub / github.com/TanStack/ai / asImageToVideoPrompt

Function asImageToVideoPrompt

examples/ts-react-media/src/lib/server-functions.ts:57–68  ·  view source on GitHub ↗

* Like `asImagePrompt`, but additionally requires at least one image part — * image-to-video endpoints need a start frame.

(
  prompt: MediaPrompt,
)

Source from the content-addressed store, hash-verified

55 * image-to-video endpoints need a start frame.
56 */
57function 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

Callers 1

Calls 1

asImagePromptFunction · 0.85

Tested by

no test coverage detected