Files
grailbench/config/config.go
2025-09-06 14:41:21 +03:00

38 lines
1006 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"`
ModelName string `toml:"ModelName"`
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
config.ModelName = "deepseek/deepseek-chat-v3-0324:free"
}
return config
}