github.com/weaviate/weaviate@v1.24.6/modules/multi2vec-clip/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  )
    19  
    20  func (m *ClipModule) initNearImage() error {
    21  	m.nearImageSearcher = nearImage.NewSearcher(m.imageVectorizer)
    22  	m.nearImageGraphqlProvider = nearImage.New()
    23  	return nil
    24  }
    25  
    26  func (m *ClipModule) initNearText() error {
    27  	m.nearTextSearcher = nearText.NewSearcher(m.textVectorizer)
    28  	m.nearTextGraphqlProvider = nearText.New(m.nearTextTransformer)
    29  	return nil
    30  }
    31  
    32  func (m *ClipModule) Arguments() map[string]modulecapabilities.GraphQLArgument {
    33  	arguments := map[string]modulecapabilities.GraphQLArgument{}
    34  	for name, arg := range m.nearImageGraphqlProvider.Arguments() {
    35  		arguments[name] = arg
    36  	}
    37  	for name, arg := range m.nearTextGraphqlProvider.Arguments() {
    38  		arguments[name] = arg
    39  	}
    40  	return arguments
    41  }
    42  
    43  func (m *ClipModule) VectorSearches() map[string]modulecapabilities.VectorForParams {
    44  	vectorSearches := map[string]modulecapabilities.VectorForParams{}
    45  	for name, arg := range m.nearImageSearcher.VectorSearches() {
    46  		vectorSearches[name] = arg
    47  	}
    48  	for name, arg := range m.nearTextSearcher.VectorSearches() {
    49  		vectorSearches[name] = arg
    50  	}
    51  	return vectorSearches
    52  }
    53  
    54  var (
    55  	_ = modulecapabilities.GraphQLArguments(New())
    56  	_ = modulecapabilities.Searcher(New())
    57  )