package fehu
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=8e277ed56615d388bc69c4333e43d1acd112b5f2d5d352e2453aef223ff59867
sha512=369eda6df6b84b08f92c8957954d107058fb8d3d8374082e074b56f3a139351b3ae6e3a99f2d4a4a2930dd950fd609593467e502368a13ad6217b571382da28c
doc/fehu/Fehu/Metadata/index.html
Module Fehu.Metadata
Source
Environment 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.
Usage
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.