# How to define a generative mode

**URL:** <https://discourse.julialang.org/t/how-to-define-a-generative-mode/79990>\
**Category:** New to Julia\
**Tags:** question, package\
**Created:** [April 25, 2022, 2:19pm UTC](https://discourse.julialang.org/t/how-to-define-a-generative-mode/79990 "2022-04-25T14:19:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![clrescobar](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@clrescobar](https://discourse.julialang.org/u/clrescobar)\
**Post date:** [April 25, 2022, 2:19pm UTC](https://discourse.julialang.org/t/how-to-define-a-generative-mode/79990/1 "2022-04-25T14:19:55Z")

</div>

Hello,

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](https://juliapomdp.github.io/POMDPs.jl/latest/def_pomdp/#Using-a-single-generative-function-instead-of-separate-T,-Z,-and-R).

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?

Thanks!
