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 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 with the given timeout that does not follow redirects. 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 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)