github.com/weaviate/weaviate@v1.24.6/modules/text2vec-contextionary/additional/additional_arguments.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 additional
    13  
    14  import (
    15  	"fmt"
    16  
    17  	"github.com/tailor-inc/graphql"
    18  )
    19  
    20  func additionalNearestNeighborsField(classname string) *graphql.Field {
    21  	return &graphql.Field{
    22  		Type: graphql.NewObject(graphql.ObjectConfig{
    23  			Name: fmt.Sprintf("%sAdditionalNearestNeighbors", classname),
    24  			Fields: graphql.Fields{
    25  				"neighbors": &graphql.Field{Type: graphql.NewList(graphql.NewObject(graphql.ObjectConfig{
    26  					Name: fmt.Sprintf("%sAdditionalNearestNeighborsNeighbor", classname),
    27  					Fields: graphql.Fields{
    28  						"concept":  &graphql.Field{Type: graphql.String},
    29  						"distance": &graphql.Field{Type: graphql.Float},
    30  					},
    31  				}))},
    32  			},
    33  		}),
    34  	}
    35  }
    36  
    37  func additionalFeatureProjectionField(classname string) *graphql.Field {
    38  	return &graphql.Field{
    39  		Args: graphql.FieldConfigArgument{
    40  			"algorithm": &graphql.ArgumentConfig{
    41  				Type:         graphql.String,
    42  				DefaultValue: nil,
    43  			},
    44  			"dimensions": &graphql.ArgumentConfig{
    45  				Type:         graphql.Int,
    46  				DefaultValue: nil,
    47  			},
    48  			"learningRate": &graphql.ArgumentConfig{
    49  				Type:         graphql.Int,
    50  				DefaultValue: nil,
    51  			},
    52  			"iterations": &graphql.ArgumentConfig{
    53  				Type:         graphql.Int,
    54  				DefaultValue: nil,
    55  			},
    56  			"perplexity": &graphql.ArgumentConfig{
    57  				Type:         graphql.Int,
    58  				DefaultValue: nil,
    59  			},
    60  		},
    61  		Type: graphql.NewObject(graphql.ObjectConfig{
    62  			Name: fmt.Sprintf("%sAdditionalFeatureProjection", classname),
    63  			Fields: graphql.Fields{
    64  				"vector": &graphql.Field{Type: graphql.NewList(graphql.Float)},
    65  			},
    66  		}),
    67  	}
    68  }
    69  
    70  func additionalSemanticPathField(classname string) *graphql.Field {
    71  	return &graphql.Field{
    72  		Type: graphql.NewObject(graphql.ObjectConfig{
    73  			Name: fmt.Sprintf("%sAdditionalSemanticPath", classname),
    74  			Fields: graphql.Fields{
    75  				"path": &graphql.Field{Type: graphql.NewList(graphql.NewObject(graphql.ObjectConfig{
    76  					Name: fmt.Sprintf("%sAdditionalSemanticPathElement", classname),
    77  					Fields: graphql.Fields{
    78  						"concept":            &graphql.Field{Type: graphql.String},
    79  						"distanceToQuery":    &graphql.Field{Type: graphql.Float},
    80  						"distanceToResult":   &graphql.Field{Type: graphql.Float},
    81  						"distanceToNext":     &graphql.Field{Type: graphql.Float},
    82  						"distanceToPrevious": &graphql.Field{Type: graphql.Float},
    83  					},
    84  				}))},
    85  			},
    86  		}),
    87  	}
    88  }
    89  
    90  func additionalInterpretationField(classname string) *graphql.Field {
    91  	return &graphql.Field{
    92  		Type: graphql.NewObject(graphql.ObjectConfig{
    93  			Name: fmt.Sprintf("%sAdditionalInterpretation", classname),
    94  			Fields: graphql.Fields{
    95  				"source": &graphql.Field{Type: graphql.NewList(graphql.NewObject(graphql.ObjectConfig{
    96  					Name: fmt.Sprintf("%sAdditionalInterpretationSource", classname),
    97  					Fields: graphql.Fields{
    98  						"concept":    &graphql.Field{Type: graphql.String},
    99  						"weight":     &graphql.Field{Type: graphql.Float},
   100  						"occurrence": &graphql.Field{Type: graphql.Int},
   101  					},
   102  				}))},
   103  			},
   104  		}),
   105  	}
   106  }