github.com/weaviate/weaviate@v1.24.6/modules/multi2vec-palm/nearArguments.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 modclip
    13  
    14  import (
    15  	"github.com/weaviate/weaviate/entities/modulecapabilities"
    16  	"github.com/weaviate/weaviate/usecases/modulecomponents/arguments/nearImage"
    17  	"github.com/weaviate/weaviate/usecases/modulecomponents/arguments/nearText"
    18  	"github.com/weaviate/weaviate/usecases/modulecomponents/arguments/nearVideo"
    19  )
    20  
    21  func (m *Module) initNearImage() error {
    22  	m.nearImageSearcher = nearImage.NewSearcher(m.imageVectorizer)
    23  	m.nearImageGraphqlProvider = nearImage.New()
    24  	return nil
    25  }
    26  
    27  func (m *Module) initNearText() error {
    28  	m.nearTextSearcher = nearText.NewSearcher(m.textVectorizer)
    29  	m.nearTextGraphqlProvider = nearText.New(m.nearTextTransformer)
    30  	return nil
    31  }
    32  
    33  func (m *Module) initNearVideo() error {
    34  	m.nearVideoSearcher = nearVideo.NewSearcher(m.videoVectorizer)
    35  	m.nearVideoGraphqlProvider = nearVideo.New()
    36  	return nil
    37  }
    38  
    39  func (m *Module) Arguments() map[string]modulecapabilities.GraphQLArgument {
    40  	arguments := map[string]modulecapabilities.GraphQLArgument{}
    41  	for name, arg := range m.nearImageGraphqlProvider.Arguments() {
    42  		arguments[name] = arg
    43  	}
    44  	for name, arg := range m.nearTextGraphqlProvider.Arguments() {
    45  		arguments[name] = arg
    46  	}
    47  	for name, arg := range m.nearVideoGraphqlProvider.Arguments() {
    48  		arguments[name] = arg
    49  	}
    50  	return arguments
    51  }
    52  
    53  func (m *Module) VectorSearches() map[string]modulecapabilities.VectorForParams {
    54  	vectorSearches := map[string]modulecapabilities.VectorForParams{}
    55  	for name, arg := range m.nearImageSearcher.VectorSearches() {
    56  		vectorSearches[name] = arg
    57  	}
    58  	for name, arg := range m.nearTextSearcher.VectorSearches() {
    59  		vectorSearches[name] = arg
    60  	}
    61  	for name, arg := range m.nearVideoSearcher.VectorSearches() {
    62  		vectorSearches[name] = arg
    63  	}
    64  	return vectorSearches
    65  }
    66  
    67  var (
    68  	_ = modulecapabilities.GraphQLArguments(New())
    69  	_ = modulecapabilities.Searcher(New())
    70  )