Skip to content

symfonic.agent.backend.cache_binding

cache_binding

Bind the provider model through the optional native cache composition.

bind_model_for_plan

bind_model_for_plan(provider: Any, config: Any, chat_model: Any, tools: Sequence[Any], cache_composition: Any | None) -> tuple[str, Any, Any | None]

Return the wire family, bound model, and palette binder for one plan.

Source code in src/symfonic/agent/backend/cache_binding.py
def bind_model_for_plan(
    provider: Any,
    config: Any,
    chat_model: Any,
    tools: Sequence[Any],
    cache_composition: Any | None,
) -> tuple[str, Any, Any | None]:
    """Return the wire family, bound model, and palette binder for one plan."""
    family = detect_provider_family(provider, config)
    if cache_composition is None:
        return family, _bind_plain(chat_model, tools), None

    cache_composition.require_supported_provider(provider, family)
    from symfonic.capabilities.caching import ToolManifestBinder

    binder = ToolManifestBinder(cache_composition.manifest)
    bound = binder.bind(chat_model, tools).model if tools else chat_model
    return family, bound, binder