Documentation
¶
Overview ¶
Package infrastructure adapts the privacy Segmenter port onto Meta's Model API (SAM 3.1): one Responses-API call per concept, boxes extracted.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SAMOption ¶
type SAMOption func(*SAMService)
SAMOption configures a SAMService.
func WithBaseURL ¶
WithBaseURL overrides the Model API root (tests).
func WithHTTPClient ¶
WithHTTPClient overrides the HTTP client (timeouts, tests).
type SAMService ¶
type SAMService struct {
// contains filtered or unexported fields
}
SAMService implements privacydomain.Segmenter over HTTP.
func NewSAMService ¶
func NewSAMService(apiKey, model string, opts ...SAMOption) *SAMService
NewSAMService builds a SAM 3.1 client. An empty model falls back to sam-3.1; an empty base URL falls back to the Model API root; a nil client gets a 30s timeout. The API key travels as a Bearer token and is never logged.
func (*SAMService) Segment ¶
func (s *SAMService) Segment( ctx context.Context, imageBytes []byte, concepts []string, ) ([]privacydomain.Detection, error)
Segment implements privacydomain.Segmenter. Concept calls fan out concurrently and are collected in vocabulary order, so the worst case stays near one call timeout instead of growing with every concept. The first error in vocabulary order wins and the scan fails closed.