server

package
v0.34.1-xc6 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 63 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MediaTypeYollamaModel     = "application/vnd.yollama.image.model"
	MediaTypeYollamaProjector = "application/vnd.yollama.image.projector"
	MediaTypeYollamaTemplate  = "application/vnd.yollama.image.template"
	MediaTypeYollamaSystem    = "application/vnd.yollama.image.system"
	MediaTypeYollamaAdapter   = "application/vnd.yollama.image.adapter"
)

Clean Yollama OCI Media Types

Variables

View Source
var ErrMaxQueue = errors.New("[YOLLAMA] | Error: Maximum pending requests exceeded!")

Functions

func CopyModel

func CopyModel(src, dst model.Name) error

func GetModelInfo

func GetModelInfo(req api.ShowRequest) (*api.ShowResponse, error)

func GetSHA256Digest

func GetSHA256Digest(r io.Reader) (string, int64)

GetSHA256Digest returns the SHA256 hash of a given buffer and returns it, and the size of buffer

func NormalizeMediaType

func NormalizeMediaType(mediaType string) string

NormalizeMediaType intercepts legacy media types and translates them into the Yollama schema in-memory

func PruneLayers

func PruneLayers() error

func PullModel

func PullModel(ctx context.Context, name string, regOpts *registryOptions, fn func(api.ProgressResponse)) error

func Serve

func Serve(ln net.Listener) error

Types

type ByDurationAndName

type ByDurationAndName []*runnerRef

func (ByDurationAndName) Len

func (a ByDurationAndName) Len() int

func (ByDurationAndName) Less

func (a ByDurationAndName) Less(i, j int) bool

func (ByDurationAndName) Swap

func (a ByDurationAndName) Swap(i, j int)

type LlmRequest

type LlmRequest struct {
	// contains filtered or unexported fields
}

type Model

type Model struct {
	Name            string `json:"name"`
	Config          model.ConfigV2
	ShortName       string
	ModelPath       string
	ParentModel     string
	HasChatTemplate bool
	ProjectorPaths  []string
	System          string
	License         []string
	Digest          string
	Options         map[string]any
	Messages        []api.Message

	Template *template.Template
	// contains filtered or unexported fields
}

func CheckForModel

func CheckForModel(name string) (*Model, error)

func GetModel

func GetModel(name string) (*Model, error)

func (*Model) Capabilities

func (m *Model) Capabilities() []model.Capability

Capabilities returns the capabilities that the model supports

func (*Model) CheckCapabilities

func (m *Model) CheckCapabilities(want ...model.Capability) error

CheckCapabilities checks if the model has the specified capabilities returning an error describing any missing or unknown capabilities

func (*Model) String

func (m *Model) String() string

type ModelCapabilities

type ModelCapabilities struct {
	HasModel     bool
	HasProjector bool // For vision models
	HasTemplate  bool
}

ModelCapabilities tracks what features the underlying GGUF layers support

func EvaluateCapabilities

func EvaluateCapabilities(layers []struct{ MediaType string }) ModelCapabilities

EvaluateCapabilities scans a manifest's layers and determines model features using normalized types

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

func InitScheduler

func InitScheduler(ctx context.Context) *Scheduler

func (*Scheduler) Run

func (s *Scheduler) Run(ctx context.Context)

Returns immediately, spawns go routines for the scheduler which will shutdown when ctx is done

type Server

type Server struct {
	// contains filtered or unexported fields
}

func (*Server) ChatHandler

func (s *Server) ChatHandler(c *gin.Context)

func (*Server) CopyHandler

func (s *Server) CopyHandler(c *gin.Context)

func (*Server) CreateBlobHandler

func (s *Server) CreateBlobHandler(c *gin.Context)

func (*Server) CreateHandler

func (s *Server) CreateHandler(c *gin.Context)

func (*Server) DeleteHandler

func (s *Server) DeleteHandler(c *gin.Context)

func (*Server) GenerateRoutes

func (s *Server) GenerateRoutes() (http.Handler, error)

func (*Server) HeadBlobHandler

func (s *Server) HeadBlobHandler(c *gin.Context)

func (*Server) ListHandler

func (s *Server) ListHandler(c *gin.Context)

func (*Server) LoadedModelsHandler

func (s *Server) LoadedModelsHandler(c *gin.Context)

func (*Server) PullHandler

func (s *Server) PullHandler(c *gin.Context)

func (*Server) ShowHandler

func (s *Server) ShowHandler(c *gin.Context)

func (*Server) StopAllModelsHandler

func (s *Server) StopAllModelsHandler(c *gin.Context)

Flush all active runners out of VRAM

func (*Server) StopModelHandler

func (s *Server) StopModelHandler(c *gin.Context)

type StopRequest

type StopRequest struct {
	Model string `json:"model"`
}

Directories

Path Synopsis
internal
cache/blob
Package blob implements a content-addressable disk cache for blobs and manifests.
Package blob implements a content-addressable disk cache for blobs and manifests.
internal/stringsx
Package stringsx provides additional string manipulation functions that aren't in the standard library's strings package or go4.org/mem.
Package stringsx provides additional string manipulation functions that aren't in the standard library's strings package or go4.org/mem.
internal/syncs
Package syncs provides synchronization primitives.
Package syncs provides synchronization primitives.
manifest
Package manifest provides documentation for the Yollama manifest format.
Package manifest provides documentation for the Yollama manifest format.

Jump to

Keyboard shortcuts

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