镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
bit8bytesPublic

About

A Go framework for building LLM-powered applications.

Topics

Resources

Stars

9 stars

Watchers

0 watching

Forks

Repository files navigation

beago: A Go framework for building LLM-powered applications.

License: MIT Test Sec Scan

beago brings the Unix philosophy to LLM applications: small, focused handlers connected by pipes. It is also inspired by the http.Handler and http.HandlerFunc (net/http). Each handler reads from an io.Reader, transforms the stream, and writes to an io.Writer.

Core Concepts

Pipe is the core primitive: a Handler that reads io.Reader → transforms → writes io.Writer. Two combinators build on it:

  • 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 ErrDone via context cancellation

Redact is a separate, composable layer: a Mask that anonymizes personal data to tokens before LLM processing and rehydrates them back after keeping sensitive values out of the model entirely. Redact is used in combination with Pipe and is safe for concurrent use.

Quick Start

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/bit8bytes/beago/llm"
	"github.com/bit8bytes/beago/llm/ollama"
	"github.com/bit8bytes/beago/pipe"
)

// echo '[{"role":"user","content":"What is 2+2?"}]' | go run .
func main() {
	client := ollama.New(ollama.WithModel("gemma4:e4b"))
	pipe.Do(context.Background(), os.Stdin, os.Stdout,
		llm.Generate(client),
	)
	fmt.Fprintln(os.Stdout)
}

This example reads a prompt from stdin, sends it to an Ollama model, and streams the response to stdout.

More examples in /examples.

Contributions

Contributions of any kind are welcome!

About

A Go framework for building LLM-powered applications.

Topics

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages