infrastructure

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func WithBaseURL(url string) SAMOption

WithBaseURL overrides the Model API root (tests).

func WithHTTPClient

func WithHTTPClient(client *http.Client) SAMOption

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL