Skip to main content

parse_data_url

Function parse_data_url 

Source
pub fn parse_data_url(url: &str) -> Option<(&str, &str)>
Expand description

Split a data:<media-type>;base64,<payload> URL.

Anthropic’s Messages API models an image as a tagged source rather than a URL, so the native route has to take the data URL back apart. Returns None for http(s) URLs and for anything malformed, which the caller renders as a remote source or a visible degradation respectively.