internal

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 278 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigFileFlags

func ConfigFileFlags(flags *pflag.FlagSet, opts *ToolboxOptions)

ConfigFileFlags defines flags related to the configuration file. It should be applied to any command that requires configuration loading.

func ConvertConfig

func ConvertConfig(raw []byte) ([]byte, error)

ConvertConfig converts configuration file to flat format.

func GetPathsFromConfigFolder

func GetPathsFromConfigFolder(ctx context.Context, folderPath string) ([]string, error)

GetPathsFromConfigFolder loads all YAML files from a directory and merges them

func PersistentFlags

func PersistentFlags(parentCmd *cobra.Command, opts *ToolboxOptions)

PersistentFlags sets up flags that are available for all commands and subcommands It is also used to set up persistent flags during subcommand unit tests

func ServeFlags

func ServeFlags(flags *pflag.FlagSet, opts *ToolboxOptions)

ServeFlags defines flags for starting and configuring the server.

Types

type Config

type Config struct {
	Sources         server.SourceConfigs         `yaml:"sources"`
	AuthServices    server.AuthServiceConfigs    `yaml:"authServices"`
	EmbeddingModels server.EmbeddingModelConfigs `yaml:"embeddingModels"`
	Tools           server.ToolConfigs           `yaml:"tools"`
	Toolsets        server.ToolsetConfigs        `yaml:"toolsets"`
	Prompts         server.PromptConfigs         `yaml:"prompts"`
}

type ConfigParser

type ConfigParser struct {
	EnvVars         map[string]string
	OptionalEnvVars []string
	// contains filtered or unexported fields
}

func (*ConfigParser) LoadAndMergeConfigs

func (p *ConfigParser) LoadAndMergeConfigs(ctx context.Context, filePaths []string) (Config, error)

LoadAndMergeConfigs loads multiple YAML files and merges them

func (*ConfigParser) ParseConfig

func (p *ConfigParser) ParseConfig(ctx context.Context, raw []byte) (Config, error)

ParseConfig parses the provided yaml into appropriate configs.

type IOStreams

type IOStreams struct {
	In     io.Reader
	Out    io.Writer
	ErrOut io.Writer
}

type Option

type Option func(*ToolboxOptions)

Option defines a function that modifies the ToolboxOptions struct.

func WithIOStreams

func WithIOStreams(out, err io.Writer) Option

WithIOStreams updates the IO streams.

type ToolboxOptions

type ToolboxOptions struct {
	IOStreams       IOStreams
	Logger          log.Logger
	Cfg             server.ServerConfig
	Config          string
	Configs         []string
	ConfigFolder    string
	PrebuiltConfigs []string
	VersionNum      string
}

ToolboxOptions holds dependencies shared by all commands.

func NewToolboxOptions

func NewToolboxOptions(opts ...Option) *ToolboxOptions

NewToolboxOptions creates a new instance with defaults, then applies any provided options.

func (*ToolboxOptions) Apply

func (o *ToolboxOptions) Apply(opts ...Option)

Apply allows you to update an EXISTING ToolboxOptions instance. This is useful for "late binding".

func (*ToolboxOptions) GetCustomConfigFiles

func (opts *ToolboxOptions) GetCustomConfigFiles(ctx context.Context) ([]string, bool, error)

GetCustomConfigFiles retrieves the list of custom config file paths

func (*ToolboxOptions) LoadConfig

func (opts *ToolboxOptions) LoadConfig(ctx context.Context, parser *ConfigParser) (bool, error)

LoadConfig checks and merge files that should be loaded into the server

func (*ToolboxOptions) Setup

func (opts *ToolboxOptions) Setup(ctx context.Context) (context.Context, func(context.Context) error, error)

Setup create logger and telemetry instrumentations.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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