How to define a generative mode


I have seen that the @gen interface can be used to define a generative model that takes in a current (s,a)-pair and outputs a sampled next state, observation, and reward (sp, o, r). Link here.

Nevertheless, here functions are defined. Do you know how to work with a model returning samples of the next states. And how to model that in POMDPs?