Documentation
¶
Index ¶
- Constants
- Variables
- func ChatHandler(c *gin.Context)
- 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 EmbeddingHandler(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(promptTemplate string, p PromptVars) (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 AuthRedirect
- type ConfigV2
- type Layer
- type Layers
- type ManifestV2
- type Message
- type Model
- type ModelPath
- type PromptVars
- type RegistryOptions
- type RootFS
- type Server
- type SignatureData
Constants ¶
View Source
const ( DefaultRegistry = "registry.imadam.ai" DefaultNamespace = "library" DefaultTag = "latest" DefaultProtocolScheme = "https" )
Variables ¶
Functions ¶
func ChatHandler ¶
func CopyModelHandler ¶
func CreateBlobHandler ¶
func CreateModel ¶
func CreateModelHandler ¶
func DeleteModel ¶
func DeleteModelHandler ¶
func EmbeddingHandler ¶
func GenerateHandler ¶
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 HeadBlobHandler ¶
func ListModelsHandler ¶
func PruneDirectory ¶
func PruneLayers ¶
func PruneLayers() error
func PullModel ¶
func PullModel(ctx context.Context, name string, regOpts *RegistryOptions, fn func(api.ProgressResponse)) error
func PullModelHandler ¶
func PushModel ¶
func PushModel(ctx context.Context, name string, regOpts *RegistryOptions, fn func(api.ProgressResponse)) error
func PushModelHandler ¶
func ShowModelHandler ¶
func ShowModelfile ¶
Types ¶
type AuthRedirect ¶
func ParseAuthRedirectString ¶
func ParseAuthRedirectString(authStr string) AuthRedirect
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"`
}
func (*ConfigV2) SetFileType ¶
func (*ConfigV2) SetModelFamily ¶
func (*ConfigV2) SetModelFormat ¶
func (*ConfigV2) SetModelType ¶
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 ManifestV2 ¶
type ManifestV2 struct {
SchemaVersion int `json:"schemaVersion"`
MediaType string `json:"mediaType"`
Config *Layer `json:"config"`
Layers []*Layer `json:"layers"`
}
func GetManifest ¶
func GetManifest(mp ModelPath) (*ManifestV2, string, error)
func (*ManifestV2) GetTotalSize ¶
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) ChatPrompt ¶
func (*Model) PostResponseTemplate ¶
func (m *Model) PostResponseTemplate(p PromptVars) (string, error)
PostResponseTemplate returns the template after the response tag
func (*Model) PreResponsePrompt ¶
func (m *Model) PreResponsePrompt(p PromptVars) (string, error)
PreResponsePrompt returns the prompt before the response tag
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 RegistryOptions ¶
type SignatureData ¶
func (SignatureData) Bytes ¶
func (s SignatureData) Bytes() []byte
Bytes returns a byte slice of the data to sign for the request
Click to show internal directories.
Click to hide internal directories.