@@ -34,6 +34,11 @@ import (
3434 ocispec "github.com/opencontainers/image-spec/specs-go/v1"
3535)
3636
37+ const (
38+ // annotationModelfile is the annotation key for the Modelfile.
39+ annotationModelfile = "org.cnai.modctl.modelfile"
40+ )
41+
3742// Build builds the user materials into the model artifact which follows the Model Spec.
3843func (b * backend ) Build (ctx context.Context , modelfilePath , workDir , target string , cfg * config.Build ) error {
3944 // parse the repo name and tag name from target.
@@ -105,7 +110,7 @@ func (b *backend) Build(ctx context.Context, modelfilePath, workDir, target stri
105110 }
106111
107112 // Build the model manifest.
108- _ , err = builder .BuildManifest (ctx , layers , configDesc , manifestAnnotation (), hooks .NewHooks (
113+ _ , err = builder .BuildManifest (ctx , layers , configDesc , manifestAnnotation (modelfile ), hooks .NewHooks (
109114 hooks .WithOnStart (func (name string , size int64 , reader io.Reader ) io.Reader {
110115 return pb .Add (internalpb .NormalizePrompt ("Building manifest" ), name , size , reader )
111116 }),
@@ -161,8 +166,9 @@ func (b *backend) process(ctx context.Context, builder build.Builder, workDir st
161166}
162167
163168// manifestAnnotation returns the annotations for the manifest.
164- func manifestAnnotation () map [string ]string {
165- // placeholder for future expansion of annotations.
166- anno := map [string ]string {}
169+ func manifestAnnotation (modelfile modelfile.Modelfile ) map [string ]string {
170+ anno := map [string ]string {
171+ annotationModelfile : string (modelfile .Content ()),
172+ }
167173 return anno
168174}
0 commit comments