Fehu.InfoSourceAuxiliary diagnostic information from environment interactions.
Info dictionaries carry metadata like episode steps, debug values, or environment state. Environments return info from reset and step operations.
Auxiliary information dictionaries for environment transitions.
Info dictionaries attach metadata to observations and transitions, such as diagnostic information, intermediate values, or episode statistics. They use a schemaless key-value structure similar to JSON, allowing flexible data passing without rigid type constraints.
Create and populate info dictionaries:
let info =
Info.empty
|> Info.set "episode_length" (Info.int 42)
|> Info.set "success" (Info.bool true)Retrieve values:
match Info.find "episode_length" info with
| Some (Int n) -> Printf.printf "Episode length: %d\n" n
| _ -> ()Merge info from different sources:
let combined = Info.merge env_info wrapper_infotype value = | NullNull/None value
*)| Bool of boolBoolean value
*)| Int of intInteger value
*)| Float of floatFloating-point value
*)| Int_array of int arrayArray of integers
*)| Float_array of float arrayArray of floats
*)| Bool_array of bool arrayArray of booleans
*)| String of stringString value
*)| List of value listList of values
*)| Dict of (string * value) listNested dictionary
*)Universal value type for info dictionaries.
Supports common data types with arbitrary nesting.
Immutable key-value dictionary for auxiliary information.
singleton key value creates an info dictionary with a single entry.
set key value info returns a new dictionary with key bound to value.
If key already exists, its value is replaced.
update key f info updates the value at key using function f.
f receives Some old_value if key exists, None otherwise. If f returns Some new_value, key is bound to new_value; if None, key is removed.
find key info looks up key in info.
Returns Some value if key exists, None otherwise.
merge info1 info2 combines two dictionaries.
Keys from info2 override those in info1 when both are present.
of_list entries creates an info dictionary from an association list.
float x constructs a float value.
Non-finite values (nan, +∞, -∞) round-trip via JSON using sentinel strings and are restored on deserialization.
to_yojson info serializes info to JSON.
of_yojson json deserializes info from JSON.
Returns Error msg if the JSON structure is invalid.