Nutrition prompts
Meals & Nutrition has two multimodal extraction tasks and one explicit chat handoff. The image tasks are app-authored user-role content because providers differ in multimodal system-message support. The selected model receives the images, instruction, optional user-entered facts, and a strict JSON schema. The prompt source isjs/nutrition-analysis.js. Aggregate history text is built in js/nutrition-summary-context.js.
Shared structured output
Both image paths request one object with this shape:nutrition.meal-photo
Triggered by Log meal → Meal photo → Analyze photo and reused for each selected model in Meal Benchmarks.
Normalized meal-photo instruction
Normalized meal-photo instruction
nutrition.label
Triggered by Log meal → Nutrition label → Analyze label and by the label mode in Meal Benchmarks.
Normalized nutrition-label instruction
Normalized nutrition-label instruction
label object records the detected serving text, gram/milliliter basis, container servings, label basis, and the user’s consumed amount/unit. Client review remains authoritative before save.
nutrition.history
Triggered by Meals & Nutrition → History → Ask AI after the Meals & Nutrition data source is enabled. This action opens chat with an editable user message; it does not send immediately.
Transport and retention boundary
- Image tasks send up to four original selected images directly to the chosen image-capable provider only after the user selects analysis.
- Full-size images are kept only in the in-memory request workspace and are not saved by getbased.
- The first cloud meal request uses recipient-specific
meal-photoconsent. - Benchmarks reuse one prepared image set across selected models, but every model call has its own abort signal and provider recipient.
- The selected-history action sends only if the user submits the editable chat message using their current chat provider.
Review checklist
- Keep meal-photo and label behavior separate; a label path must not invent nutrients absent from the label.
- Keep unknown values null through schema, parser, review, storage, summaries, targets, and prompt context.
- Test multiple views of one meal so the model does not double-count them.
- Test authoritative known details and corrected identity without preserving the earlier estimate as an anchor.
- Test label bases, dual columns, servings, grams, milliliters, packages, kJ conversion, and salt-to-sodium conversion.
- Test malformed, extra, partial, truncated, and negative output.
- Test cancellation and confirm no automatic retry can create an unexpected second provider charge.
- Confirm full images, user-entered meal facts, and provider output do not enter logs or public fixtures.
- Confirm selected-history output states its coverage limits and does not duplicate automatic nutrition context.