modulecomponents

package
v1.36.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
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 GetRateLimitFromContext(ctx context.Context, moduleName string, defaultRPM, defaultTPM int) (int, int)

func GetTotalTokens added in v1.25.25

func GetTotalTokens(usage *Usage) int

func GetValueFromContext added in v1.24.16

func GetValueFromContext(ctx context.Context, key string) string

func GetValueFromGRPC added in v1.22.3

func GetValueFromGRPC(ctx context.Context, key string) []string

func NewBaseHttpClient added in v1.35.17

func NewBaseHttpClient(timeout time.Duration) *http.Client

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

func ValidateBaseURL(baseURL string) error

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

func ValidatedBaseURLFromHeader(ctx context.Context, headerKey, fallback string) (string, error)

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 (rl *RateLimits) CanSendFullBatch(numRequests int, batchTokens int, addMetrics bool, metricsLabel string) bool

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)

type Usage added in v1.25.25

type Usage struct {
	CompletionTokens int `json:"completion_tokens,omitempty"`
	PromptTokens     int `json:"prompt_tokens,omitempty"`
	TotalTokens      int `json:"total_tokens,omitempty"`
}

type VectorizationCLIPResult added in v1.25.26

type VectorizationCLIPResult[T dto.Embedding] struct {
	TextVectors  []T
	ImageVectors []T
	VideoVectors []T
}

type VectorizationResult added in v1.25.0

type VectorizationResult[T dto.Embedding] struct {
	Text       []string
	Dimensions int
	Vector     []T
	Errors     []error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL