The `AiChatApi` object has a lifecycle that is tied to the `AiChat` component. When the `AiChat` component is
unmounted, the `AiChatApi` object will be destroyed and any subsequent calls to its methods will result in an exception
being thrown.

In order to prevent this, it is recommended to create the `AiChatApi` object inside the same component that renders the
`AiChat` component, and to not store the `AiChatApi` object in a state variable or a context.
