server

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 78 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMaxQueue = errors.New("server busy, please try again.  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 PruneLayers

func PruneLayers() error

func PullModel

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

func PushModel

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

func Serve

func Serve(ln net.Listener) error

Types

type ByDurationAndName added in v0.6.6

type ByDurationAndName []*runnerRef

func (ByDurationAndName) Len added in v0.6.6

func (a ByDurationAndName) Len() int

func (ByDurationAndName) Less added in v0.6.6

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

func (ByDurationAndName) Swap added in v0.6.6

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

type LlmRequest added in v0.1.33

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

type Model

type Model struct {
	Name               string `json:"name"`
	Config             model.ConfigV2
	ShortName          string
	ModelPath          string
	DraftPath          string
	ParentModel        string
	HasChatTemplate    bool
	HasGoTemplate      bool
	PreferChatTemplate bool // set when GGUF chat_template should take precedence over Go TEMPLATE
	AdapterPaths       []string
	ProjectorPaths     []string
	System             string
	License            []string
	Digest             string
	Options            map[string]any
	Messages           []api.Message

	Template *template.Template
}

func GetModel

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

func (*Model) Capabilities added in v0.6.4

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

Capabilities returns the capabilities that the model supports

func (*Model) CheckCapabilities added in v0.2.2

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) IsMLX added in v0.17.5

func (m *Model) IsMLX() bool

func (*Model) String added in v0.1.34

func (m *Model) String() string

type Scheduler added in v0.1.33

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

func InitScheduler added in v0.1.33

func InitScheduler(ctx context.Context) *Scheduler

func (*Scheduler) GetRunner added in v0.1.33

func (s *Scheduler) GetRunner(c context.Context, m *Model, opts api.Options, sessionDuration *api.Duration) (chan *runnerRef, chan error)

context must be canceled to decrement ref count and release the runner

func (*Scheduler) Run added in v0.1.33

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 added in v0.1.33

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

func (*Server) CopyHandler added in v0.3.8

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

func (*Server) CreateBlobHandler added in v0.1.33

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

func (*Server) CreateHandler added in v0.3.8

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

func (*Server) DeleteHandler added in v0.3.8

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

func (*Server) EmbedHandler added in v0.2.6

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

func (*Server) EmbeddingsHandler added in v0.1.33

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

func (*Server) GenerateHandler added in v0.1.33

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

func (*Server) GenerateRoutes

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

func (*Server) HeadBlobHandler added in v0.1.33

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

func (*Server) ListHandler added in v0.3.8

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

func (*Server) ModelRecommendationsExperimentalHandler added in v0.22.1

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

func (*Server) PsHandler added in v0.3.8

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

func (*Server) PullHandler added in v0.3.8

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

func (*Server) PushHandler added in v0.3.8

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

func (*Server) ShowHandler added in v0.3.8

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

func (*Server) SignoutHandler added in v0.12.0

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

func (*Server) StatusHandler added in v0.16.2

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

func (*Server) WebFetchExperimentalHandler added in v0.18.0

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

func (*Server) WebSearchExperimentalHandler added in v0.18.0

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

func (*Server) WhoamiHandler added in v0.12.0

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

Jump to

Keyboard shortcuts

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