export interface CachedResponse { promptText: string hasImage: boolean // Name of the bundled example file the prompt is sent with fileName?: string xml: string } export const CACHED_EXAMPLE_RESPONSES: CachedResponse[] = [ { promptText: "Give me a **animated connector** diagram of transformer's architecture", hasImage: false, xml: ` `, }, { promptText: "Replicate this in aws style", hasImage: true, fileName: "architecture.png", xml: ` `, }, { promptText: "Replicate this flowchart.", hasImage: true, fileName: "example.png", xml: ` `, }, { promptText: "Summarize this paper as a diagram", hasImage: true, fileName: "chain-of-thought.txt", xml: ` `, }, { promptText: "Draw a cat for me", hasImage: false, xml: ` `, }, ] // Examples that come with a file only match when that exact example file is // attached, so a user's own file with the same prompt still goes to the model. // Callers that can't tell file names (the server) only get text-only examples. export function findCachedResponse( promptText: string, hasImage: boolean, fileName?: string, ): CachedResponse | undefined { return CACHED_EXAMPLE_RESPONSES.find( (c) => c.promptText === promptText && c.hasImage === hasImage && (!c.fileName || c.fileName === fileName) && c.xml !== "", ) }