Documentation
¶
Index ¶
- Constants
- Variables
- func ChatHandler(c *gin.Context)
- func ChatPrompt(tmpl string, messages []api.Message, window int, ...) (string, error)
- func CopyModel(src, dest string) error
- func CopyModelHandler(c *gin.Context)
- func CreateBlobHandler(c *gin.Context)
- func CreateModel(ctx context.Context, name, modelFileDir string, commands []parser.Command, ...) error
- func CreateModelHandler(c *gin.Context)
- func DeleteModel(name string) error
- func DeleteModelHandler(c *gin.Context)
- func EmbeddingsHandler(c *gin.Context)
- func GenerateHandler(c *gin.Context)
- 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 HeadBlobHandler(c *gin.Context)
- func ListModelsHandler(c *gin.Context)
- func Prompt(tmpl, system, prompt, response string, generate bool) (string, error)
- func PruneDirectory(path string) error
- func PruneLayers() error
- func PullModel(ctx context.Context, name string, regOpts *registryOptions, ...) error
- func PullModelHandler(c *gin.Context)
- func PushModel(ctx context.Context, name string, regOpts *registryOptions, ...) error
- func PushModelHandler(c *gin.Context)
- func Serve(ln net.Listener) error
- func ShowModelHandler(c *gin.Context)
- func ShowModelfile(model *Model) (string, error)
- func WriteManifest(name string, config *Layer, layers []*Layer) error
- type ConfigV2
- type Layer
- type Layers
- type ManifestV2
- type Message
- type Model
- type ModelPath
- type RootFS
- type Server
Constants ¶
View Source
const ( DefaultRegistry = "registry.ollama.ai" DefaultNamespace = "library" DefaultTag = "latest" DefaultProtocolScheme = "https" )
Variables ¶
Functions ¶
func ChatHandler ¶ added in v0.1.14
func ChatPrompt ¶ added in v0.1.25
func ChatPrompt(tmpl string, messages []api.Message, window int, encode func(string) ([]int, error)) (string, error)
ChatPrompt builds up a prompt from a series of messages, truncating based on context window size
func CopyModelHandler ¶ added in v0.0.12
func CreateBlobHandler ¶ added in v0.1.10
func CreateModel ¶ added in v0.0.6
func CreateModelHandler ¶ added in v0.0.11
func DeleteModel ¶ added in v0.0.11
func DeleteModelHandler ¶ added in v0.0.11
func EmbeddingsHandler ¶ added in v0.1.28
func GenerateHandler ¶ added in v0.0.11
func GetBlobsPath ¶ added in v0.0.6
func GetManifestPath ¶ added in v0.0.6
func GetModelInfo ¶ added in v0.0.18
func GetModelInfo(req api.ShowRequest) (*api.ShowResponse, error)
func GetSHA256Digest ¶ added in v0.0.6
GetSHA256Digest returns the SHA256 hash of a given buffer and returns it, and the size of buffer
func HeadBlobHandler ¶ added in v0.1.10
func ListModelsHandler ¶ added in v0.0.11
func Prompt ¶ added in v0.1.18
Prompt renders a prompt from a template. If generate is set to true, the response and parts of the template following it are not rendered
func PruneDirectory ¶ added in v0.1.1
func PruneLayers ¶ added in v0.0.19
func PruneLayers() error
func PullModelHandler ¶ added in v0.0.11
func PushModelHandler ¶ added in v0.0.11
func ShowModelHandler ¶ added in v0.0.18
func ShowModelfile ¶ added in v0.0.18
Types ¶
type ConfigV2 ¶ added in v0.0.6
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"`
}
func (*ConfigV2) SetFileType ¶ added in v0.1.14
func (*ConfigV2) SetModelFamily ¶ added in v0.1.14
func (*ConfigV2) SetModelFormat ¶ added in v0.1.14
func (*ConfigV2) SetModelType ¶ added in v0.1.14
type Layer ¶ added in v0.0.6
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 ¶ added in v0.1.14
type ManifestV2 ¶ added in v0.0.6
type ManifestV2 struct {
SchemaVersion int `json:"schemaVersion"`
MediaType string `json:"mediaType"`
Config *Layer `json:"config"`
Layers []*Layer `json:"layers"`
}
func GetManifest ¶ added in v0.0.6
func GetManifest(mp ModelPath) (*ManifestV2, string, error)
func (*ManifestV2) GetTotalSize ¶ added in v0.0.6
func (m *ManifestV2) GetTotalSize() (total int64)
type Model ¶
type Model struct {
Name string `json:"name"`
Config ConfigV2
ShortName string
ModelPath string
ParentModel string
AdapterPaths []string
ProjectorPaths []string
Template string
System string
License []string
Digest string
Size int64
Options map[string]interface{}
Messages []Message
}
func (*Model) IsEmbedding ¶ added in v0.1.26
type ModelPath ¶ added in v0.0.6
type ModelPath struct {
ProtocolScheme string
Registry string
Namespace string
Repository string
Tag string
}
func ParseModelPath ¶ added in v0.0.6
func (ModelPath) GetFullTagname ¶ added in v0.0.6
func (ModelPath) GetManifestPath ¶ added in v0.0.6
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 ¶ added in v0.0.6
func (ModelPath) GetShortTagname ¶ added in v0.0.6
Click to show internal directories.
Click to hide internal directories.