use promise for buildPrompt