Documentation
¶
Index ¶
- func Batch(ctx context.Context, cfg config.Config, st *store.Store, opts Options) (Stats, []ItemResult, error)
- func BatchSources(ctx context.Context, cfg config.Config, st *store.Store, opts Options) (Stats, []SourceResult, error)
- func MergeUserTags(existing string, r Result) string
- type ItemResult
- type Options
- type Result
- type SourceResult
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Batch ¶
func Batch(ctx context.Context, cfg config.Config, st *store.Store, opts Options) (Stats, []ItemResult, error)
Batch categorizes multiple items (those without user_tags unless force is set).
func BatchSources ¶
func BatchSources(ctx context.Context, cfg config.Config, st *store.Store, opts Options) (Stats, []SourceResult, error)
BatchSources categorizes multiple sources (those without user_tags unless force is set).
func MergeUserTags ¶
MergeUserTags appends categorizer output to existing comma-separated user_tags while preserving the existing order and removing duplicates.
Types ¶
type ItemResult ¶
type ItemResult struct {
Item model.Item `json:"item"`
Result Result `json:"result,omitempty"`
Error string `json:"error,omitempty"`
}
ItemResult pairs an item with its categorization result or error.
type Options ¶
type Options struct {
RootDir string
Model string
Timeout time.Duration
Concurrency int
Limit int
Force bool
Apply bool // save result back to user_tags
IncludeImages bool // embed local or archived photos as base64 for vision models
OpenRouterBase string
OpenRouterKey string
OpenRouterRef string
OpenRouterTitle string
UserAgent string
OllamaBase string
OllamaKey string
LMStudioBase string
LMStudioKey string
ProviderOverrides map[llmprovider.Provider]llmprovider.ProviderOverrides
// InferenceParams carries optional provider-specific sampler parameters
// used by parity-aware bakeoff runs. Normal categorize callers leave
// this empty so provider/runtime defaults apply.
InferenceParams llmprovider.ParityParams
// R2/S3 credentials for fetching archived photos not present locally.
S3Endpoint string
S3Region string
S3AccessKey string
S3SecretKey string
// Vocab is the optional canonical vocabulary loaded from categories.yaml.
Vocab categoryvocab.Vocab
// OnStart is called after item selection, before worker goroutines start.
OnStart func(total int)
// OnResult is called from worker goroutines as each item completes.
// It must be safe to call concurrently. Leave nil to skip streaming output.
OnResult func(ItemResult)
// OnSourceResult is called from worker goroutines as each source completes.
// It must be safe to call concurrently. Leave nil to skip streaming output.
OnSourceResult func(SourceResult)
}
Options configures a categorize run.
type Result ¶
type Result struct {
Categories []string `json:"categories"`
Tags []string `json:"tags"`
PrimaryCategory string `json:"primary_category"`
Model string `json:"model"`
RawResponse string `json:"raw_response,omitempty"`
}
Result holds the LLM categorization output for one item.
type SourceResult ¶
type SourceResult struct {
Source model.SourceDocument `json:"source"`
Result Result `json:"result,omitempty"`
Error string `json:"error,omitempty"`
}
SourceResult pairs a source with its categorization result or error.