Versions in this module Expand all Collapse all v0 v0.2.0 Aug 8, 2026 v0.1.0 Aug 5, 2026 Changes in this version + const ErrAttachmentUnsupported + const ErrBackendUnavailable + const ErrFrameTooLarge + const ErrInternal + const ErrInvalidRequest + const ErrWireVersion + const FrameBlob + const FrameJSON + const MaxFrame + const MaxImageAxis + const RespDone + const RespError + const RespFrame + const StopEndTurn + const StopError + const StopMaxTokens + const Version + func DecodeImage(a Attachment) (*image.RGBA, error) + func DefaultAddr() string + func Serve(ctx context.Context, conn *Conn, h Handler, log *slog.Logger) error + type Attachment struct + Bytes []byte + Height uint32 + ID string + Kind string + Width uint32 + func ImageAttachment(id string, img *image.RGBA) (Attachment, error) + type Block struct + AttachmentID string + Text string + Type string + func ImageBlock(id string) Block + func TextBlock(text string) Block + type Closer interface + Close func() error + type Conn struct + func NewConn(rw io.ReadWriteCloser) *Conn + func (c *Conn) Close() error + func (c *Conn) ReadFrame() (byte, []byte, error) + func (c *Conn) ReadRequest() (Request, error) + func (c *Conn) WriteFrame(ftype byte, payload []byte) error + func (c *Conn) WriteJSON(v any) error + func (c *Conn) WriteRequest(req Request) error + type Engine struct + func Dial(ctx context.Context, addr string) (*Engine, error) + func (e *Engine) Close() error + func (e *Engine) Recognize(ctx context.Context, img *image.RGBA, opt ocr.Options) (string, error) + type Handler interface + Generate func(ctx context.Context, img *image.RGBA, prompt string, maxTokens int, ...) error + Name func() string + type Listener struct + func Listen(addr string) (*Listener, error) + func (l *Listener) Accept(ctx context.Context, h Handler, log *slog.Logger) error + func (l *Listener) Addr() string + func (l *Listener) Close() error + type Local struct + func NewLocal(h Handler) *Local + func (l *Local) Close() error + func (l *Local) Recognize(ctx context.Context, img *image.RGBA, opt ocr.Options) (string, error) + type Message struct + Content []Block + Role string + type OutBlock struct + Delta string + Type string + type Request struct + Attachments []Attachment + ID string + MaxTokens *uint32 + Messages []Message + Temperature *float64 + WireVersion uint32 + type Response struct + Backend string + Block *OutBlock + Code string + ID string + Message string + StopReason string + Type string + Usage *Usage + func (r Response) IsTerminal() bool + type Usage struct + InputTokens uint32 + OutputTokens uint32