providers

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory is used to create ChatModel for different providers

func NewFactory

func NewFactory(cfg *config.Config) *Factory

NewFactory creates a new Factory

func (*Factory) CreateChatModel

func (f *Factory) CreateChatModel(ctx context.Context, modelName string) (model.ToolCallingChatModel, error)

CreateChatModel creates corresponding ChatModel based on model name

type MixedChatModel added in v1.5.2

type MixedChatModel struct {
	// contains filtered or unexported fields
}

MixedChatModel wraps multiple ToolCallingChatModel instances and selects among them using weighted random selection. Models with weight 0 are never selected. When all active weights are equal, it falls back to round-robin.

func NewMixedChatModel added in v1.5.2

func NewMixedChatModel(models []model.ToolCallingChatModel, weights []int) *MixedChatModel

NewMixedChatModel creates a new MixedChatModel that selects among the given models using the provided weights. At least one model is required. Models with weight <= 0 are excluded from selection. When weights is nil or empty, equal weight (round-robin) is used for all models.

func (*MixedChatModel) Generate added in v1.5.2

func (m *MixedChatModel) Generate(ctx context.Context, messages []*schema.Message, opts ...model.Option) (*schema.Message, error)

Generate implements BaseChatModel. It selects a model based on weights.

func (*MixedChatModel) Stream added in v1.5.2

func (m *MixedChatModel) Stream(ctx context.Context, messages []*schema.Message, opts ...model.Option) (*schema.StreamReader[*schema.Message], error)

Stream implements BaseChatModel. It selects a model based on weights.

func (*MixedChatModel) WithTools added in v1.5.2

func (m *MixedChatModel) WithTools(tools []*schema.ToolInfo) (model.ToolCallingChatModel, error)

WithTools creates a new MixedChatModel where every underlying model has the given tools bound. Each call to WithTools returns a fresh MixedChatModel so the original is not mutated (safe for sharing across goroutines).

Jump to

Keyboard shortcuts

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