* Narrows a wire `MediaPrompt` to a text + image prompt for image-conditioned * models, throwing on any other part kind (video/audio) so unsupported inputs * fail fast rather than being silently dropped.
(prompt: MediaPrompt)
| 29 | * fail fast rather than being silently dropped. |
| 30 | */ |
| 31 | function asImagePrompt(prompt: MediaPrompt): ImagePrompt { |
| 32 | if (typeof prompt === 'string') return prompt |
| 33 | return prompt.map((part) => { |
| 34 | if (part.type === 'text' || part.type === 'image') return part |
| 35 | throw new Error(`Unsupported prompt part for image model: ${part.type}`) |
| 36 | }) |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Narrows a wire `MediaPrompt` to a text-only prompt, throwing if any image / |
no outgoing calls
no test coverage detected