Feature request for $fromAI expression

This idea is valid for any node which allows the $fromAI expression

The idea is:

The $fromAI expression should allow null as an input. Currently the LLM sets values for the types number to 0 and strings to “”, if no data is provided e.g. by the user message.

Example:

See this template:

{
  "food_name": "{{ $fromAI('foodname', 'Name des Lebensmittels', 'string') }}",
  "amount_raw": "{{ $fromAI('amount_raw', 'Portionsgrösse bspw 1 Portion, 2 Stück, 350g, 500 ml', 'string') }}",
  "kcal": {{ $fromAI('kcal', 'Kaloriengehalt Total', 'number') }},
  "protein": {{ $fromAI('protein', 'Proteingehalt Total', 'number') }},
  "fat": {{ $fromAI('fat', 'Fettgehalt Total', 'number') }},
  "carbs": {{ $fromAI('carbs', 'Kohlenhydratgehalt Total', 'number') }},
  "fiber": {{ $fromAI('fiber', 'Ballaststoffgehalt Total', 'number') }}
}

The user message:
“1 Berliner
300 kcal
30g Eiweiss
30g Fett
30g Kohlenhydrate”

is Transformed to the following JSON:

{
  "food_name": "Berliner",
  "amount_raw": "1 Stück",
  "kcal": 300,
  "protein": 30,
  "fat": 30,
  "carbs": 30,
  "fiber": 0
}

Since all key/value pairs are mandatory by default, the LLM sets the missing value for fiber to 0, although this value was not provided by the user message and thus should be null.

I think it would be beneficial to add this because:

This approach would solve data integrity issues, where not provided data can be unambiguously identified.

Any resources to support this?

see my examples.

Are you willing to work on this?

I am not a developer. :frowning: