backends

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunBackend

func RunBackend(ctx context.Context, config RunnerConfig) error

RunBackend runs a backend process with common error handling and logging. It handles: - Socket cleanup - Argument sanitization for logging - Process lifecycle management - Error channel handling - Context cancellation

Types

type ErrorTransformer added in v1.0.12

type ErrorTransformer func(output string) string

ErrorTransformer is a function that transforms raw error output into a more user-friendly message. Backends can provide their own implementation to customize error presentation.

type Logger

type Logger interface {
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Warnln(args ...interface{})
}

Logger interface for backend logging

type RunnerConfig

type RunnerConfig struct {
	// BackendName is the display name of the backend (e.g., "llama.cpp", "vLLM")
	BackendName string
	// Socket is the unix socket path
	Socket string
	// BinaryPath is the path to the backend binary
	BinaryPath string
	// SandboxPath is the sandbox directory path
	SandboxPath string
	// SandboxConfig is the sandbox configuration string
	SandboxConfig string
	// Args are the command line arguments
	Args []string
	// Logger provides logging functionality
	Logger Logger
	// ServerLogWriter provides a writer for server logs
	ServerLogWriter io.WriteCloser
	// ErrorTransformer is an optional function to transform error output
	// into a more user-friendly message. If nil, the raw output is used.
	ErrorTransformer ErrorTransformer
}

RunnerConfig holds configuration for a backend runner

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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