Documentation
¶
Index ¶
- func CreateBackup(src string, backupDst string) error
- func DownloadAndInstallOnnxRuntime(url string, destDir string, version string, downloadsDir string, ...) error
- func DownloadRelease(url string, destPath string, progressChan chan float64) error
- func ExtractArchive(archivePath string, destDir string) error
- func ExtractOnnxLibrary(archivePath string, destDir string) error
- func GetMemoryUsage(pid int) (float64, error)
- func MatchAsset(release *GithubRelease, specs *hardware.HardwareSpecs) (mainAsset *ReleaseAsset, cudartAsset *ReleaseAsset, err error)
- func QueryLocalOnnxVersion(onnxDir string) (string, error)
- func QueryLocalVersion(llamaCppDir string) (version string, commit string, buildInfo string, err error)
- func QueryServerRequests(port int) (int, error)
- func RollbackBackup(backupSrc string, dst string) error
- type GithubRelease
- type GithubTag
- type InstanceInfo
- type LlamaCppRuntime
- func (sr *LlamaCppRuntime) Capabilities() []TaskType
- func (sr *LlamaCppRuntime) GetAllInstances() []InstanceInfo
- func (sr *LlamaCppRuntime) GetStatus() (ServerStatus, string, int)
- func (sr *LlamaCppRuntime) Start(modelPath string, opts StartOptions) error
- func (sr *LlamaCppRuntime) Stop() error
- func (sr *LlamaCppRuntime) StopInstance(port int) error
- type ModelRuntime
- type MultiRuntimeManager
- func (m *MultiRuntimeManager) Capabilities() []TaskType
- func (m *MultiRuntimeManager) GetAllInstances() []InstanceInfo
- func (m *MultiRuntimeManager) GetStatus() (ServerStatus, string, int)
- func (m *MultiRuntimeManager) Start(modelPath string, opts StartOptions) error
- func (m *MultiRuntimeManager) Stop() error
- func (m *MultiRuntimeManager) StopInstance(port int) error
- type OnnxInstance
- type OnnxRuntime
- func (or *OnnxRuntime) Capabilities() []TaskType
- func (or *OnnxRuntime) GetAllInstances() []InstanceInfo
- func (or *OnnxRuntime) GetStatus() (ServerStatus, string, int)
- func (or *OnnxRuntime) Start(modelPath string, opts StartOptions) error
- func (or *OnnxRuntime) Stop() error
- func (or *OnnxRuntime) StopInstance(port int) error
- type ReleaseAsset
- type ServerInstance
- type ServerStatus
- type StartOptions
- type TaskType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBackup ¶
CreateBackup backs up the src folder to backupDst atomically.
func DownloadAndInstallOnnxRuntime ¶
func DownloadAndInstallOnnxRuntime(url string, destDir string, version string, downloadsDir string, progressChan chan float64) error
DownloadAndInstallOnnxRuntime downloads the ONNX release asset, extracts the library files, and writes a version.txt.
func DownloadRelease ¶
DownloadRelease downloads an asset URL and writes progress fraction (0.0 to 1.0) to progressChan.
func ExtractArchive ¶
ExtractArchive extracts zip/tar.gz into destDir and flattens single directories.
func ExtractOnnxLibrary ¶
ExtractOnnxLibrary extracts only the ONNX Runtime library from zip/tar.gz files.
func GetMemoryUsage ¶
GetMemoryUsage queries physical memory usage (RSS) of a process in MB.
func MatchAsset ¶
func MatchAsset(release *GithubRelease, specs *hardware.HardwareSpecs) (mainAsset *ReleaseAsset, cudartAsset *ReleaseAsset, err error)
MatchAsset finds the most suitable assets (main binaries and optional cudart DLLs) for the user's OS, CPU/GPU architecture.
func QueryLocalOnnxVersion ¶
QueryLocalOnnxVersion checks the presence of ONNX library files and reads the version.txt if available.
func QueryLocalVersion ¶
func QueryLocalVersion(llamaCppDir string) (version string, commit string, buildInfo string, err error)
QueryLocalVersion runs llama-server (or llama-cli) --version and parses output.
func QueryServerRequests ¶
QueryServerRequests queries total completion requests processed via the /metrics endpoint.
func RollbackBackup ¶
RollbackBackup restores the backup directory.
Types ¶
type GithubRelease ¶
type GithubRelease struct {
TagName string `json:"tag_name"`
Name string `json:"name"`
Body string `json:"body"`
Assets []ReleaseAsset `json:"assets"`
}
func CheckAppRelease ¶
func CheckAppRelease() (*GithubRelease, error)
CheckAppRelease queries GitHub API for the latest runora release or tag.
func CheckLatestOnnxRelease ¶
func CheckLatestOnnxRelease() (*GithubRelease, error)
CheckLatestOnnxRelease queries GitHub API for the latest ONNX Runtime release.
func CheckLatestRelease ¶
func CheckLatestRelease() (*GithubRelease, error)
CheckLatestRelease queries GitHub API for the latest llama.cpp release. Starting with v0.2.0, llama.cpp publishes stable semantic releases (vX.Y.Z) which reference the corresponding binary build tag inside nightly-tag.txt.
type InstanceInfo ¶
type LlamaCppRuntime ¶
type LlamaCppRuntime struct {
// contains filtered or unexported fields
}
func NewLlamaCppRuntime ¶
func NewLlamaCppRuntime(logDir string) *LlamaCppRuntime
func (*LlamaCppRuntime) Capabilities ¶
func (sr *LlamaCppRuntime) Capabilities() []TaskType
func (*LlamaCppRuntime) GetAllInstances ¶
func (sr *LlamaCppRuntime) GetAllInstances() []InstanceInfo
GetAllInstances returns status information for all active servers.
func (*LlamaCppRuntime) GetStatus ¶
func (sr *LlamaCppRuntime) GetStatus() (ServerStatus, string, int)
GetStatus returns the status, running model path, and port of the primary running server (50505 or first found).
func (*LlamaCppRuntime) Start ¶
func (sr *LlamaCppRuntime) Start(modelPath string, opts StartOptions) error
Start launches the llama-server on the specified port.
func (*LlamaCppRuntime) Stop ¶
func (sr *LlamaCppRuntime) Stop() error
Stop terminates ALL running servers.
func (*LlamaCppRuntime) StopInstance ¶
func (sr *LlamaCppRuntime) StopInstance(port int) error
StopInstance terminates the server running on the specified port.
type ModelRuntime ¶
type ModelRuntime interface {
// Start launches the model server on the specified port.
Start(modelPath string, opts StartOptions) error
// Stop terminates all active server instances running under this runtime.
Stop() error
// StopInstance terminates the server running on a specific port.
StopInstance(port int) error
// GetStatus queries the state of the primary instance (e.g. on port 50505).
GetStatus() (ServerStatus, string, int)
// GetAllInstances returns all instances currently run by this backend.
GetAllInstances() []InstanceInfo
// Capabilities returns which task types this runtime is capable of running.
Capabilities() []TaskType
}
type MultiRuntimeManager ¶
type MultiRuntimeManager struct {
// contains filtered or unexported fields
}
func NewMultiRuntimeManager ¶
func NewMultiRuntimeManager(logDir string) *MultiRuntimeManager
func (*MultiRuntimeManager) Capabilities ¶
func (m *MultiRuntimeManager) Capabilities() []TaskType
func (*MultiRuntimeManager) GetAllInstances ¶
func (m *MultiRuntimeManager) GetAllInstances() []InstanceInfo
func (*MultiRuntimeManager) GetStatus ¶
func (m *MultiRuntimeManager) GetStatus() (ServerStatus, string, int)
func (*MultiRuntimeManager) Start ¶
func (m *MultiRuntimeManager) Start(modelPath string, opts StartOptions) error
func (*MultiRuntimeManager) Stop ¶
func (m *MultiRuntimeManager) Stop() error
func (*MultiRuntimeManager) StopInstance ¶
func (m *MultiRuntimeManager) StopInstance(port int) error
type OnnxInstance ¶
type OnnxRuntime ¶
type OnnxRuntime struct {
// contains filtered or unexported fields
}
func NewOnnxRuntime ¶
func NewOnnxRuntime(logDir string) *OnnxRuntime
func (*OnnxRuntime) Capabilities ¶
func (or *OnnxRuntime) Capabilities() []TaskType
func (*OnnxRuntime) GetAllInstances ¶
func (or *OnnxRuntime) GetAllInstances() []InstanceInfo
func (*OnnxRuntime) GetStatus ¶
func (or *OnnxRuntime) GetStatus() (ServerStatus, string, int)
func (*OnnxRuntime) Start ¶
func (or *OnnxRuntime) Start(modelPath string, opts StartOptions) error
func (*OnnxRuntime) Stop ¶
func (or *OnnxRuntime) Stop() error
func (*OnnxRuntime) StopInstance ¶
func (or *OnnxRuntime) StopInstance(port int) error
type ReleaseAsset ¶
type ReleaseAsset struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
Size int64 `json:"size"`
}
func MatchOnnxAsset ¶
func MatchOnnxAsset(release *GithubRelease, specs *hardware.HardwareSpecs) (*ReleaseAsset, error)
MatchOnnxAsset finds the most suitable ONNX Runtime release package.
type ServerInstance ¶
type ServerStatus ¶
type ServerStatus int
const ( StatusStopped ServerStatus = iota StatusRunning StatusFailed )
type StartOptions ¶
type TaskType ¶
type TaskType string
const ( TaskTextGeneration TaskType = "TEXT_GENERATION" TaskEmbedding TaskType = "EMBEDDING" TaskReranking TaskType = "RERANKING" TaskSpeechToText TaskType = "SPEECH_TO_TEXT" TaskTextToSpeech TaskType = "TEXT_TO_SPEECH" TaskImageGeneration TaskType = "IMAGE_GENERATION" TaskVision TaskType = "VISION" TaskMultimodal TaskType = "MULTIMODAL" )