github.com/weaviate/weaviate@v1.24.6/entities/modulecapabilities/classification.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 package modulecapabilities 13 14 import ( 15 "context" 16 17 "github.com/weaviate/weaviate/entities/filters" 18 "github.com/weaviate/weaviate/entities/models" 19 "github.com/weaviate/weaviate/entities/schema" 20 "github.com/weaviate/weaviate/entities/search" 21 ) 22 23 type VectorClassSearchParams struct { 24 Filters *filters.LocalFilter 25 Pagination *filters.Pagination 26 ClassName string 27 Properties []string 28 } 29 30 type VectorClassSearchRepo interface { 31 VectorClassSearch(ctx context.Context, params VectorClassSearchParams) ([]search.Result, error) 32 } 33 34 type ClassifyParams struct { 35 Schema schema.Schema 36 Params models.Classification 37 Filters Filters 38 UnclassifiedItems []search.Result 39 VectorRepo VectorClassSearchRepo 40 } 41 42 type Filters interface { 43 Source() *filters.LocalFilter 44 Target() *filters.LocalFilter 45 TrainingSet() *filters.LocalFilter 46 } 47 48 type Writer interface { 49 Start() 50 Store(item search.Result) error 51 Stop() WriterResults 52 } 53 54 type WriterResults interface { 55 SuccessCount() int64 56 ErrorCount() int64 57 Err() error 58 } 59 60 type ClassifyItemFn func(item search.Result, itemIndex int, 61 params models.Classification, filters Filters, writer Writer) error 62 63 type Classifier interface { 64 Name() string 65 ClassifyFn(params ClassifyParams) (ClassifyItemFn, error) 66 ParseClassifierSettings(params *models.Classification) error 67 } 68 69 type ClassificationProvider interface { 70 Classifiers() []Classifier 71 }