Skip to main content

validate_vendor_base_url

Function validate_vendor_base_url 

Source
pub(crate) fn validate_vendor_base_url(
    provider_id: &str,
    base_url: &str,
) -> Result<(), String>
Expand description

Rejects a non-empty model_vendor_base_url unless provider_id’s ProviderConfig declares support for redirection via base_url_env_var. Pure — no I/O — so it’s directly unit-testable without the async Store/Broker harness agent_define_core needs. An empty base_url is always fine — that’s “use the harness’s default vendor endpoint,” never rejected regardless of provider.

pub(crate) (not pub(super)) so server::agent_handlers::template’s agentdefcreatefromtemplate and server::agent_handlers::core’s updateagent handlers can reuse it too, instead of duplicating this check for the human-facing creation/edit paths.