sglang

package
v1.0.11 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// Name is the backend name.
	Name = "sglang"
)

Variables

View Source
var (
	ErrNotImplemented = errors.New("not implemented")
	ErrSGLangNotFound = errors.New("sglang package not installed")
	ErrPythonNotFound = errors.New("python3 not found in PATH")
)

Functions

func GetContextLength

func GetContextLength(modelCfg types.ModelConfig, backendCfg *inference.BackendConfiguration) *int32

GetContextLength returns the context length (context size) from model config or backend config. Model config takes precedence over backend config. Returns nil if neither is specified (SGLang will auto-derive from model).

func New

func New(log logging.Logger, modelManager *models.Manager, serverLog logging.Logger, conf *Config, customPythonPath string) (inference.Backend, error)

New creates a new SGLang-based backend. customPythonPath is an optional path to a custom python3 binary; if empty, the default path is used.

Types

type Config

type Config struct {
	// Args are the base arguments that are always included.
	Args []string
}

Config is the configuration for the SGLang backend.

func NewDefaultSGLangConfig

func NewDefaultSGLangConfig() *Config

NewDefaultSGLangConfig creates a new SGLangConfig with default values.

func (*Config) GetArgs

func (c *Config) GetArgs(bundle types.ModelBundle, socket string, mode inference.BackendMode, config *inference.BackendConfiguration) ([]string, error)

GetArgs implements BackendConfig.GetArgs.

Jump to

Keyboard shortcuts

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