@Override
    protected void doExecute(ExecutionContext context) {
        if (context.getCurrentValue() == null) {
            return;
        }

        FieldValue inputValue = context.getCurrentValue();
        DataType inputType = inputValue.getDataType();
        FieldValue generatedValue;
        
        if (inputType == DataType.STRING) {
            var promptString = ((StringFieldValue) inputValue).getString();
            generatedValue = generate(StringPrompt.from(promptString), context);
        } else {
            throw new IllegalArgumentException(
                    ("Generate expression for field %s requires string input type, but got %s.")
                            .formatted(destination, inputType.getName()));
        }
        
        context.setCurrentValue(generatedValue);
    }
The target type we are generating into.
indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/expressions/GenerateExpression.java