Fehu.MetadataSourceEnvironment metadata describing properties and capabilities.
Metadata includes supported render modes, environment version, author information, and tags.
Environment metadata for discovery and configuration.
Metadata describes environment properties like supported render modes, version information, and authorship. It follows Gymnasium's metadata convention, enabling environment registries and documentation generation.
Create metadata for a custom environment:
let metadata =
Metadata.default
|> Metadata.with_version (Some "1.0.0")
|> Metadata.with_description (Some "CartPole balancing task")
|> Metadata.add_render_mode "human"
|> Metadata.add_render_mode "rgb_array"
|> Metadata.with_render_fps (Some 50)Check render mode support:
if Metadata.supports_render_mode "human" metadata then
(* render in human mode *)type t = {render_modes : string list;Available rendering modes (e.g., "human", "rgb_array")
*)render_fps : int option;Frames per second for rendering, if applicable
*)description : string option;Brief environment description
*)version : string option;Version string (e.g., "1.0.0")
*)supported_vector_modes : string list;Supported vectorization modes
*)extra : Yojson.Safe.t option;Additional custom metadata as JSON
*)}Environment metadata record.
add_render_mode mode metadata adds mode to supported render modes.
Common modes: "human" (display for humans), "rgb_array" (pixel array), "ansi" (text representation).
supports_render_mode mode metadata checks if mode is supported.
with_render_fps fps metadata sets the rendering frame rate.
with_description desc metadata sets the environment description.
with_version version metadata sets the version string.
to_yojson metadata serializes metadata to JSON.
of_yojson json deserializes metadata from JSON.
Returns Error msg if the JSON structure is invalid.