package vision import "errors" // vision 包返回的哨兵错误。每个错误向外传递时都以 %w // 包装,使调用方能按类别判断,同时保留原始原因。 var ( // ErrNoImage 在图像来源字符串为空时返回。 ErrNoImage = errors.New("vision: empty image source") // ErrNotConfigured 在适配器未设置 endpoint/model 时返回。 ErrNotConfigured = errors.New("vision: adapter not configured") // ErrUnsupportedSource 在图像来源无法处理时返回。 ErrUnsupportedSource = errors.New("vision: unsupported image source") // ErrFetch 在 URL 图像无法下载时返回。 ErrFetch = errors.New("vision: cannot fetch image") // ErrUpstream 在 vision/OCR 提供方请求失败时返回。 ErrUpstream = errors.New("vision: upstream request failed") // ErrBadImage 在图像无法读取或解码时返回。 ErrBadImage = errors.New("vision: cannot read image") // ErrNotImage 在来源声明的类型与真实字节都判不出图像时返回 // (例如把 HTML/PROXY 错误页当成图片送进模型)。 ErrNotImage = errors.New("vision: source is not an image") // ErrBadArgs 在工具参数格式错误时由该工具返回。 ErrBadArgs = errors.New("vision: bad tool arguments") // ErrBlockedAddress 在图像 URL 指向被拒的链路本地/云元数据地址时返回 // (见 guard.go)。错误只带主机与网段原因,不带 URL 或其中的凭据。 ErrBlockedAddress = errors.New("vision: image URL points at a blocked address") // ErrImageTooLarge 在内联图像(base64 / data: URI)字符串超过上限时返回。 // 判定在解码与短路之前完成,错误信息只带上限与本次长度。 ErrImageTooLarge = errors.New("vision: inline image is too large") )