github.com/weaviate/weaviate@v1.24.6/modules/text2vec-contextionary/additional/sempath/builder_params.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 sempath 13 14 import "github.com/weaviate/weaviate/entities/errorcompounder" 15 16 type Params struct { 17 SearchVector []float32 18 } 19 20 func (p *Params) SetSearchVector(vector []float32) { 21 p.SearchVector = vector 22 } 23 24 func (p *Params) SetDefaultsAndValidate(inputSize, dims int) error { 25 return p.validate(inputSize, dims) 26 } 27 28 func (p *Params) validate(inputSize, dims int) error { 29 ec := &errorcompounder.ErrorCompounder{} 30 if inputSize > 25 { 31 ec.Addf("result length %d is larger than 25 items: semantic path calculation is only suported up to 25 items, set a limit to <= 25", inputSize) 32 } 33 34 if p.SearchVector == nil || len(p.SearchVector) == 0 { 35 ec.Addf("no valid search vector present, got: %v", p.SearchVector) 36 } 37 38 return ec.ToError() 39 }