Documentation
¶
Index ¶
- type AdditionalGenerativeProperties
- type AdditionalProperties
- type AdditionalProperty
- type AdditionalPropertyFn
- type AdditionalPropertyWithSearchVector
- type AdditionalSearch
- type AggregateArgumentsFn
- type BackupBackend
- type ClassConfigurator
- type ClassificationProvider
- type Classifier
- type ClassifyItemFn
- type ClassifyParams
- type Client
- type Dependency
- type DependencySearcher
- type ExploreArgumentsFn
- type ExtractAdditionalFn
- type ExtractFn
- type ExtractRequestParamsFn
- type Filters
- type FindObjectFn
- type FindVectorFn
- type GenerateDebugInformation
- type GenerateResponse
- type GenerativeClient
- type GenerativeProperty
- type GetArgumentsFn
- type GraphQLArgument
- type GraphQLArguments
- type GraphQLFieldFn
- type GraphQLInputFieldFn
- type InputVectorizer
- type MetaProvider
- type Module
- type ModuleDependency
- type ModuleExtension
- type ModuleHasAltNames
- type ModuleType
- type NearParam
- type OffloadCloud
- type ReferenceVectorizer
- type Searcher
- type TextTransform
- type TextTransformers
- type ValidateFn
- type VectorClassSearchParams
- type VectorClassSearchRepo
- type VectorForParams
- type Vectorizer
- type VectorizerClient
- type Writer
- type WriterResults
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdditionalGenerativeProperties ¶ added in v1.26.0
type AdditionalGenerativeProperties interface {
AdditionalGenerativeProperties() map[string]GenerativeProperty
}
AdditionalGenerativeProperties groups whole interface methods needed for adding the capability of additional generative properties
type AdditionalProperties ¶
type AdditionalProperties interface {
AdditionalProperties() map[string]AdditionalProperty
}
AdditionalProperties groups whole interface methods needed for adding the capability of additional properties
type AdditionalProperty ¶
type AdditionalProperty struct {
RestNames []string
DefaultValue interface{}
GraphQLNames []string
GraphQLFieldFunction GraphQLFieldFn
GraphQLExtractFunction ExtractAdditionalFn
SearchFunctions AdditionalSearch
}
AdditionalProperty defines all the needed settings / methods to be set in order to add the additional property to Weaviate
type AdditionalPropertyFn ¶
type AdditionalPropertyFn = func(ctx context.Context, in []search.Result, params interface{}, limit *int, argumentModuleParams map[string]interface{}, cfg moduletools.ClassConfig) ([]search.Result, error)
AdditionalPropertyFn defines interface for additional property functions performing given logic
type AdditionalPropertyWithSearchVector ¶
AdditionalPropertyWithSearchVector defines additional property params with the ability to pass search vector
type AdditionalSearch ¶
type AdditionalSearch struct {
ObjectGet AdditionalPropertyFn
ObjectList AdditionalPropertyFn
ExploreGet AdditionalPropertyFn
ExploreList AdditionalPropertyFn
}
AdditionalSearch defines on which type of query a given additional logic can be performed
type AggregateArgumentsFn ¶
type AggregateArgumentsFn = func(classname string) *graphql.ArgumentConfig
AggregateArgumentsFn generates aggregate graphql config for a given classname
type BackupBackend ¶
type BackupBackend interface {
// IsExternal returns whether the storage is an external storage (e.g. gcs, s3)
IsExternal() bool
// Name returns backend's name
Name() string
// HomeDir is the base storage location of all backup files, which can be a bucket, a directory, etc.
HomeDir(backupID, overrideBucket, overridePath string) string
// GetObject giving backupID and key
GetObject(ctx context.Context, backupID, key, overrideBucket, overridePath string) ([]byte, error)
// AllBackups returns the top level metadata for all attempted backups
AllBackups(ctx context.Context) ([]*backup.DistributedBackupDescriptor, error)
// WriteToFile writes an object in the specified file with path destPath
// The file will be created if it doesn't exist
// The file will be overwritten if it exists
WriteToFile(ctx context.Context, backupID, key, destPath, overrideBucket, overridePath string) error
// SourceDataPath is data path of all source files
SourceDataPath() string
// PutObject writes bytes to the object with key `key`
// bucketName and bucketPath override the initialised bucketName and bucketPath
PutObject(ctx context.Context, backupID, key, overrideBucket, overridePath string, byes []byte) error
// Initialize initializes backup provider and make sure that app have access rights to write into the object store.
Initialize(ctx context.Context, backupID, overrideBucket, overridePath string) error
// Write writes the content of the reader to the object with key
// bucketName and bucketPath override the initialised bucketName and bucketPath
// Allows restores from a different bucket to the designated backup bucket
Write(ctx context.Context, backupID, key, overrideBucket, overridePath string, r io.ReadCloser) (int64, error)
Read(ctx context.Context, backupID, key, overrideBucket, overridePath string, w io.WriteCloser) (int64, error)
}
type ClassConfigurator ¶
type ClassConfigurator interface {
// ClassDefaults provides the defaults for a per-class module config. The
// module provider will merge the props into the user-specified config with
// the user-provided values taking precedence
ClassConfigDefaults() map[string]interface{}
// PropertyConfigDefaults provides the defaults for a per-property module
// config. The module provider will merge the props into the user-specified
// config with the user-provided values taking precedence. The property's
// dataType MAY be taken into consideration when deciding defaults.
// dataType is not guaranteed to be non-nil, it might be nil in the case a
// user specified an invalid dataType, as some validation only occurs after
// defaults are set.
PropertyConfigDefaults(dataType *schema.DataType) map[string]interface{}
// ValidateClass MAY validate anything about the class, except the config of
// another module. The specified ClassConfig can be used to easily retrieve
// the config specific for the module. For example, a module could iterate
// over class.Properties and call classConfig.Property(prop.Name) to validate
// the per-property config. A module MUST NOT extract another module's config
// from class.ModuleConfig["other-modules-name"].
ValidateClass(ctx context.Context, class *models.Class,
classConfig moduletools.ClassConfig) error
}
ClassConfigurator is an optional capability interface which a module MAY implement. If it is implemented, all methods will be called when the user adds or updates a class which has the module set as the vectorizer
type ClassificationProvider ¶
type ClassificationProvider interface {
Classifiers() []Classifier
}
type Classifier ¶
type Classifier interface {
Name() string
ClassifyFn(params ClassifyParams) (ClassifyItemFn, error)
ParseClassifierSettings(params *models.Classification) error
}
type ClassifyItemFn ¶
type ClassifyParams ¶
type ClassifyParams struct {
GetClass func(string) *models.Class
Params models.Classification
Filters Filters
UnclassifiedItems []search.Result
VectorRepo VectorClassSearchRepo
}
type Client ¶
type Client interface {
Vectorizers() map[string]VectorizerClient
}
type Dependency ¶
type Dependency[T dto.Embedding] interface { ModuleName() string Argument() string GraphQLArgument() GraphQLArgument VectorSearch() VectorForParams[T] }
type DependencySearcher ¶
type DependencySearcher[T dto.Embedding] interface { VectorSearches() map[string]map[string]VectorForParams[T] }
DependencySearcher defines all of the available searches loaded as a dependency for this time it's limited to modules providing []float32 embeddings
type ExploreArgumentsFn ¶
type ExploreArgumentsFn = func() *graphql.ArgumentConfig
ExploreArgumentsFn generates explore graphql config
type ExtractAdditionalFn ¶
ExtractAdditionalFn extracts parameters from graphql queries
type ExtractFn ¶
type ExtractFn = func(param map[string]interface{}) (interface{}, *dto.TargetCombination, error)
ExtractFn extracts graphql params to given struct implementation
type ExtractRequestParamsFn ¶ added in v1.26.0
type ExtractRequestParamsFn = func(field *ast.ObjectField) interface{}
ExtractRequestParamsFn extracts specific generative API parameters from graphql queries
type Filters ¶
type Filters interface {
Source() *filters.LocalFilter
Target() *filters.LocalFilter
TrainingSet() *filters.LocalFilter
}
type FindObjectFn ¶
type FindObjectFn = func(ctx context.Context, class string, id strfmt.UUID, props search.SelectProperties, adds additional.Properties, tenant string) (*search.Result, error)
type FindVectorFn ¶
type FindVectorFn[T dto.Embedding] interface { FindVector(ctx context.Context, className string, id strfmt.UUID, tenant, targetVector string) (T, string, error) }
FindVectorFn method for getting a vector of given object by its ID type FindVectorFn = func(ctx context.Context, className string, id strfmt.UUID, tenant, targetVector string) ([]float32, string, error)
type GenerateDebugInformation ¶ added in v1.26.0
type GenerateDebugInformation struct {
Prompt string
}
GenerateDebugInformation exposes debug information
type GenerateResponse ¶ added in v1.26.0
type GenerateResponse struct {
Result *string
Params map[string]interface{}
Debug *GenerateDebugInformation
}
GenerateResponse defines generative response. Params files hold module specific response parameters
type GenerativeClient ¶ added in v1.26.0
type GenerativeClient interface {
GenerateSingleResult(ctx context.Context,
textProperties map[string]string, prompt string, requestParams interface{}, debug bool, cfg moduletools.ClassConfig,
) (*GenerateResponse, error)
GenerateAllResults(ctx context.Context,
textProperties []map[string]string, task string, requestParams interface{}, debug bool, cfg moduletools.ClassConfig,
) (*GenerateResponse, error)
}
GenerativeClient defines generative client
type GenerativeProperty ¶ added in v1.26.0
type GenerativeProperty struct {
Client GenerativeClient
RequestParamsFunction GraphQLInputFieldFn
ResponseParamsFunction GraphQLFieldFn
ExtractRequestParamsFunction ExtractRequestParamsFn
}
GenerativeProperty defines all needed additional request / response parameters only client setting is manadatory as we can have generative modules that don't expose any additional request / response params.
type GetArgumentsFn ¶
type GetArgumentsFn = func(classname string) *graphql.ArgumentConfig
GetArgumentsFn generates get graphql config for a given classname
type GraphQLArgument ¶
type GraphQLArgument struct {
GetArgumentsFunction GetArgumentsFn
AggregateArgumentsFunction AggregateArgumentsFn
ExploreArgumentsFunction ExploreArgumentsFn
ExtractFunction ExtractFn
ValidateFunction ValidateFn
}
GraphQLArgument defines all the needed settings / methods to add a module specific graphql argument
type GraphQLArguments ¶
type GraphQLArguments interface {
Arguments() map[string]GraphQLArgument
}
GraphQLArguments defines the capabilities of modules to add their arguments to graphql API
type GraphQLFieldFn ¶
GraphQLFieldFn generates graphql field based on classname
type GraphQLInputFieldFn ¶ added in v1.26.0
type GraphQLInputFieldFn = func(classname string) *graphql.InputObjectFieldConfig
GraphQLFieldFn generates graphql input fields
type InputVectorizer ¶
type InputVectorizer[T dto.Embedding] interface { VectorizeInput(ctx context.Context, input string, cfg moduletools.ClassConfig) (T, error) }
type MetaProvider ¶
type Module ¶
type Module interface {
Name() string
Init(ctx context.Context, params moduletools.ModuleInitParams) error
RootHandler() http.Handler // TODO: remove from overall module, this is a capability
Type() ModuleType
}
type ModuleDependency ¶
type ModuleExtension ¶
type ModuleHasAltNames ¶
type ModuleHasAltNames interface {
AltNames() []string
}
type ModuleType ¶
type ModuleType string
const ( Offload ModuleType = "Offload" Backup ModuleType = "Backup" Extension ModuleType = "Extension" Img2Vec ModuleType = "Img2Vec" Multi2Vec ModuleType = "Multi2Vec" Ref2Vec ModuleType = "Ref2Vec" Text2MultiVec ModuleType = "Text2MultiVec" Text2ColBERT ModuleType = "Text2ColBERT" Text2TextGenerative ModuleType = "Text2TextGenerative" Text2TextSummarize ModuleType = "Text2TextSummarize" Text2TextReranker ModuleType = "Text2TextReranker" Text2TextNER ModuleType = "Text2TextNER" Text2TextQnA ModuleType = "Text2TextQnA" Text2Vec ModuleType = "Text2Vec" )
type NearParam ¶
type NearParam interface {
GetCertainty() float64
GetDistance() float64
GetTargetVectors() []string
SimilarityMetricProvided() bool
}
NearParam defines params with certainty information
type OffloadCloud ¶ added in v1.26.0
type OffloadCloud interface {
// VerifyBucket verify if the offload bucket is created
VerifyBucket(ctx context.Context) error
// Upload uploads the content of a shard assigned to specific node to
// cloud provider (S3, Azure Blob storage, Google cloud storage)
// {cloud_provider}://{configured_bucket}/{className}/{shardName}/{nodeName}/{shard content}
Upload(ctx context.Context, className, shardName, nodeName string) error
// Download downloads the content of a shard to desired node from
// cloud provider (S3, Azure Blob storage, Google cloud storage)
// {dataPath}/{className}/{shardName}/{content}
Download(ctx context.Context, className, shardName, nodeName string) error
// Delete deletes content of a shard assigned to specific node in
// cloud provider (S3, Azure Blob storage, Google cloud storage)
// Careful: if shardName and nodeName is passed empty it will delete all class frozen shards in cloud storage
// {cloud_provider}://{configured_bucket}/{className}/{shardName}/{nodeName}/{shard content}
Delete(ctx context.Context, className, shardName, nodeName string) error
}
type ReferenceVectorizer ¶
type ReferenceVectorizer[T dto.Embedding] interface { // VectorizeObject should mutate the object which is passed in as a pointer-type // by extending it with the desired vector, which is calculated by the module VectorizeObject(ctx context.Context, object *models.Object, cfg moduletools.ClassConfig, findObjectFn FindObjectFn) (T, error) }
ReferenceVectorizer is implemented by ref2vec modules, which calculate a target object's vector based only on the vectors of its references. If the object has no references, the object will have a nil vector
type Searcher ¶
type Searcher[T dto.Embedding] interface { VectorSearches() map[string]VectorForParams[T] }
Searcher defines all methods for all searchers for getting a vector from a given raw searcher content
type TextTransform ¶
TextTransform performs text transformation operation
type TextTransformers ¶
type TextTransformers interface {
TextTransformers() map[string]TextTransform
}
TextTransformers defines all text transformers for given arguments
type ValidateFn ¶
type ValidateFn = func(param interface{}) error
ValidateFn validates a given module param
type VectorClassSearchParams ¶
type VectorClassSearchParams struct {
Filters *filters.LocalFilter
Pagination *filters.Pagination
ClassName string
Properties []string
}
type VectorClassSearchRepo ¶
type VectorForParams ¶
type VectorForParams[T dto.Embedding] interface { VectorForParams(ctx context.Context, params interface{}, className string, findVectorFn FindVectorFn[T], cfg moduletools.ClassConfig) (T, error) }
VectorForParams defines method for passing a raw searcher content to the module and exchanging it for a vector. Warning: Argument "cfg" (moduletools.ClassConfig) is not guaranteed to be non-nil. Implementations have to provide a nil check before using it. It is generally present on class-based action, but is not present on Cross-Class requests, such as Explore {}
type Vectorizer ¶
type Vectorizer[T dto.Embedding] interface { // VectorizeObject takes an object and returns a vector and - if applicable - any meta // information as part of _additional properties VectorizeObject(ctx context.Context, obj *models.Object, cfg moduletools.ClassConfig) (T, models.AdditionalProperties, error) // VectorizableProperties returns which properties the vectorizer looks at. // If the vectorizer is capable of vectorizing all text properties, the first bool is true. // Any additional "media"-properties are explicitly mentioned in the []string return VectorizableProperties(cfg moduletools.ClassConfig) (bool, []string, error) VectorizeBatch(ctx context.Context, objs []*models.Object, skipObject []bool, cfg moduletools.ClassConfig) ([]T, []models.AdditionalProperties, map[int]error) }
type VectorizerClient ¶
type Writer ¶
type Writer interface {
Start()
Store(item search.Result) error
Stop() WriterResults
}