Documentation
¶
Index ¶
- type AdditionalProperties
- type AdditionalProperty
- type AdditionalPropertyFn
- type AdditionalPropertyWithSearchVector
- type AdditionalSearch
- type AggregateArgumentsFn
- type ArgumentVectorForParams
- 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 Filters
- type FindObjectFn
- type FindVectorFn
- type GetArgumentsFn
- type GraphQLArgument
- type GraphQLArguments
- type GraphQLFieldFn
- type InputVectorizer
- type MetaProvider
- type Module
- type ModuleArgumentVectorForParams
- type ModuleDependency
- type ModuleExtension
- type ModuleHasAltNames
- type ModuleType
- type NearParam
- 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 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 ¶
type AdditionalPropertyWithSearchVector interface {
SetSearchVector(vector []float32)
}
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 ArgumentVectorForParams ¶
type ArgumentVectorForParams = map[string]VectorForParams
ArgumentVectorForParams contains argument definitions and it's respective vector for params search method
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 home directory of all backup files
HomeDir(backupID string) string
// GetObject giving backupID and key
GetObject(ctx context.Context, backupID, key string) ([]byte, 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 string) error
// SourceDataPath is data path of all source files
SourceDataPath() string
// PutFile reads a file from srcPath and uploads it to the destination folder
PutFile(ctx context.Context, backupID, key, srcPath string) error
// PutObject writes bytes to the object with key `key`
PutObject(ctx context.Context, backupID, key 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 string) error
Write(ctx context.Context, backupID, key string, r io.ReadCloser) (int64, error)
Read(ctx context.Context, backupID, key 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 interface {
ModuleName() string
Argument() string
GraphQLArgument() GraphQLArgument
VectorSearch() VectorForParams
}
type DependencySearcher ¶
type DependencySearcher interface {
VectorSearches() ModuleArgumentVectorForParams
}
DependencySearcher defines all of the available searches loaded as a dependency
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{}
ExtractFn extracts graphql params to given struct implementation
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 = func(ctx context.Context, className string, id strfmt.UUID, tenant, targetVector string) ([]float32, string, error)
FindVectorFn method for getting a vector of given object by its ID
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 InputVectorizer ¶
type InputVectorizer interface {
VectorizeInput(ctx context.Context, input string,
cfg moduletools.ClassConfig) ([]float32, 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 ModuleArgumentVectorForParams ¶
type ModuleArgumentVectorForParams = map[string]ArgumentVectorForParams
ModuleArgumentVectorForParams contains module's argument definitions and it's vector for params search method
type ModuleDependency ¶
type ModuleExtension ¶
type ModuleHasAltNames ¶
type ModuleHasAltNames interface {
AltNames() []string
}
type ModuleType ¶
type ModuleType string
const ( Backup ModuleType = "Backup" Extension ModuleType = "Extension" Img2Vec ModuleType = "Img2Vec" Multi2Vec ModuleType = "Multi2Vec" Ref2Vec ModuleType = "Ref2Vec" Text2MultiVec ModuleType = "Text2MultiVec" 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 ReferenceVectorizer ¶
type ReferenceVectorizer 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) ([]float32, 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 interface {
VectorSearches() ArgumentVectorForParams
}
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 = func(ctx context.Context, params interface{}, className string, findVectorFn FindVectorFn, cfg moduletools.ClassConfig) ([]float32, 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 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) ([]float32, 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) ([][]float32, []models.AdditionalProperties, map[int]error)
}
type VectorizerClient ¶
type Writer ¶
type Writer interface {
Start()
Store(item search.Result) error
Stop() WriterResults
}