Optional ingredientOptional ingredient identifier for the assigned ingredient.
When undefined, no ingredient is assigned to this holder/pump and volume resolution operations may fail or return default values. Check this property before calling resolveIntentVolume to ensure an ingredient is assigned.
Checking for assignment before resolving volume:
if (holder.ingredientId) {
const volume = await holder.resolveIntentVolume("CALIBRATE");
// Use volume...
} else {
console.log("No ingredient assigned - cannot calibrate");
}
Resolves the appropriate volume for a given intent operation.
Different intents require different volumes based on operational requirements:
The resolved volume is calculated based on:
The intent string identifier (e.g., "CALIBRATE", "PRIME", "FLUSH")
Promise resolving to object with volume property in ounces (oz)
May reject if ingredient is not assigned or volume cannot be determined
Resolving calibration volume:
const result = await holder.resolveIntentVolume("CALIBRATE");
console.log(`Calibration: ${result.volume} oz`);
Handling volume resolution errors:
try {
const result = await holder.resolveIntentVolume("PRIME");
displayVolume(result.volume);
} catch (error) {
console.error("Cannot resolve volume - ingredient may not be assigned");
}
Interface for models that can resolve intent volumes for various operations.
This interface extends intent-aware models with the ability to calculate appropriate volumes for specific intents (e.g., CALIBRATE, PRIME, FLUSH). Typically implemented by holder and pump models that have ingredient assignments and need to determine operation-specific volumes based on ingredient type, pump configuration, or operational requirements.
Use this interface in combination with IntentAware to create models that can both determine appropriate volumes and execute the operations.
Example
Using IntentContainer for calibration:
Example
Checking for ingredient assignment:
See
IntentAware for intent execution capabilities