How to handle a feature vector that could be variable length?
There are many options.
The most common method to handle variable length vectors is to pad the vectors. Add zeros as placeholders to the shorter length vectors until all the vectors are the same length. Then it can be modeled similar to any other feature vector.
Another option is to take the norm of the vector. That would yield a single scalar that could be used in the machine learning model.
Ultimately, the way to handle a feature vector that could be variable lengths depends on what the feature represents.