run

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigDef string
View Source
var ExampleConfig string

Functions

func ApplyConfig added in v0.0.12

func ApplyConfig(config *FullConfig, token *string, maxRound *int, baseUrl *string, model *string, systemPrompt *string, tools *[]string, toolCustomFiles *[]string, toolCustomJSONs *[]string, toolDefaultCwd *string, recordFile *string, noCache *bool, showUsage *bool, ignoreDuplicateMsg *bool, logRequest *bool, logChatFlag **bool, verbose *bool, mcpServers *[]string) error

ApplyConfig applies configuration values to the provided variables, giving precedence to command line arguments

func Main

func Main(args []string, opts Options) error

Types

type ChatHandler

type ChatHandler struct {
	APIShape providers.APIShape
	// contains filtered or unexported fields
}

func (*ChatHandler) Handle

func (c *ChatHandler) Handle(model string, baseUrl string, token string, msg string, opts ChatOptions) error

type ChatOptions

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

type Config added in v0.0.12

type Config struct {
	types.Config                         // Embed the base config
	ToolCustomJSONs []*tools.UnifiedTool `json:"tool_custom_jsons,omitempty"` // Tool-specific field that needs UnifiedTool
}

Config represents the configuration structure that can be loaded from a file

type FullConfig added in v0.0.13

type FullConfig struct {
	Config
	RecordFile         string `json:"record_file,omitempty"`
	NoCache            bool   `json:"no_cache,omitempty"`
	ShowUsage          bool   `json:"show_usage,omitempty"`
	IgnoreDuplicateMsg bool   `json:"ignore_duplicate_msg,omitempty"`
	LogRequest         bool   `json:"log_request,omitempty"`
	LogChat            *bool  `json:"log_chat,omitempty"`
	Verbose            bool   `json:"verbose,omitempty"`
}

func LoadConfig added in v0.0.12

func LoadConfig(configFile string) (*FullConfig, error)

LoadConfig loads configuration from a JSON file

type Messages

type Messages []types.Message

Messages represents a slice of unified messages with conversion methods

func (Messages) ToAnthropic

func (messages Messages) ToAnthropic() (msgs []anthropic.MessageParam, systemPrompts []string, err error)

ToAnthropic converts unified messages to Anthropic format

func (Messages) ToGemini added in v0.0.7

func (messages Messages) ToGemini() (msgs []*genai.Content, systemPrompts []string, err error)

func (Messages) ToOpenAI

func (messages Messages) ToOpenAI(keepSystemPrompts bool) (msgs []openai.ChatCompletionMessageParamUnion, systemPrompts []string, err error)

ToOpenAI converts unified messages to OpenAI format

func (Messages) ToOpenAILegacy added in v0.0.15

func (messages Messages) ToOpenAILegacy() []openai.ChatCompletionMessageParamUnion

ToOpenAILegacy converts unified messages to OpenAI format (legacy method)

type Number

type Number string

type Options

type Options struct {
	BaseCmd        string
	DefaultBaseURL string
}

type ResolvedOptions added in v0.0.8

type ResolvedOptions struct {
	AbsDefaultToolCwd string
	Token             string
	BaseUrl           string
}

func ResolveEnvOptions added in v0.0.8

func ResolveEnvOptions(defaultToolCwd string, token string, tokenEnvKey string, baseUrl string, baseUrlEnvKey string, defaultBaseUrlEnvKey string, defaultBaseUrl string) (ResolvedOptions, error)

func ResolveProviderDefaultEnvOptions added in v0.0.8

func ResolveProviderDefaultEnvOptions(apiShape providers.APIShape, provider providers.Provider, defaultToolCwd string, token string, baseUrl string, defaultBaseUrl string) (ResolvedOptions, error)

type StringOrList added in v0.0.12

type StringOrList = types.StringOrList

Legacy type alias for compatibility

type ToolInfo added in v0.0.8

type ToolInfo struct {
	Name    string
	Builtin bool

	ToolDefinition *tools.UnifiedTool

	MCPServer string
	MCPClient *client.Client
}

func (*ToolInfo) String added in v0.0.8

func (c *ToolInfo) String() string

type ToolInfoMapping added in v0.0.8

type ToolInfoMapping map[string]*ToolInfo

func (ToolInfoMapping) AddTool added in v0.0.8

func (c ToolInfoMapping) AddTool(toolName string, toolInfo *ToolInfo) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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