SLLlmParametry.sleela
lib/large-language-models/SLLlmParametry.sleela · 130 line(s) · sleela
<< lib/large-language-models/SLLlmParametry.sleela
SLeeLa Standard Library Definition.
Definition: SLeeLa mirror of parametry (sllmp_ in parametry/parametry.h):
binds a SLeeLa LLM or neural net to a model that is either KNOWN by name (in
the built-in registry) or LOCAL by path. A known name fills the declared
parameters (caller overrides where nonzero); a local path takes the caller's
declared parameters as-is; neither resolves and the binding fails closed.
It ships the registry of known NAMES and declared parameters only, never
weights. >>
#sleela 3.0
material;
class SLLlmParametry {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 8210;
String metaAuthor = "Max Rupplin";
String metaDate = "2026-11-06";
String metaCopyright = "MEARVK LLC";
String metaTrademark = "none";
String metaCorporation = "MEARVK LLC";
String metaOrigin = "International";
String metaBirthDate = "2026-11-06";
int metaScienceRating = 6;
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
< sllmp_kind mirror. >
static final int KIND_LLM = 0;
static final int KIND_NEURAL_NET = 1;
< sllmp_source mirror. >
static final int SOURCE_UNSET = 0;
static final int SOURCE_KNOWN = 1;
static final int SOURCE_LOCAL = 2;
< sllmp_status mirror. >
static final int STATUS_OK = 0;
static final int STATUS_INVALID_ARGUMENT = 1;
static final int STATUS_UNKNOWN_MODEL = 2;
static final int STATUS_NO_SOURCE = 3;
static final int STATUS_KIND_MISMATCH = 4;
static final int STATUS_UNSUPPORTED = 5;
< The resolved binding (sllmp_parameters) populated by resolve(). >
int kind;
int source;
String nameOrPath;
long weightBytes;
int contextTokens;
String weightFormat;
<< sllmp_resolve: from a binding naming EITHER a known model OR a local path.
knownBytes/knownContext come from the registry when the name is known
(0 when unknown); caller values are the declared overrides. >>
int resolveBinding(int bindingKind, String name, String localPath,
long knownBytes, int knownContext,
long callerBytes, int callerContext) {
kind = bindingKind;
weightFormat = "q4";
if (name != null && name != "") {
if (knownBytes <= 0) { return STATUS_UNKNOWN_MODEL; }
source = SOURCE_KNOWN;
nameOrPath = name;
< caller overrides applied where nonzero >
if (callerBytes > 0) { weightBytes = callerBytes; } else { weightBytes = knownBytes; }
if (callerContext > 0) { contextTokens = callerContext; } else { contextTokens = knownContext; }
return STATUS_OK;
}
if (localPath != null && localPath != "") {
source = SOURCE_LOCAL;
nameOrPath = localPath;
weightBytes = callerBytes;
contextTokens = callerContext;
return STATUS_OK;
}
source = SOURCE_UNSET;
return STATUS_NO_SOURCE;
}
String kindName(int k) {
if (k == KIND_LLM) { return "llm"; }
if (k == KIND_NEURAL_NET) { return "neural-net"; }
return "unknown";
}
String sourceName(int s) {
if (s == SOURCE_UNSET) { return "unset"; }
if (s == SOURCE_KNOWN) { return "known"; }
if (s == SOURCE_LOCAL) { return "local"; }
return "unknown";
}
String statusString(int status) {
if (status == STATUS_OK) { return "ok"; }
if (status == STATUS_INVALID_ARGUMENT) { return "invalid argument"; }
if (status == STATUS_UNKNOWN_MODEL) { return "unknown model"; }
if (status == STATUS_NO_SOURCE) { return "no source"; }
if (status == STATUS_KIND_MISMATCH) { return "kind mismatch"; }
if (status == STATUS_UNSUPPORTED) { return "unsupported"; }
return "unknown";
}
boolean available() { return source != SOURCE_UNSET; }
}