Files
owui-tools/docs/setup/octave.md
T
2026-09-15 15:24:03 -04:00

46 lines
1.6 KiB
Markdown

# The Octave sandbox — needed by `matlab_run`
**Nothing to set up** beyond building the image, which `docker compose up -d --build` does.
This page explains what it is, because the tool is named for MATLAB and does not contain
any.
## What it is
`matlab_run` executes code in **GNU Octave**, in a container with `network_mode: "none"` —
no interfaces, no DNS, no route anywhere. Jobs reach it through a file drop on a shared
tmpfs, not over a socket, so there is nothing listening to reach.
The tool reports three distinct verdicts, and the distinction is the point:
- it ran, and here is the output;
- it is **not valid MATLAB** (the linter caught a construct Octave accepts and MATLAB does
not, such as `endfor` or `!=`);
- it failed for a reason that is not the code's fault.
The second one exists because the assistant is often asked about MATLAB by people who do
not have it. Silently accepting Octave-only syntax would teach them something untrue.
## Limits
Set in `configs/owuitools.env`:
| Setting | Default | What it bounds |
|---|---|---|
| `OWUITOOLS_OCTAVE_TIMEOUT` | 25 s | one run |
| `OWUITOOLS_OCTAVE_MAX_TIMEOUT` | 60 s | the most a caller may ask for |
## Checking it
```sh
./tests/try-tool.sh matlab_run '{"code": "x = linspace(0,1,5);\ndisp(sum(x))"}'
```
Expect `MATLAB run OK`. Then try `for i=1:2\n printf(\"%d\",i);\nendfor` and expect
`NOT VALID MATLAB`.
## Plots
A figure comes back as a `data:image/png` URI. Open WebUI hands those to the *model* as a
vision input and never shows them to you — so the `inline_tool_images` filter exists to put
the picture in the chat as well. See [../filters.md](../filters.md).