Factory for creating semaphore managers with Redis or in‑memory backends.
# Source: https://github.com/zylon-ai/private-gpt | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
from __future__ import annotations
import logging
from collections.abc import Callable
from private_gpt.components.concurrency.semaphore_manager import SemaphoreManager
from private_gpt.di import get_global_injector
from private_gpt.settings.settings import Settings
from private_gpt.utils.dependencies import format_missing_dependency_message
logger = logging.getLogger(__name__)
SemaphoreManagerProvider = Callable[
[Settings | None, int | None, str | None], SemaphoreManager
]
def _redis_semaphore_provider(
settings: Settings | None,
max_concurrency: int | None,
que
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key