Documentation
¶
Overview ¶
Package clipprobe talks to the external immich-clip-probe service (https://github.com/dhcgn/immich-clip-probe/), which exposes Immich's CLIP similarity search for files that are not in Immich yet. It is the only place that does raw HTTP for clip-probe; command and workflow code must go through Client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ValidTypes = []string{"IMAGE", "VIDEO", "all"}
ValidTypes is the closed set accepted by POST /v1/similar ?type=.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to one clip-probe service. No Immich credentials are ever sent here — the token is the service's own API_TOKEN (x-api-key header).
func New ¶
New builds a Client for the service origin (e.g. https://clip-probe.example.com/).
func (*Client) FindSimilar ¶
func (c *Client) FindSimilar(ctx context.Context, filePath string, opts Options) (*SimilarResponse, []byte, error)
FindSimilar posts one image file and returns the decoded response plus the raw body (for --json output). An empty Matches is not an error.
type Links ¶
type Links struct {
Web string `json:"web,omitempty"`
Thumbnail string `json:"thumbnail,omitempty"`
}
Links holds deep links to a match. Absent unless the service is configured with PUBLIC_IMMICH_URL.
type Match ¶
type Match struct {
AssetID string `json:"assetId"`
OriginalFileName string `json:"originalFileName"`
Type string `json:"type"`
LocalDateTime string `json:"localDateTime,omitempty"`
FileCreatedAt string `json:"fileCreatedAt,omitempty"`
OwnerID string `json:"ownerId,omitempty"`
Distance float64 `json:"distance"`
Similarity float64 `json:"similarity"`
Links *Links `json:"links,omitempty"`
}
Match is one visually-nearest asset, ascending by Distance.
type Options ¶
Options maps 1:1 to the /v1/similar query parameters.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions mirrors the service defaults (openapi.yaml).
type Query ¶
type Query struct {
FileName string `json:"fileName,omitempty"`
Bytes int64 `json:"bytes"`
Width int `json:"width"`
Height int `json:"height"`
Normalized bool `json:"normalized"`
Model string `json:"model"`
Dimensions int `json:"dimensions"`
}
Query describes what the service actually embedded.
type SimilarResponse ¶
type SimilarResponse struct {
Query Query `json:"query"`
Duplicate bool `json:"duplicate"`
MaxDistance float64 `json:"maxDistance"`
Matches []Match `json:"matches"`
Timings *Timings `json:"timings,omitempty"`
}
SimilarResponse is the POST /v1/similar payload. An empty Matches array is a normal result (nothing close enough).