github.com/weaviate/weaviate@v1.24.6/modules/text2vec-cohere/clients/url.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 clients
    13  
    14  import "fmt"
    15  
    16  type cohereUrlBuilder struct {
    17  	origin   string
    18  	pathMask string
    19  }
    20  
    21  func newCohereUrlBuilder() *cohereUrlBuilder {
    22  	return &cohereUrlBuilder{
    23  		origin:   "https://api.cohere.ai",
    24  		pathMask: "/v1/embed",
    25  	}
    26  }
    27  
    28  func (c *cohereUrlBuilder) url(baseURL string) string {
    29  	if baseURL != "" {
    30  		return fmt.Sprintf("%s%s", baseURL, c.pathMask)
    31  	}
    32  	return fmt.Sprintf("%s%s", c.origin, c.pathMask)
    33  }