Generative AI

Generated reference for the iPrintessApi methods tagged #ai-api:generative-ai in printess-editor.d.ts. Custom types referenced below (parameter and return shapes) are documented on the Types reference.

generateImage

generateImage(model: iExternalGenImageModel, targetFrameName: string | null, action: Array<iExternalGenImageFollowUpAction>): Promise<{ resultImage: iExternalImage }>

generates AI image with various models

Parameter Type Description
model iExternalGenImageModel
targetFrameName string | null
action Array<iExternalGenImageFollowUpAction>

Returns: Promise<{ resultImage: iExternalImage }>

generateText

generateText(model: iExternalGenTextModel): Promise<{ text: string }>

Generates AI text with an Anthropic or OpenAI model and returns it as { text }. One prompt in, one text out: the model has no tools, no skills and no memory of earlier calls, so it can only answer - it can never read or change the template. Consumes AI credits based on the tokens used.

Parameter Type Description
model iExternalGenTextModel

Returns: Promise<{ text: string }>

getImagePromptByFrameName

getImagePromptByFrameName(frameNameOrTitle: string): { prompt: string } | null

Returns the AI prompt of the image currently placed in the given frame, wrapped as { prompt } — the text-to-image prompt, or the image-edit prompt if that is what created it, with any ${…} placeholders evaluated. Null if the frame holds no AI-generated image or the frame is not found.

Parameter Type Description
frameNameOrTitle string js-name or title of the frame

Returns: { prompt: string } | null