config

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveSystemPrompt

func ResolveSystemPrompt(cfg *Config, prompt string) (string, error)

ResolveSystemPrompt resolves a system prompt reference. If the prompt starts with "@file:", the remainder is treated as a file path and its contents are returned. If the prompt matches a key in the top-level systemPrompts map, the referenced value is returned. Otherwise the prompt string is returned as-is.

Types

type Chat

type Chat struct {
	Desc              string        `yaml:"desc"`
	System            string        `yaml:"system"`
	Model             string        `yaml:"model"`
	MaxMessageRounds  int           `yaml:"maxMessageRounds"`
	FullMessageRounds int           `yaml:"fullMessageRounds,omitempty"`
	MaxIterations     int           `yaml:"maxIterations"`
	MaxRetries        int           `yaml:"maxRetries"`
	MCPServers        []string      `yaml:"mcpServers,omitempty"`
	Skill             *Skill        `yaml:"skill,omitempty"`
	Tools             []string      `yaml:"tools,omitempty"`
	Default           bool          `yaml:"default"`
	Hooks             *SessionHooks `yaml:"hooks,omitempty"`
	Persistence       bool          `yaml:"persistence"`
}

type Config

type Config struct {
	Chats         map[string]Chat      `yaml:"chats,omitempty"`
	Providers     map[string]Provider  `yaml:"providers,omitempty"`
	Models        map[string]Model     `yaml:"models,omitempty"`
	MCPServers    map[string]MCPServer `yaml:"mcpServers,omitempty"`
	Tools         map[string]Tool      `yaml:"tools,omitempty"`
	SystemPrompts map[string]string    `yaml:"systemPrompts,omitempty"`
}

Config represents the configuration for Eino CLI

func GetConfig

func GetConfig() *Config

GetConfig gets global configuration

func LoadConfig

func LoadConfig(configPath string) (*Config, error)

LoadConfig loads configuration from file and saves to global variable

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements custom YAML unmarshaling for backward compatibility. It normalizes snake_case keys to camelCase so both styles are accepted.

type MCPServer

type MCPServer struct {
	Type string `yaml:"type"`
	// for stdio
	Cmd  string            `yaml:"cmd,omitempty"`
	Args []string          `yaml:"args,omitempty"`
	Env  map[string]string `yaml:"env,omitempty"`
	// for sse & streamable-http
	URL               string            `yaml:"url,omitempty"`
	Headers           map[string]string `yaml:"headers,omitempty"`
	AutoApproval      bool              `yaml:"autoApproval"`
	AutoApprovalTools []string          `yaml:"autoApprovalTools"`
	// Tool filtering: include only these tools (if non-empty, only these tools are kept)
	Include []string `yaml:"include,omitempty"`
	// Tool filtering: exclude these tools (if non-empty, these tools are removed)
	Exclude []string `yaml:"exclude,omitempty"`
	// NoConcurrent: if true, all tools from this server share a single mutex,
	// meaning no two tools from this server can run concurrently.
	NoConcurrent bool `yaml:"noConcurrent,omitempty"`
	// NoConcurrentTools: list of specific tool names that should NOT be called concurrently.
	// Each listed tool gets its own mutex, so different tools don't block each other.
	NoConcurrentTools []string `yaml:"noConcurrentTools,omitempty"`
	// LowercaseTools: if true, all discovered tool names are lowercased before
	// filtering (include/exclude/autoApprovalTools/noConcurrentTools) and registration.
	LowercaseTools bool `yaml:"lowercaseTools,omitempty"`
}

MCPServer represents MCP server configuration

type MixedModel added in v1.5.2

type MixedModel struct {
	ModelParams `yaml:",inline"`
	Weight      int `yaml:"weight,omitempty"` // weight for weighted random selection (default: 1)
}

MixedModel represents a model entry within a mixed model configuration

type Model

type Model struct {
	ModelParams `yaml:",inline"`
	Mixed       []MixedModel `yaml:"mixed,omitempty"`
}

Model represents AI model configuration

type ModelParams added in v1.5.2

type ModelParams struct {
	Provider        string         `yaml:"provider"`
	Model           string         `yaml:"model"`
	Thinking        bool           `yaml:"thinking"`
	ReasoningEffort *string        `yaml:"reasoningEffort"`
	MaxTokens       int            `yaml:"maxTokens,omitempty"`
	Temperature     float64        `yaml:"temperature,omitempty"`
	TopP            float64        `yaml:"topP,omitempty"`
	TopK            int            `yaml:"topK,omitempty"`
	ExtraBody       map[string]any `yaml:"extraBody"`
}

ModelParams holds the common parameters for a model configuration. It is used both as the top-level Model and as entries inside Mixed.

type Provider

type Provider struct {
	Type    string            `yaml:"type"`
	BaseURL string            `yaml:"baseUrl,omitempty"`
	APIKey  string            `yaml:"apiKey,omitempty"`
	Headers map[string]string `yaml:"headers,omitempty"`
	Timeout int               `yaml:"timeout,omitempty"` // in seconds
}

Provider represents AI provider configuration

type SessionHookConfig

type SessionHookConfig struct {
	Enabled    bool              `yaml:"enabled"`
	Type       string            `yaml:"type,omitempty"`    // "script" or "http", default is "script"
	ScriptPath string            `yaml:"scriptPath"`        // used when type is "script"
	URL        string            `yaml:"url,omitempty"`     // used when type is "http"
	Method     string            `yaml:"method,omitempty"`  // HTTP method for http type, default is "POST"
	Headers    map[string]string `yaml:"headers,omitempty"` // HTTP headers for http type
	Args       []string          `yaml:"args,omitempty"`
	Timeout    int               `yaml:"timeout,omitempty"` // in seconds, default is 30
	Env        map[string]string `yaml:"env,omitempty"`     // environment variables for the hook script
}

SessionHookConfig represents the configuration for a single hook

type SessionHooks

type SessionHooks struct {
	Keep          *SessionHookConfig `yaml:"keep,omitempty"`
	GenModelInput *SessionHookConfig `yaml:"genModelInput,omitempty"`
}

SessionHooks represents session-related hooks configuration

type Skill

type Skill struct {
	Dir               string   `yaml:"dir"`
	WorkDir           string   `yaml:"workDir"`
	Timeout           int      `yaml:"timeout"`
	AutoApproval      bool     `yaml:"autoApproval"`
	AutoApprovalTools []string `yaml:"autoApprovalTools"`
}

type Tool

type Tool struct {
	Category          string                 `yaml:"category"`
	Params            map[string]interface{} `yaml:"params"`
	AutoApproval      bool                   `yaml:"autoApproval"`
	AutoApprovalTools []string               `yaml:"autoApprovalTools"`
}

Jump to

Keyboard shortcuts

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