Documentation
¶
Overview ¶
Package enhancer provides functionality to enrich model data with metadata from external sources.
Index ¶
- type ChainEnhancer
- func (e *ChainEnhancer) Batch(ctx context.Context, models []*catalogs.Model) ([]*catalogs.Model, error)
- func (e *ChainEnhancer) CanEnhance(model *catalogs.Model) bool
- func (e *ChainEnhancer) Enhance(ctx context.Context, model *catalogs.Model) (*catalogs.Model, error)
- func (e *ChainEnhancer) Name() string
- func (e *ChainEnhancer) Priority() int
- type Enhancer
- type MetadataEnhancer
- func (e *MetadataEnhancer) CanEnhance(model catalogs.Model) bool
- func (e *MetadataEnhancer) Enhance(_ context.Context, model catalogs.Model) (catalogs.Model, error)
- func (e *MetadataEnhancer) EnhanceBatch(ctx context.Context, models []catalogs.Model) ([]catalogs.Model, error)
- func (e *MetadataEnhancer) Name() string
- func (e *MetadataEnhancer) Priority() int
- type ModelsDevEnhancer
- func (e *ModelsDevEnhancer) CanEnhance(model catalogs.Model) bool
- func (e *ModelsDevEnhancer) Enhance(_ context.Context, model catalogs.Model) (catalogs.Model, error)
- func (e *ModelsDevEnhancer) EnhanceBatch(ctx context.Context, models []catalogs.Model) ([]catalogs.Model, error)
- func (e *ModelsDevEnhancer) Name() string
- func (e *ModelsDevEnhancer) Priority() int
- type Pipeline
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainEnhancer ¶
type ChainEnhancer struct {
// contains filtered or unexported fields
}
ChainEnhancer allows chaining multiple enhancers with custom logic.
func NewChainEnhancer ¶
func NewChainEnhancer(priority int, enhancers ...Enhancer) *ChainEnhancer
NewChainEnhancer creates a new chain enhancer.
func (*ChainEnhancer) Batch ¶
func (e *ChainEnhancer) Batch(ctx context.Context, models []*catalogs.Model) ([]*catalogs.Model, error)
Batch enhances multiple models.
func (*ChainEnhancer) CanEnhance ¶
func (e *ChainEnhancer) CanEnhance(model *catalogs.Model) bool
CanEnhance checks if any enhancer in the chain can enhance.
func (*ChainEnhancer) Enhance ¶
func (e *ChainEnhancer) Enhance(ctx context.Context, model *catalogs.Model) (*catalogs.Model, error)
Enhance applies all enhancers in sequence.
func (*ChainEnhancer) Priority ¶
func (e *ChainEnhancer) Priority() int
Priority returns the priority.
type Enhancer ¶
type Enhancer interface {
// Name returns the enhancer name
Name() string
// Enhance enhances a single model with additional data
Enhance(ctx context.Context, model *catalogs.Model) (*catalogs.Model, error)
// EnhanceBatch enhances multiple models efficiently
EnhanceBatch(ctx context.Context, models []*catalogs.Model) ([]*catalogs.Model, error)
// CanEnhance checks if this enhancer can enhance a specific model
CanEnhance(model *catalogs.Model) bool
// Priority returns the priority of this enhancer (higher = applied first)
Priority() int
}
Enhancer defines the interface for model enrichment.
type MetadataEnhancer ¶
type MetadataEnhancer struct {
// contains filtered or unexported fields
}
MetadataEnhancer adds metadata from various sources.
func NewMetadataEnhancer ¶
func NewMetadataEnhancer(priority int) *MetadataEnhancer
NewMetadataEnhancer creates a new metadata enhancer.
func (*MetadataEnhancer) CanEnhance ¶
func (e *MetadataEnhancer) CanEnhance(model catalogs.Model) bool
CanEnhance checks if this enhancer can enhance a model.
func (*MetadataEnhancer) EnhanceBatch ¶
func (e *MetadataEnhancer) EnhanceBatch(ctx context.Context, models []catalogs.Model) ([]catalogs.Model, error)
EnhanceBatch enhances multiple models.
func (*MetadataEnhancer) Name ¶
func (e *MetadataEnhancer) Name() string
Name returns the enhancer name.
func (*MetadataEnhancer) Priority ¶
func (e *MetadataEnhancer) Priority() int
Priority returns the priority.
type ModelsDevEnhancer ¶
type ModelsDevEnhancer struct {
// contains filtered or unexported fields
}
ModelsDevEnhancer enhances models with models.dev data.
func NewModelsDevEnhancer ¶
func NewModelsDevEnhancer(priority int) *ModelsDevEnhancer
NewModelsDevEnhancer creates a new models.dev enhancer.
func (*ModelsDevEnhancer) CanEnhance ¶
func (e *ModelsDevEnhancer) CanEnhance(model catalogs.Model) bool
CanEnhance checks if this enhancer can enhance a model.
func (*ModelsDevEnhancer) Enhance ¶
func (e *ModelsDevEnhancer) Enhance(_ context.Context, model catalogs.Model) (catalogs.Model, error)
Enhance enhances a single model.
func (*ModelsDevEnhancer) EnhanceBatch ¶
func (e *ModelsDevEnhancer) EnhanceBatch(ctx context.Context, models []catalogs.Model) ([]catalogs.Model, error)
EnhanceBatch enhances multiple models.
func (*ModelsDevEnhancer) Name ¶
func (e *ModelsDevEnhancer) Name() string
Name returns the enhancer name.
func (*ModelsDevEnhancer) Priority ¶
func (e *ModelsDevEnhancer) Priority() int
Priority returns the priority.
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline manages a chain of enhancers.
func NewPipeline ¶
NewPipeline creates a new enhancer pipeline.
func (*Pipeline) WithProvenance ¶
func (p *Pipeline) WithProvenance(tracker provenance.Tracker) *Pipeline
WithProvenance enables provenance tracking for enhancements.