Class ModelInfo
- Namespace
- Uralstech.UAI.LiteRTLM
public sealed class ModelInfo : LiteRTLMNativeHandle
- Inheritance
-
objectModelInfo
- Inherited Members
Constructors
ModelInfo(string)
Loads a LiteRT-LM file from the given path for capability queries.
public ModelInfo(string modelPath)
Parameters
modelPathstring
Exceptions
- InvalidOperationException
Thrown if the file cannot be opened.
Methods
GetEmbeddingDimension()
Returns the output embedding dimension for the model, or -1 if the model is not an embedding model or if the dimension is not defined.
public int GetEmbeddingDimension()
Returns
- int
GetEmbeddingSignatureSelection()
Returns the supported embedding signature sequence lengths, or null if the model is not an embedding model.
public int[]? GetEmbeddingSignatureSelection()
Returns
- int[]
GetMaxContextTokens()
Returns the maximum supported context tokens for the loaded LiteRT-LM file.
public uint GetMaxContextTokens()
Returns
- uint
Returns 0 if not found or on error.
Remarks
- If the model is static, this is the fixed context size determined by the model graph.
- If the model is dynamic, this is the largest context size that can be set.
GetMaxVisionTokenBudget()
Returns the maximum vision token budget for the model.
public int GetMaxVisionTokenBudget()
Returns
- int
Remarks
Returns -1 if the model does not support vision or if the budget is not defined.
GetMinRuntimeVersion()
Returns the minimum LiteRT-LM runtime version required to run this model, or null if not defined.
public string? GetMinRuntimeVersion()
Returns
- string
GetModalityNpuBrand(Modality)
Returns the detected NPU brand of the model for a given modality.
public NpuBrand GetModalityNpuBrand(Modality modality)
Parameters
modalityModality
Returns
GetModalitySocName(Modality)
Returns the target SoC name for a given modality (e.g. "SM8750", "Tensor_G5"), or null if not specified or not NPU-compiled.
public string? GetModalitySocName(Modality modality)
Parameters
modalityModality
Returns
- string
GetModalitySupportedBackends(Modality)
Returns the supported backends for a given modality, ordered by priority (first entry is the default/highest-priority backend).
public BackendType[] GetModalitySupportedBackends(Modality modality)
Parameters
modalityModality
Returns
GetModelType()
Returns the model type of the loaded LiteRT-LM file.
public ModelType GetModelType()
Returns
GetSamplerTemperature()
Returns the default sampler temperature for the model.
public float GetSamplerTemperature()
Returns
- float
GetSamplerTopK()
Returns the default sampler topK for the model.
public int GetSamplerTopK()
Returns
- int
GetSamplerTopP()
Returns the default sampler topP for the model.
public float GetSamplerTopP()
Returns
- float
GetSamplerType()
Returns the default sampler type for the model.
public SamplerType GetSamplerType()
Returns
GetVisionSignatureSelection()
Returns the supported vision token lengths, or null if the model does not support vision.
public int[]? GetVisionSignatureSelection()
Returns
- int[]
HasSpeculativeDecodingSupport()
Returns true if the loaded LiteRT-LM file supports speculative decoding.
public bool HasSpeculativeDecodingSupport()
Returns
- bool
IsDynamicContext()
Returns whether the model has dynamic context.
public bool IsDynamicContext()
Returns
Remarks
Dynamic context means the context size can be configured by the caller up to the maximum limit.
ReleaseUnmanagedResources()
protected override void ReleaseUnmanagedResources()
SupportsFunctionCalling()
Returns true if the model supports function calling / tool use. If the metadata is not explicitly set in the model, this returns false.
public bool SupportsFunctionCalling()
Returns
- bool
SupportsInputModality(Modality)
Returns true if the input modality is supported.
public bool SupportsInputModality(Modality modality)
Parameters
modalityModality
Returns
- bool
SupportsThinking()
Returns true if the model supports thinking / reasoning steps. If the metadata is not explicitly set in the model, this returns false.
public bool SupportsThinking()
Returns
- bool