def cast(
    inp: Union[str, bool, float, Prompt, ChatCompletion],
    to_type: Union[
        Type[Union[str, bool, float, Prompt, ChatCompletion]],
        List[Type[Union[str, bool, float, Prompt, ChatCompletion]]],
    ],
) -> Union[str, bool, float, Prompt, ChatCompletion]:

source code

Cast the input to the specified type.

Arguments:

  • inp - The input to cast.
  • to_type - The type to cast the input to.

Returns:

The input after casting to the new type.