Use flexible generation without assuming cloud-level capabilities.
1. Prompt capability
The Prompt API offers flexible local generation on supported configurations. Verify current availability, modality and context limits before designing a chat or tool workflow around it.
2. Context budgets
Keep instructions short and include only necessary data. Small local context limits make unbounded conversation history particularly fragile. Prefer a narrowly scoped task over an open-ended assistant.
3. Result handling
Validate generated output and support refusal, empty responses and resource exhaustion. Do not assume local execution eliminates malformed output or prompt injection risks.
Worked scenario
A local assistant receives a document containing “ignore previous instructions.” Treat that text as document data, even though no network service is involved.
Apply it
Build a short classification prompt with an allowlisted label set. Reject unknown labels and test embedded adversarial instructions.
Check your understanding
Flexible prompting remains bounded by input, output and capability checks. Explain the decision and show evidence from your implementation or design. If you cannot demonstrate it yet, revisit the relevant section before continuing.