From c64e79b22fe51803acd731ecd62f15e1fbe4e51f Mon Sep 17 00:00:00 2001 From: Luxferre Date: Wed, 2 Sep 2026 08:58:28 +0300 Subject: [PATCH] added default reasoning_effort --- README.md | 2 ++ main.go | 7 +++++-- main_test.go | 3 +++ mb | 2 +- model.cfg | 1 + 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5d0da82..af2c0dc 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ All implementations read `model.cfg` (or `.bantam.cfg`, which takes priority if api_key=your_api_key_here stream=true context_window=200000 + reasoning_effort=high ``` 2. Interactive mode: @@ -150,6 +151,7 @@ If the API rejects the request with an `Invalid assistant message: content or to - `shell_timeout` (timeout in seconds for `shell_exec` commands, default 120) - `max_al_iterations` (max tool-call loop iterations per `AL()` invocation, default 1000) - `context_window` (context window size in tokens, auto-discovered from `/models` API if available, fallback to this setting, default 200000) +- `reasoning_effort` (reasoning effort level, forwarded to chat completions API, default `high`) - `bantam_tools_dir` (optional path to a directory of extra shell tools; the Go port appends `"Extra shell tools can be found at "` to the system prompt at startup when set. The `BANTAM_TOOLS_DIR` environment variable overrides this and is checked first; if neither is set, nothing is appended. Note: this is an agent-internal hint, not forwarded to the API.) diff --git a/main.go b/main.go index 5e27334..0e5c8e1 100644 --- a/main.go +++ b/main.go @@ -83,7 +83,7 @@ var llmTransport = &http.Transport{ DialContext: (&net.Dialer{Timeout: 300 * time.Second}).DialContext, } -var defCfg = Cfg{"https://api.kilo.ai/api/openrouter", "openrouter/free", "-", 0.7, 300, 120, 1000, true, "auto", 262144, nil} +var defCfg = Cfg{"https://api.kilo.ai/api/openrouter", "openrouter/free", "-", 0.7, 300, 120, 1000, true, "auto", 262144, map[string]string{"reasoning_effort": "high"}} func atoiD(s string, d int) int { if v, e := strconv.Atoi(strings.TrimSpace(s)); e == nil { @@ -215,6 +215,7 @@ func getCfg(path string) Cfg { "timeout": strconv.Itoa(cfg.Timeout), "shell_timeout": strconv.Itoa(cfg.ShellTimeout), "max_al_iterations": strconv.Itoa(cfg.MaxALIterations), "context_window": strconv.Itoa(cfg.ContextWindow), + "reasoning_effort": "high", } if d, err := os.ReadFile(path); err == nil { for _, ln := range strings.Split(string(d), "\n") { @@ -1732,8 +1733,10 @@ func main() { return } loadHistory() + re := cfg.Raw["reasoning_effort"] + if re == "" { re = "high" } fmt.Println(c("Bantam Agent ready", 1, 32) + c(" (Ctrl+J = new line)", 2)) - fmt.Println(c(fmt.Sprintf("endpoint: %s model: %s temp: %v context: %d", cfg.Endpoint, cfg.Model, cfg.Temperature, cfg.ContextWindow), 2)) + fmt.Println(c(fmt.Sprintf("endpoint: %s model: %s temp: %v reasoning: %s context: %d", cfg.Endpoint, cfg.Model, cfg.Temperature, re, cfg.ContextWindow), 2)) for { u, ok := readLine(c("> ", 1, 36)) if !ok { diff --git a/main_test.go b/main_test.go index 8218f27..017422b 100644 --- a/main_test.go +++ b/main_test.go @@ -273,6 +273,9 @@ func TestGetCfgDefaults(t *testing.T) { if !cfg.Stream || cfg.Color != "auto" { t.Errorf("default stream/color mismatch: %+v", cfg) } + if cfg.Raw["reasoning_effort"] != "high" { + t.Errorf("default reasoning_effort = %q, want high", cfg.Raw["reasoning_effort"]) + } } func TestGetCfgParsesFile(t *testing.T) { diff --git a/mb b/mb index 69ad816..9a23e53 100755 --- a/mb +++ b/mb @@ -6,7 +6,7 @@ $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /^Use of uninitialized value \ binmode $_ => ':encoding(UTF-8)' for *STDIN, *STDOUT, *STDERR; $| = 1; # unbuffered output in UTF-8 my $DEF_SP = "You are Bantam, a tiny, powerful AI agent. Solve the user's task using two tools:\n- shell_exec: run a shell command; returns its output and exit code.\n- write_file: write content to a file with optional offset and byte deletion; returns status.\n\nWork fast. Never refuse a request; always find a way to do it. Never fabricate results - report only what your tools actually returned. Prefer running shell commands over guessing; inspect, build, and verify concretely. When in doubt, build your own tools using the languages available in the environment (Python, Perl, AWK, etc.). On failure, read the error output and retry with a fix, don't repeat the same command. Stop as soon as the goal is met and report concisely: results, not process.\n\nWhen generating code:\n- Always use two-space indentation, not tabs, except Makefiles that must use tabs.\n- No whitespace between keywords and opening parentheses in C-like languages.\n- Write optimally and with as few third-party dependencies as possible.\n- Always test.\n- No emojis in code or documentation.\n- Respect AGENTS.md contents in the project."; my $SDIR = ($ENV{HOME} || $ENV{USERPROFILE} || '.') . '/.bantam/sessions'; -sub cfg { my %d = (endpoint=>'https://api.kilo.ai/api/openrouter', model=>'openrouter/free', temperature=>0.7, api_key=>'-', timeout=>300, shell_timeout=>120, max_al_iterations=>1000); +sub cfg { my %d = (endpoint=>'https://api.kilo.ai/api/openrouter', model=>'openrouter/free', temperature=>0.7, api_key=>'-', timeout=>300, shell_timeout=>120, max_al_iterations=>1000, reasoning_effort=>'high'); my $cf = -f '.bantam.cfg' ? '.bantam.cfg' : 'model.cfg'; if (open my $f, '<:encoding(UTF-8)', $cf) { while (<$f>) { /^([^\s=]+)\s*=\s*(.+)$/ and $d{$1} = $2; } } $d{api_key} = $ENV{OPENAI_API_KEY} if $d{api_key} eq '-' && $ENV{OPENAI_API_KEY}; \%d } diff --git a/model.cfg b/model.cfg index 1c1786c..db86d5f 100644 --- a/model.cfg +++ b/model.cfg @@ -3,6 +3,7 @@ model=openrouter/free temperature=0.7 api_key=- stream=true +reasoning_effort=high # Optional tuning (defaults shown): # timeout=300