.. SPDX-License-Identifier: CC-BY-4.0 SPDX-FileCopyrightText: Netresearch DTT GmbH .. include:: /Includes.rst.txt .. _api-middleware: =================== Provider middleware =================== Implement ``Netresearch\NrLlm\Provider\Middleware\ProviderMiddlewareInterface`` for a provider-call concern. Its method is ``handle(ProviderCallContext $context, callable $next): mixed``. The current configuration is on ``$context->configuration``; when replacing it, derive a new context with ``withConfiguration()``. Pass that context to ``$next``. .. code-block:: php :caption: Transparent middleware extension