brain

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package brain builds the model backend a host uses to answer `infer`. It's shared by `hermit wear` (the sealed run) and `hermit dev` (the ADK web UI), so a hermit runs on the same brain either way. A brain is just a func(prompt) (completion, error) — the type host.Policy.Brain expects.

Specs:

claude              claude -p, latency-stripped (default; uses Claude Code auth)
claude:<model>      a specific claude model via the CLI
api[:<model>]       Anthropic API direct (fast, no subprocess) — ANTHROPIC_API_KEY
gemini[:<model>]    Google AI Studio direct (fast) — GEMINI_API_KEY
ollama:<model>      a LOCAL model (fully on-device)
cmd:a,b,c           any command: prompt on stdin, completion on stdout

GEMINI_API_KEY / ANTHROPIC_API_KEY are read from the environment or a .env file (found by walking up from the working directory), so `hermit dev --brain gemini` just works from the repo root.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Brain

type Brain func(prompt string) (string, error)

Brain answers one thought.

func FromEnv

func FromEnv() (Brain, error)

FromEnv builds the brain named by HERMIT_BRAIN (default "claude").

func New

func New(spec string) (Brain, error)

New builds a brain from a spec (see package doc). It announces which brain it resolved to on stderr, so `hermit wear`/`hermit dev` always show what's actually answering infer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL