get_from_dict_or_env from langchain_core.utils has incorrect signature or incorrectly casting output
The utility function `get_from_dict_or_env` in `langchain_core.utils.env` accepts a dictionary with values of type `Any`, but internally casts the value to `str` before returning it. This breaks code that stores non-string values (e.g., enums, integers, custom objects) in the dictionary, as the returned value no longer matches the original type. The function signature declares `dict[str, Any]`, implying that the value type is preserved, but the implementation violates this contract.
