File size: 1,952 Bytes
c8f6dca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | // _ _
// __ _____ __ ___ ___ __ _| |_ ___
// \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
// \ V V / __/ (_| |\ V /| | (_| | || __/
// \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
//
// Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
//
// CONTACT: hello@weaviate.io
//
package text2vecbase
import (
"context"
"github.com/weaviate/weaviate/entities/dto"
"github.com/weaviate/weaviate/entities/models"
"github.com/weaviate/weaviate/entities/moduletools"
"github.com/weaviate/weaviate/usecases/modulecomponents"
"github.com/weaviate/weaviate/usecases/modulecomponents/batch"
objectsvectorizer "github.com/weaviate/weaviate/usecases/modulecomponents/vectorizer"
)
type TextVectorizer[T dto.Embedding] interface {
Object(ctx context.Context, object *models.Object,
cfg moduletools.ClassConfig) (T, models.AdditionalProperties, error)
Texts(ctx context.Context, input []string,
cfg moduletools.ClassConfig) (T, error)
}
type TextVectorizerBatch[T dto.Embedding] interface {
Texts(ctx context.Context, input []string,
cfg moduletools.ClassConfig) (T, error)
Object(ctx context.Context, object *models.Object,
cfg moduletools.ClassConfig, cs objectsvectorizer.ClassSettings) (T, models.AdditionalProperties, error)
ObjectBatch(ctx context.Context, objects []*models.Object, skipObject []bool, cfg moduletools.ClassConfig) ([]T, map[int]error)
}
type MetaProvider interface {
MetaInfo() (map[string]interface{}, error)
}
type BatchVectorizer[T dto.Embedding] struct {
client BatchClient[T]
objectVectorizer *objectsvectorizer.ObjectVectorizer
batchVectorizer *batch.Batch[T]
tokenizerFunc batch.TokenizerFuncType
encoderCache *batch.EncoderCache
}
type BatchClient[T dto.Embedding] interface {
batch.BatchClient[T]
VectorizeQuery(ctx context.Context, input []string,
cfg moduletools.ClassConfig) (*modulecomponents.VectorizationResult[T], error)
}
|