github.com/weaviate/weaviate@v1.24.6/entities/modulecapabilities/vectorizer.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/go-openapi/strfmt" 18 "github.com/weaviate/weaviate/entities/additional" 19 "github.com/weaviate/weaviate/entities/models" 20 "github.com/weaviate/weaviate/entities/moduletools" 21 "github.com/weaviate/weaviate/entities/search" 22 ) 23 24 type Vectorizer interface { 25 // VectorizeObject should mutate the object which is passed in as a pointer-type 26 // by extending it with the desired vector and - if applicable - any meta 27 // information as part of _additional properties 28 VectorizeObject(ctx context.Context, obj *models.Object, comp moduletools.VectorizablePropsComparator, 29 cfg moduletools.ClassConfig) ([]float32, models.AdditionalProperties, error) 30 } 31 32 type FindObjectFn = func(ctx context.Context, class string, id strfmt.UUID, 33 props search.SelectProperties, adds additional.Properties, tenant string) (*search.Result, error) 34 35 // ReferenceVectorizer is implemented by ref2vec modules, which calculate a target 36 // object's vector based only on the vectors of its references. If the object has 37 // no references, the object will have a nil vector 38 type ReferenceVectorizer interface { 39 // VectorizeObject should mutate the object which is passed in as a pointer-type 40 // by extending it with the desired vector, which is calculated by the module 41 VectorizeObject(ctx context.Context, object *models.Object, 42 cfg moduletools.ClassConfig, findObjectFn FindObjectFn) ([]float32, error) 43 } 44 45 type InputVectorizer interface { 46 VectorizeInput(ctx context.Context, input string, 47 cfg moduletools.ClassConfig) ([]float32, error) 48 }