beago brings the Unix philosophy to LLM applications: small, focused handlers connected by pipes. It is also inspired by the http.Handler and http.Handler funcs (net/http). Each handler reads from an io.Reader, transforms the stream, and writes to an io.Writer.
- Pipe — the core primitive: a
Handlerthat readsio.Reader→ transforms → writesio.Writer - Do — chains handlers sequentially, connecting each output to the next input via
io.Pipe - Loop — runs a handler chain repeatedly, feeding each iteration's output as the next input; stops on
ErrDoneor a max iteration count
// echo "What is 2+2?" | go run .
model := ollama.New("gemma4:e4b", "")
pipe.Do(context.Background(), os.Stdin, os.Stdout,
llm.Generate(model),
)More examples in /examples.
Contributions of any kind are welcome! See Get Involved to get started.