Skip to content

windlass.providers

providers

Built-in provider registrations.

Importing this module registers every official Windlass component by dotted path, without importing any of them. That is what keeps import windlass fast and dependency-free: asking for vectordb('pinecone') imports the Pinecone adapter at that moment, and never before.

Each entry records the extras group it needs, so a missing dependency produces an actionable install command rather than a stack trace.

To see what is available at runtime::

from windlass import Windlass
Windlass.list("chunker")

Third-party components register the same way, either with the :data:~windlass.core.registry.register decorators or through the windlass.<kind> entry-point group.

register_builtins

register_builtins(registry: Registry | None = None) -> int

Register every built-in component lazily.

Called once when :mod:windlass is imported. Safe to call again — entries are replaced rather than duplicated, which makes it usable to restore the registry after a test has torn it down.

Parameters:

Name Type Description Default
registry Registry | None

Registry to populate. Defaults to the global one.

None

Returns:

Type Description
int

How many components were registered.

Example

from windlass.core.registry import Registry reg = Registry() register_builtins(reg) > 40 True "recursive" in reg.names("chunker") True

Source code in src\windlass\providers\__init__.py
def register_builtins(registry: Registry | None = None) -> int:
    """Register every built-in component lazily.

    Called once when :mod:`windlass` is imported. Safe to call again — entries are
    replaced rather than duplicated, which makes it usable to restore the
    registry after a test has torn it down.

    Args:
        registry: Registry to populate. Defaults to the global one.

    Returns:
        How many components were registered.

    Example:
        >>> from windlass.core.registry import Registry
        >>> reg = Registry()
        >>> register_builtins(reg) > 40
        True
        >>> "recursive" in reg.names("chunker")
        True
    """
    target = registry or REGISTRY
    for kind, name, path, extra, aliases, description in BUILTINS:
        target.register_lazy(
            kind,
            name,
            path,
            aliases=aliases,
            description=description,
            extra=extra,
            origin="builtin",
            override=True,
        )
    return len(BUILTINS)