Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pkg/backend/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ type InspectedModelArtifact struct {

// InspectedModelArtifactLayer is the data structure for model artifact layer that has been inspected.
type InspectedModelArtifactLayer struct {
// MediaType is the media type of the model artifact layer.
MediaType string `json:"MediaType"`
// Digest is the digest of the model artifact layer.
Digest string `json:"Digest"`
// Size is the size of the model artifact layer.
Expand Down Expand Up @@ -114,9 +116,10 @@ func (b *backend) Inspect(ctx context.Context, target string, cfg *config.Inspec

for _, layer := range manifest.Layers {
inspectedModelArtifact.Layers = append(inspectedModelArtifact.Layers, InspectedModelArtifactLayer{
Digest: layer.Digest.String(),
Size: layer.Size,
Filepath: layer.Annotations[modelspec.AnnotationFilepath],
MediaType: layer.MediaType,
Digest: layer.Digest.String(),
Size: layer.Size,
Filepath: layer.Annotations[modelspec.AnnotationFilepath],
})
}

Expand Down
1 change: 1 addition & 0 deletions pkg/backend/inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func TestInspect(t *testing.T) {
assert.Equal(t, "int8", inspected.Precision)
assert.Equal(t, "gptq", inspected.Quantization)
assert.Len(t, inspected.Layers, 8)
assert.Equal(t, "application/vnd.cnai.model.doc.v1.tar", inspected.Layers[0].MediaType)
assert.Equal(t, "sha256:5a96686deb327903f4310e9181ef2ee0bc7261e5181bd23ccdce6c575b6120a2", inspected.Layers[0].Digest)
assert.Equal(t, "LICENSE", inspected.Layers[0].Filepath)
assert.Equal(t, int64(13312), inspected.Layers[0].Size)
Expand Down