added some guards
This commit is contained in:
@@ -113,6 +113,8 @@ Using these rules, everyone can build their own copy of Bantam from scratch in l
|
||||
- Loop back to step 1.
|
||||
4. If no pending tool calls (or if `max_al_iterations` is reached), stop and return `messages`.
|
||||
|
||||
If the API rejects the request with an `Invalid assistant message: content or tool_calls must be set` error (usually caused by a previously cut-off stream that left an empty assistant message in the session), all implementations strip the last `assistant`-role message from the session and retry the call.
|
||||
|
||||
### Model configuration parameters
|
||||
|
||||
(shared by all implementations; `model.cfg` is plain `key=value` with `#` comments)
|
||||
@@ -156,6 +158,7 @@ MicroBantam (`mb`) is a compressed Perl 5 reference implementation of the same a
|
||||
- Session management: `/save`, `/list`, `/load <id>` (exact id only, no prefix matching), and auto-save to `~/.bantam/sessions/autosave.json` after every turn and on exit; session ids get `-1`, `-2`, ... suffixes on same-second collisions
|
||||
- Interactive mode (`/quit`, `/clear`, `/save`, `/list`, `/load <id>`, `/help`) and file input mode
|
||||
- Same built-in default system prompt and `OPENAI_API_KEY` fallback as the full implementation
|
||||
- Automatic recovery from `Invalid assistant message: content or tool_calls must be set` API errors: strips the last assistant message and retries
|
||||
|
||||
### What it drops
|
||||
|
||||
@@ -165,6 +168,15 @@ MicroBantam (`mb`) is a compressed Perl 5 reference implementation of the same a
|
||||
- Fibonacci backoff network retries (a failed request aborts with an `API error` message)
|
||||
- `/compact` context summarization
|
||||
|
||||
### Jim Tcl port
|
||||
|
||||
`mb.tcl` is a Jim Tcl port of the same agent (under 100 SLOC) with the same feature set as the Perl `mb`. It differs in three ways: it ships its own minimal HTTP client (raw sockets with chunked-transfer decoding) instead of `HTTP::Tiny`; it retries failed requests up to 3 times with a 2-second backoff instead of aborting on the first failure; and it relies on the external `timeout` command for `shell_exec` timeouts instead of `SIGALRM`. Run it the same way:
|
||||
|
||||
```bash
|
||||
./mb.tcl # interactive (or: jimsh mb.tcl)
|
||||
./mb.tcl prompt.txt # file input mode
|
||||
```
|
||||
|
||||
### Running
|
||||
|
||||
```bash
|
||||
@@ -178,6 +190,7 @@ MicroBantam (`mb`) is a compressed Perl 5 reference implementation of the same a
|
||||
- `main.go`, `term_linux.go`, `term_darwin.go`, `term_windows.go`, `term_other.go` — Go implementation (stdlib only, module `code.luxferre.top/luxferre/bantam`)
|
||||
- `bantam.pl` — Perl 5 implementation (core modules only)
|
||||
- `mb` — MicroBantam, compressed Perl 5 implementation (core modules only, under 100 SLOC)
|
||||
- `mb.tcl` — MicroBantam, Jim Tcl port (requires `jimsh` with the `json` and `ssl` extensions; under 100 SLOC)
|
||||
- `model.cfg`, `system.txt` — shared configuration and system prompt
|
||||
- `README.md` — this document
|
||||
|
||||
|
||||
Reference in New Issue
Block a user