--- hide-toc: true --- # Type Hint Support ```{image} ../_images/type_hints.gif :class: bg-primary :align: center :class: sd-rounded-3 ``` The Amplify SDK defines type hints for all functions, methods, and attributes. This feature allows IDEs such as Visual Studio Code and Google Colaboratory to detect code errors through code completion and type checking. ````{hint} If using Visual Studio Code, install the [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) extension and add the following settings to enable code completion and type checking. `settings.json` ```json { "python.languageServer": "Pylance", "python.analysis.typeCheckingMode": "basic", } ``` ```` ````{hint} Depending on the method or function you call, the type or array dimension may not always be deterministic. For example, the {py:func}`amplify.einsum` function returns {py:class}`~amplify.Poly` or {py:class}`~amplify.PolyArray` depending on the value of its argument, which may not be deterministic, resulting in an error or warning from the type checker. In such cases, you can avoid the error by specifying the type explicitly, as follows. ```python from amplify import Poly, einsum # The argument "ij,ki,kj->" is expected to return a poly (scalar), but the type checker cannot determine it. objective: Poly = einsum("ij,ki,kj->", d, q1, q2) # type: ignore ``` ````