Documentation
¶
Index ¶
- Variables
- func AggregateEmbeddings(vectors [][]float32, weights []float32) []float32
- func BackfillAllAdsSync() (remaining int, err error)
- func BuildAdEmbedding(input ad.EmbeddingInput) error
- func BuildAdEmbeddings(inputs []ad.EmbeddingInput) error
- func ClearAllEmbeddingCaches()
- func ClearQueryEmbeddingCache()
- func ClearSiteEmbeddingCache()
- func ClearUserEmbeddingCache()
- func DeleteAdEmbedding(adID int) error
- func EmbedderInfo() (provider, model string)
- func GetAdEmbeddings(adIDs []int) ([][]float32, error)
- func GetEmbeddingCacheStats() map[string]map[string]interface{}
- func GetQueryEmbedding(userQuery string) ([]float32, error)
- func GetSiteEmbedding(categoryID int, campaignKey string) ([]float32, error)
- func GetUserPersonalizedEmbedding(userID, categoryID int) ([]float32, error)
- func InitEmbedder() error
- func InitEmbeddingCaches() error
- func InitOllamaClient() error
- func IsEmbeddingUnavailable(err error) bool
- func ProcessAdsWithoutVectors()
- func QuerySimilarAdIDs(embedding []float32, whereClause string, whereArgs []any, limit, offset int, ...) ([]int, error)
- func QueueAd(adID int)
- func QueueDepth() int
- func ResolveSearchEmbedding(userID, categoryID int, query string) ([]float32, error)
- func SetEmbedder(e Embedder)
- func StartBackgroundProcessor()
- func TriggerBackfill()
- func UpsertAdEmbeddings(adIDs []int, embeddings [][]float32, metadatas []map[string]any) error
- type ActivityInspect
- type AdActivity
- type Embedder
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoUserActivity = errors.New("no user activity to aggregate") ErrNoEmbeddedAds = errors.New("no embedded ads") )
Functions ¶
func AggregateEmbeddings ¶
func BackfillAllAdsSync ¶
func BuildAdEmbedding ¶
func BuildAdEmbedding(input ad.EmbeddingInput) error
func BuildAdEmbeddings ¶
func BuildAdEmbeddings(inputs []ad.EmbeddingInput) error
func ClearAllEmbeddingCaches ¶
func ClearAllEmbeddingCaches()
func ClearQueryEmbeddingCache ¶
func ClearQueryEmbeddingCache()
func ClearSiteEmbeddingCache ¶
func ClearSiteEmbeddingCache()
func ClearUserEmbeddingCache ¶
func ClearUserEmbeddingCache()
func DeleteAdEmbedding ¶
func EmbedderInfo ¶ added in v0.0.29
func EmbedderInfo() (provider, model string)
EmbedderInfo returns the Ollama provider identifier and model name.
func GetAdEmbeddings ¶
func GetEmbeddingCacheStats ¶
func GetQueryEmbedding ¶
func GetSiteEmbedding ¶
func InitEmbedder ¶ added in v0.0.29
func InitEmbedder() error
InitEmbedder initializes the local Ollama embedding backend.
func InitEmbeddingCaches ¶
func InitEmbeddingCaches() error
func InitOllamaClient ¶ added in v0.0.29
func InitOllamaClient() error
func IsEmbeddingUnavailable ¶ added in v0.0.27
IsEmbeddingUnavailable reports whether search should degrade gracefully instead of returning HTTP 500 (e.g. backfill still in progress).
func ProcessAdsWithoutVectors ¶
func ProcessAdsWithoutVectors()
func QuerySimilarAdIDs ¶
func QuerySimilarAdIDs(embedding []float32, whereClause string, whereArgs []any, limit, offset int, threshold float64) ([]int, error)
QuerySimilarAdIDs returns nearest ad IDs under threshold matching whereClause. whereClause placeholders start at $1 and are remapped after the embedding and threshold args.
func QueueDepth ¶
func QueueDepth() int
func ResolveSearchEmbedding ¶
func SetEmbedder ¶
func SetEmbedder(e Embedder)
func StartBackgroundProcessor ¶
func StartBackgroundProcessor()
func TriggerBackfill ¶
func TriggerBackfill()
Types ¶
type ActivityInspect ¶ added in v0.0.25
type ActivityInspect struct {
AdID int
AdTitle string
ActivityType string
Weight float32
Timestamp string
}
ActivityInspect holds one weighted activity row for admin display.
func InspectSiteActivities ¶ added in v0.0.25
func InspectSiteActivities(categoryID int) ([]ActivityInspect, error)
func InspectUserActivities ¶ added in v0.0.25
func InspectUserActivities(userID, categoryID int) ([]ActivityInspect, error)
type AdActivity ¶
Click to show internal directories.
Click to hide internal directories.