Back

Prompt design

Clear prompts get better results. Give the model a role, the task, any context, and the exact output format you want. Examples help a lot.

// Vague
"Explain React"

// Clear
const prompt = `
You are a coding tutor for beginners.
Explain React props in 3 short sentences.
Then give one TypeScript example under 10 lines.
Return JSON: { "explanation": string, "code": string }
`

// Use a system instruction for consistent behavior
config: { systemInstruction: "Answer like a friendly senior developer." }

Roadmap