meta

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMappedModelName

func GetMappedModelName(modelName string, mapping map[string]string) (string, bool)

Types

type ChannelMeta

type ChannelMeta struct {
	Name    string
	BaseURL string
	Key     string
	ID      int
	Type    int
}

type Meta

type Meta struct {
	Channel       *ChannelMeta
	ChannelConfig model.ChannelConfig
	Group         *model.GroupCache
	Token         *model.TokenCache
	ModelConfig   *model.ModelConfig

	Endpoint    string
	RequestAt   time.Time
	RetryAt     time.Time
	RequestID   string
	OriginModel string
	ActualModel string
	Mode        mode.Mode
	// TODO: remove this field
	InputTokens int
	// contains filtered or unexported fields
}

func NewMeta

func NewMeta(
	channel *model.Channel,
	mode mode.Mode,
	modelName string,
	modelConfig *model.ModelConfig,
	opts ...Option,
) *Meta

func (*Meta) ClearValues

func (m *Meta) ClearValues()

func (*Meta) Delete

func (m *Meta) Delete(key string)

func (*Meta) Get

func (m *Meta) Get(key string) (any, bool)

func (*Meta) GetBool

func (m *Meta) GetBool(key string) bool

func (*Meta) GetString

func (m *Meta) GetString(key string) string

func (*Meta) MustGet

func (m *Meta) MustGet(key string) any

func (*Meta) Set

func (m *Meta) Set(key string, value any)

type Option

type Option func(meta *Meta)

func WithEndpoint

func WithEndpoint(endpoint string) Option

func WithGroup

func WithGroup(group *model.GroupCache) Option

func WithInputTokens added in v0.1.5

func WithInputTokens(inputTokens int) Option

func WithRequestAt

func WithRequestAt(requestAt time.Time) Option

func WithRequestID

func WithRequestID(requestID string) Option

func WithRetryAt added in v0.1.5

func WithRetryAt(retryAt time.Time) Option

func WithToken

func WithToken(token *model.TokenCache) Option

Jump to

Keyboard shortcuts

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