modulecomponents

package
v0.0.0-...-5637490 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const AdditionalPropertyGenerate = additional.PropertyGenerate

Variables

This section is empty.

Functions

func GetGenericAdditionalProperty

func GetGenericAdditionalProperty(name, className string) *modulecapabilities.AdditionalProperty

func GetGenericArgument

func GetGenericArgument(name, className string, argumentType ArgumentType,
	nearTextTransformer modulecapabilities.TextTransform,
) *graphql.ArgumentConfig

func GetGenericGenerateProperty

func GetGenericGenerateProperty(
	className string,
	additionalGenerativeParameters map[string]modulecapabilities.GenerativeProperty,
	defaultProviderName string,
	logger logrus.FieldLogger,
) *modulecapabilities.AdditionalProperty

func GetRateLimitFromContext

func GetRateLimitFromContext(ctx context.Context, moduleName string, defaultRPM, defaultTPM int) (int, int)

func GetTotalTokens

func GetTotalTokens(usage *Usage) int

func GetValueFromContext

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

func GetValueFromGRPC

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

Types

type ArgumentType

type ArgumentType int
const (
	Get ArgumentType = iota
	Aggregate
	Explore
)

type RateLimits

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
}

func (*RateLimits) CanSendFullBatch

func (rl *RateLimits) CanSendFullBatch(numRequests int, batchTokens int) bool

func (*RateLimits) CheckForReset

func (rl *RateLimits) CheckForReset()

func (*RateLimits) IsInitialized

func (rl *RateLimits) IsInitialized() bool

func (*RateLimits) ResetAfterRequestFunction

func (rl *RateLimits) ResetAfterRequestFunction(tokensUsed int)

func (*RateLimits) UpdateWithRateLimit

func (rl *RateLimits) UpdateWithRateLimit(other *RateLimits)

type Usage

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

type VectorizationCLIPResult

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

type VectorizationResult

type VectorizationResult[T types.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