Files
grailbench/config/config.go
Grail Finder e499a1ae37 Feat: rp mode
2025-08-09 11:46:33 +03:00

36 lines
905 B
Go

package config
import (
"fmt"
"github.com/BurntSushi/toml"
)
type Config struct {
RemoteAPI string `toml:"RemoteAPI"`
LocalAPI string `toml:"LocalAPI"`
APIToken string `toml:"APIToken"`
QuestionsPath string `toml:"QuestionsPath"`
RPScenariosDir string `toml:"RPScenariosDir"`
OutDir string `toml:"OutDir"`
MaxTurns int `toml:"MaxTurns"`
}
func LoadConfigOrDefault(fn string) *Config {
if fn == "" {
fn = "config.toml"
}
config := &Config{}
_, err := toml.DecodeFile(fn, &config)
if err != nil {
fmt.Println("failed to read config from file, loading default", "error", err)
config.RemoteAPI = "https://openrouter.ai/api/v1/completions"
config.LocalAPI = "http://localhost:8080/completion"
config.QuestionsPath = "data/questions.json"
config.RPScenariosDir = "scenarios"
config.OutDir = "results"
config.MaxTurns = 10
}
return config
}