Documentation
¶
Index ¶
- Constants
- Variables
- func CopyModel(src, dst model.Name) error
- func GetBlobsPath(digest string) (string, error)
- func GetManifestPath() (string, error)
- func GetModelInfo(req api.ShowRequest) (*api.ShowResponse, error)
- func GetSHA256Digest(r io.Reader) (string, int64)
- func Manifests(continueOnError bool) (map[model.Name]*Manifest, error)
- func PruneDirectory(path string) error
- func PruneLayers() error
- func PullModel(ctx context.Context, name string, regOpts *registryOptions, ...) error
- func PushModel(ctx context.Context, name string, regOpts *registryOptions, ...) error
- func Serve(ln net.Listener) error
- func WriteManifest(name model.Name, config Layer, layers []Layer) error
- type ByDuration
- type Capability
- type ConfigV2
- type Layer
- type LlmRequest
- type Manifest
- type Model
- type ModelPath
- type RootFS
- type Scheduler
- type Server
- func (s *Server) ChatHandler(c *gin.Context)
- func (s *Server) CopyHandler(c *gin.Context)
- func (s *Server) CreateBlobHandler(c *gin.Context)
- func (s *Server) CreateHandler(c *gin.Context)
- func (s *Server) DeleteHandler(c *gin.Context)
- func (s *Server) EmbedHandler(c *gin.Context)
- func (s *Server) EmbeddingsHandler(c *gin.Context)
- func (s *Server) GenerateHandler(c *gin.Context)
- func (s *Server) GenerateRoutes() http.Handler
- func (s *Server) HeadBlobHandler(c *gin.Context)
- func (s *Server) ListHandler(c *gin.Context)
- func (s *Server) PsHandler(c *gin.Context)
- func (s *Server) PullHandler(c *gin.Context)
- func (s *Server) PushHandler(c *gin.Context)
- func (s *Server) ShowHandler(c *gin.Context)
Constants ¶
View Source
const ( CapabilityCompletion = Capability("completion") CapabilityTools = Capability("tools") CapabilityInsert = Capability("insert") )
View Source
const ( DefaultRegistry = "registry.ollama.ai" DefaultNamespace = "library" DefaultTag = "latest" DefaultProtocolScheme = "https" )
Variables ¶
View Source
var ( ErrInvalidImageFormat = errors.New("invalid image format") ErrInvalidProtocol = errors.New("invalid protocol scheme") ErrInsecureProtocol = errors.New("insecure protocol http") ErrInvalidDigestFormat = errors.New("invalid digest format") )
View Source
var ErrMaxQueue = errors.New("server busy, please try again. maximum pending requests exceeded")
Functions ¶
func GetBlobsPath ¶
func GetManifestPath ¶
func GetModelInfo ¶
func GetModelInfo(req api.ShowRequest) (*api.ShowResponse, error)
func GetSHA256Digest ¶
GetSHA256Digest returns the SHA256 hash of a given buffer and returns it, and the size of buffer
func PruneDirectory ¶
func PruneLayers ¶
func PruneLayers() error
Types ¶
type ByDuration ¶
type ByDuration []*runnerRef
func (ByDuration) Len ¶
func (a ByDuration) Len() int
func (ByDuration) Less ¶
func (a ByDuration) Less(i, j int) bool
func (ByDuration) Swap ¶
func (a ByDuration) Swap(i, j int)
type Capability ¶
type Capability string
type ConfigV2 ¶
type ConfigV2 struct { ModelFormat string `json:"model_format"` ModelFamily string `json:"model_family"` ModelFamilies []string `json:"model_families"` ModelType string `json:"model_type"` FileType string `json:"file_type"` // required by spec Architecture string `json:"architecture"` OS string `json:"os"` RootFS RootFS `json:"rootfs"` }
type Layer ¶
type Layer struct { MediaType string `json:"mediaType"` Digest string `json:"digest"` Size int64 `json:"size"` From string `json:"from,omitempty"` // contains filtered or unexported fields }
func NewLayerFromLayer ¶
type LlmRequest ¶
type LlmRequest struct {
// contains filtered or unexported fields
}
type Manifest ¶
type Manifest struct { SchemaVersion int `json:"schemaVersion"` MediaType string `json:"mediaType"` Config Layer `json:"config"` Layers []Layer `json:"layers"` // contains filtered or unexported fields }
func (*Manifest) RemoveLayers ¶
type Model ¶
type Model struct { Name string `json:"name"` Config ConfigV2 ShortName string ModelPath string ParentModel string AdapterPaths []string ProjectorPaths []string System string License []string Digest string Options map[string]interface{} Messages []api.Message Template *template.Template }
func (*Model) CheckCapabilities ¶
func (m *Model) CheckCapabilities(caps ...Capability) error
CheckCapabilities checks if the model has the specified capabilities returning an error describing any missing or unknown capabilities
type ModelPath ¶
type ModelPath struct { ProtocolScheme string Registry string Namespace string Repository string Tag string }
func ParseModelPath ¶
func (ModelPath) GetFullTagname ¶
func (ModelPath) GetManifestPath ¶
GetManifestPath returns the path to the manifest file for the given model path, it is up to the caller to create the directory if it does not exist.
func (ModelPath) GetNamespaceRepository ¶
func (ModelPath) GetShortTagname ¶
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
func InitScheduler ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ChatHandler ¶
func (*Server) CopyHandler ¶
func (*Server) CreateBlobHandler ¶
func (*Server) CreateHandler ¶
func (*Server) DeleteHandler ¶
func (*Server) EmbedHandler ¶
func (*Server) EmbeddingsHandler ¶
func (*Server) GenerateHandler ¶
func (*Server) GenerateRoutes ¶
func (*Server) HeadBlobHandler ¶
func (*Server) ListHandler ¶
func (*Server) PullHandler ¶
func (*Server) PushHandler ¶
func (*Server) ShowHandler ¶
Click to show internal directories.
Click to hide internal directories.