routes

package
v0.0.0-...-875a215 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidModelNameErrMsg = "invalid model name"
)

Variables

This section is empty.

Functions

func EmbeddingsMiddleware

func EmbeddingsMiddleware() gin.HandlerFunc

func ListMiddleware

func ListMiddleware() gin.HandlerFunc

func PullModel

func PullModel(ctx context.Context, hf *model.HuggingFaceModel, fn func(api.ProgressResponse)) error

func RetrieveMiddleware

func RetrieveMiddleware() gin.HandlerFunc

Types

type API

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

func New

func New(cfg *config.Config, runnerSer *runner.Service) *API

func (*API) ChatHandler

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

func (*API) EmbedHandler

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

func (*API) EmbeddingsHandler

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

func (*API) GenerateHandler

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

func (*API) HealthHandler

func (s *API) HealthHandler(c *gin.Context)

func (*API) IndexHandler

func (s *API) IndexHandler(c *gin.Context)

func (*API) ListHandler

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

func (*API) ModelsLoadStubHandler

func (s *API) ModelsLoadStubHandler(c *gin.Context)

func (*API) ModelsUnloadStubHandler

func (s *API) ModelsUnloadStubHandler(c *gin.Context)

func (*API) PropsChangeHandler

func (s *API) PropsChangeHandler(c *gin.Context)

func (*API) PropsHandler

func (s *API) PropsHandler(c *gin.Context)

func (*API) PsHandler

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

func (*API) PullHandler

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

func (*API) Setup

func (s *API) Setup(r *gin.Engine)

func (*API) ShowHandler

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

func (*API) SlotsHandler

func (s *API) SlotsHandler(c *gin.Context)

func (*API) Start

func (s *API) Start() error

func (*API) V1ModelsWebUIHandler

func (s *API) V1ModelsWebUIHandler(c *gin.Context)

V1ModelsWebUIHandler lists models in the shape expected by llama.cpp tools/server/webui (data[] with path, status, in_cache).

func (*API) VersionHandler

func (s *API) VersionHandler(c *gin.Context)

type BaseWriter

type BaseWriter struct {
	gin.ResponseWriter
}

type EmbedRequest

type EmbedRequest struct {
	Input      any    `json:"input"`
	Model      string `json:"model"`
	Dimensions int    `json:"dimensions,omitempty"`
}

type EmbedWriter

type EmbedWriter struct {
	BaseWriter
	// contains filtered or unexported fields
}

func (*EmbedWriter) Write

func (w *EmbedWriter) Write(data []byte) (int, error)

type Embedding

type Embedding struct {
	Object    string    `json:"object"`
	Embedding []float32 `json:"embedding"`
	Index     int       `json:"index"`
}

type EmbeddingList

type EmbeddingList struct {
	Object string         `json:"object"`
	Data   []Embedding    `json:"data"`
	Model  string         `json:"model"`
	Usage  EmbeddingUsage `json:"usage,omitempty"`
}

type EmbeddingUsage

type EmbeddingUsage struct {
	PromptTokens int `json:"prompt_tokens"`
	TotalTokens  int `json:"total_tokens"`
}

type Error

type Error struct {
	Message string  `json:"message"`
	Type    string  `json:"type"`
	Param   any     `json:"param"`
	Code    *string `json:"code"`
}

type ErrorResponse

type ErrorResponse struct {
	Error Error `json:"error"`
}

func NewError

func NewError(code int, message string) ErrorResponse

type ImageData

type ImageData struct {
	Data []byte `json:"data"`
	ID   int    `json:"id"`
}

type ListCompletion

type ListCompletion struct {
	Object string  `json:"object"`
	Data   []Model `json:"data"`
}

type ListWriter

type ListWriter struct {
	BaseWriter
}

func (*ListWriter) Write

func (w *ListWriter) Write(data []byte) (int, error)

type Model

type Model struct {
	Id      string `json:"id"`
	Object  string `json:"object"`
	Created int64  `json:"created"`
	OwnedBy string `json:"owned_by"`
}

type RetrieveWriter

type RetrieveWriter struct {
	BaseWriter
	// contains filtered or unexported fields
}

func (*RetrieveWriter) Write

func (w *RetrieveWriter) Write(data []byte) (int, error)

Jump to

Keyboard shortcuts

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