Documentation
¶
Index ¶
- Constants
- func BaseURLValidationEnabled() bool
- func GetGenericAdditionalProperty(name, className string) *modulecapabilities.AdditionalProperty
- func GetGenericArgument(name, className string, argumentType ArgumentType, ...) *graphql.ArgumentConfig
- func GetGenericGenerateProperty(className string, ...) *modulecapabilities.AdditionalProperty
- func GetRateLimitFromContext(ctx context.Context, moduleName string, defaultRPM, defaultTPM int) (int, int)
- func GetTotalTokens(usage *Usage) int
- func GetValueFromContext(ctx context.Context, key string) string
- func GetValueFromGRPC(ctx context.Context, key string) []string
- func NewBaseHttpClient(timeout time.Duration) *http.Client
- func ValidateBaseURL(baseURL string) error
- func ValidateGoogleApiEndpoint(apiEndpoint string) error
- func ValidateGoogleLocation(property, location string) error
- func ValidatedBaseURLFromHeader(ctx context.Context, headerKey, fallback string) (string, error)
- type ArgumentType
- type RateLimits
- func (rl *RateLimits) CanSendFullBatch(numRequests int, batchTokens int, addMetrics bool, metricsLabel string) bool
- func (rl *RateLimits) CheckForReset()
- func (rl *RateLimits) IsInitialized() bool
- func (rl *RateLimits) ResetAfterRequestFunction(tokensUsed int)
- func (rl *RateLimits) UpdateWithRateLimit(other *RateLimits)
- type Usage
- type VectorizationCLIPResult
- type VectorizationResult
Constants ¶
const AdditionalPropertyGenerate = additional.PropertyGenerate
Variables ¶
This section is empty.
Functions ¶
func BaseURLValidationEnabled ¶ added in v1.36.19
func BaseURLValidationEnabled() bool
BaseURLValidationEnabled reports whether SSRF hardening of module baseURLs is on. Gated behind MODULES_VALIDATE_BASE_URL so operators that legitimately target HTTP proxies or private-network gateways are not broken by default.
func GetGenericAdditionalProperty ¶ added in v1.24.0
func GetGenericAdditionalProperty(name, className string) *modulecapabilities.AdditionalProperty
func GetGenericArgument ¶ added in v1.24.0
func GetGenericArgument(name, className string, argumentType ArgumentType, nearTextTransformer modulecapabilities.TextTransform, ) *graphql.ArgumentConfig
func GetGenericGenerateProperty ¶ added in v1.26.0
func GetGenericGenerateProperty( className string, additionalGenerativeParameters map[string]modulecapabilities.GenerativeProperty, defaultProviderName string, logger logrus.FieldLogger, ) *modulecapabilities.AdditionalProperty
func GetRateLimitFromContext ¶ added in v1.25.0
func GetTotalTokens ¶ added in v1.25.25
func GetValueFromContext ¶ added in v1.24.16
func GetValueFromGRPC ¶ added in v1.22.3
func NewBaseHttpClient ¶ added in v1.35.17
NewBaseHttpClient creates an http.Client that does not follow redirects and resends a request whose pooled connection broke before a response arrived, so an origin may see the same request more than once. The timeout lives in the transport, not http.Client.Timeout, so replacing Transport also removes it. When MODULES_VALIDATE_BASE_URL is enabled it also installs a dial guard rejecting internal addresses — the network-layer SSRF backstop covering every client and baseURL source (config, headers, redirects).
func ValidateBaseURL ¶ added in v1.36.19
ValidateBaseURL validates a module baseURL (class config or X-*-Baseurl header) against SSRF abuse: https-only, non-empty host, and not pointing at an internal address (by IP literal, by blocked hostname/suffix, or by DNS resolution). It is a no-op unless MODULES_VALIDATE_BASE_URL is enabled; an empty baseURL means "use the module default" and is allowed.
func ValidateGoogleApiEndpoint ¶ added in v1.37.16
ValidateGoogleApiEndpoint rejects an apiEndpoint outside Google's API domain. The Google modules attach the operator's Google credential to every request they send - with USE_GOOGLE_AUTH that is a broadly scoped OAuth token - so an endpoint pointing elsewhere hands that credential to a foreign host. Unlike ValidateBaseURL this is enforced unconditionally: these modules speak only to Google. An empty value means "use the module default".
func ValidateGoogleLocation ¶ added in v1.37.16
ValidateGoogleLocation rejects a location or region that is not a plain Google region name. The Google modules interpolate it into the request host (<region>-aiplatform.googleapis.com), so a value carrying a "/" or an "@" can move the request off Google's domain the same way an apiEndpoint can. The property name is passed in because the modules call it for both "location" and "region". An empty value means "use the module default".
func ValidatedBaseURLFromHeader ¶ added in v1.36.19
ValidatedBaseURLFromHeader returns the baseURL carried in the given request header if present and valid, otherwise fallback. Validation is a no-op unless MODULES_VALIDATE_BASE_URL is enabled. It folds the recurring fetch-check-validate-assign block in module URL builders into one call.
Types ¶
type ArgumentType ¶ added in v1.24.0
type ArgumentType int
const ( Get ArgumentType = iota Aggregate Explore )
type RateLimits ¶ added in v1.25.0
type RateLimits struct {
LastOverwrite time.Time
AfterRequestFunction func(limits *RateLimits, tokensUsed int, deductRequest bool)
LimitRequests int
LimitTokens int
RemainingRequests int
RemainingTokens int
ReservedRequests int
ReservedTokens int
ResetRequests time.Time
ResetTokens time.Time
Label string
UpdateWithMissingValues bool
}
func (*RateLimits) CanSendFullBatch ¶ added in v1.25.13
func (*RateLimits) CheckForReset ¶ added in v1.25.0
func (rl *RateLimits) CheckForReset()
func (*RateLimits) IsInitialized ¶ added in v1.25.0
func (rl *RateLimits) IsInitialized() bool
func (*RateLimits) ResetAfterRequestFunction ¶ added in v1.25.0
func (rl *RateLimits) ResetAfterRequestFunction(tokensUsed int)
func (*RateLimits) UpdateWithRateLimit ¶ added in v1.25.25
func (rl *RateLimits) UpdateWithRateLimit(other *RateLimits)