mutterkey
KDE-first push-to-talk transcription tool for KDE Plasma
Loading...
Searching...
No Matches
modelpackage.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <QJsonObject>
6
7#include <optional>
8#include <vector>
9
20 QString engine;
22 QString modelFormat;
23};
24
30 QString role;
32 QString relativePath;
34 QString sha256;
36 qint64 sizeBytes = 0;
37};
38
44 QString format;
50 std::vector<ModelCompatibilityMarker> compatibleEngines;
52 std::vector<ModelAssetMetadata> assets;
55};
56
64 QString manifestPath;
66 QString sourcePath;
68 QString weightsPath;
71
76 [[nodiscard]] const ModelMetadata &metadata() const { return manifest.metadata; }
77
82 [[nodiscard]] bool isLegacyCompatibility() const { return manifest.metadata.legacyCompatibility; }
83
88 [[nodiscard]] QString description() const;
89};
90
95[[nodiscard]] QString cpuReferenceEngineName();
96
101[[nodiscard]] QString cpuReferenceModelFormat();
102
107[[nodiscard]] QString legacyWhisperEngineName();
108
113[[nodiscard]] QString legacyWhisperModelFormat();
114
123 QStringView engine,
124 QStringView modelFormat);
125
130[[nodiscard]] QString defaultModelPackageDirectory();
131
137[[nodiscard]] QString sanitizePackageId(const QString &value);
138
144[[nodiscard]] QJsonObject modelPackageManifestToJson(const ModelPackageManifest &manifest);
145
152[[nodiscard]] std::optional<ModelPackageManifest> modelPackageManifestFromJson(const QJsonObject &root, QString *errorMessage = nullptr);
QString sanitizePackageId(const QString &value)
Normalizes a human-provided package id into a stable filesystem-safe form.
QString defaultModelPackageDirectory()
Returns the default root directory for native model packages.
QString legacyWhisperEngineName()
Stable engine identifier for the legacy whisper.cpp adapter.
std::optional< ModelPackageManifest > modelPackageManifestFromJson(const QJsonObject &root, QString *errorMessage=nullptr)
Parses a product-owned package manifest from JSON.
QJsonObject modelPackageManifestToJson(const ModelPackageManifest &manifest)
Serializes a product-owned package manifest to JSON.
bool modelPackageSupportsCompatibility(const ModelPackageManifest &manifest, QStringView engine, QStringView modelFormat)
Reports whether a manifest advertises compatibility with a runtime marker pair.
QString cpuReferenceEngineName()
Stable engine identifier for the native CPU reference runtime.
QString cpuReferenceModelFormat()
Stable model-format identifier for the native CPU reference runtime.
QString legacyWhisperModelFormat()
Stable model-format identifier for the legacy whisper.cpp adapter.
One packaged asset entry recorded in a package manifest.
qint64 sizeBytes
Declared size of the asset in bytes.
QString relativePath
Relative path from the package root to the asset file.
QString sha256
Lowercase SHA-256 digest for the asset contents.
QString role
Logical asset role such as weights.
One engine/model-format compatibility marker recorded in a package manifest.
QString engine
Stable engine identifier accepted by this package.
QString modelFormat
Engine-specific model format marker such as ggml.
Product-owned immutable metadata about a validated model artifact.
bool legacyCompatibility
Raw-path compatibility marker for migration diagnostics.
Product-owned manifest data parsed from model.json.
ModelMetadata metadata
Product-owned immutable metadata about the packaged model.
QString format
Stable package format identifier.
std::vector< ModelAssetMetadata > assets
Packaged assets referenced by this manifest.
int schemaVersion
Schema version for this manifest.
QString sourceArtifact
Optional source artifact description used for diagnostics.
std::vector< ModelCompatibilityMarker > compatibleEngines
Compatible engines and model formats for this package.
Fully validated model package resolved from disk.
QString weightsPath
Resolved weights asset path used by the backend adapter.
QString description() const
Returns a human-readable description for diagnostics and logs.
ModelPackageManifest manifest
Parsed product-owned manifest data.
QString manifestPath
Resolved model.json path when the artifact is a native package.
QString packageRootPath
Resolved package root directory.
const ModelMetadata & metadata() const
Returns the immutable model metadata carried by this package.
bool isLegacyCompatibility() const
Reports whether this package came from the legacy raw-file compatibility path.
QString sourcePath
Original user-provided source path resolved to an absolute path.
Shared value types exchanged by the transcription pipeline.