# `Otera.Methods`
[🔗](https://github.com/georgeguimaraes/otera/blob/v0.1.0/lib/otera/methods.ex#L1)

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.

# `bind`

```elixir
@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}`.

# `call`

```elixir
@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.

# `has?`

```elixir
@spec has?(term(), String.t()) :: boolean()
```

Returns true if the Python type of `value` has the method `name`.

# `safe?`

```elixir
@spec safe?(term(), String.t()) :: boolean()
```

Returns false for the methods that change a list or a dict.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
