The Python methods that templates call on values, such as content.strip(), name.startswith("get_") or message.get("tool_calls").
has?/2 knows every method of the Python types str, list, tuple, dict, int and float, because a method name hides a dict key of the same name in x.name. call/4 runs the methods that chat templates use. As in the immutable sandbox of transformers, the methods that change a list or a dict are unsafe.
Summary
Functions
Binds positional and keyword arguments to params, like a call of a Python function, and returns the values in order. The errors have the messages of Python.
Calls the method name of receiver with positional args and a dict of keyword arguments.
Returns true if the Python type of value has the method name.
Returns false for the methods that change a list or a dict.
Functions
@spec bind(list(), Otera.Dict.t(), list(), String.t()) :: list()
Binds positional and keyword arguments to params, like a call of a Python function, and returns the values in order. The errors have the messages of Python.
A param is a name for a required argument, or {name, default}.
@spec call(term(), String.t(), list(), Otera.Dict.t()) :: term()
Calls the method name of receiver with positional args and a dict of keyword arguments.
Returns true if the Python type of value has the method name.
Returns false for the methods that change a list or a dict.