Class NativeAPI.ModelInfo
public static class NativeAPI.ModelInfo
- Inheritance
-
objectNativeAPI.ModelInfo
Methods
litert_lm_loaded_file_create(string)
Loads a LiteRT-LM file from the given path for capability queries.
public static extern nint litert_lm_loaded_file_create(string litertlmPath)
Parameters
litertlmPathstring
Returns
- nint
Returns nint.Zero if the file cannot be opened.
litert_lm_loaded_file_delete(nint)
Deletes a loaded LiteRT-LM file.
public static extern void litert_lm_loaded_file_delete(nint loadedFile)
Parameters
loadedFilenint
litert_lm_loaded_file_embedding_dimension(nint)
Returns the output embedding dimension for the model.
public static extern int litert_lm_loaded_file_embedding_dimension(nint loadedFile)
Parameters
loadedFilenintThe loaded file handle.
Returns
- int
The output embedding dimension, or -1 if not defined.
Remarks
Returns -1 if the model is not an embedding model or if the dimension is not defined.
litert_lm_loaded_file_embedding_signature_selection(nint, int[]?, int)
Returns the number of supported embedding signature sequence lengths.
public static extern int litert_lm_loaded_file_embedding_signature_selection(nint loadedFile, int[]? lengths, int maxSize)
Parameters
loadedFilenintThe loaded file handle.
lengthsint[]The array to receive sequence lengths, or null to query the count.
maxSizeintThe maximum number of sequence lengths to write.
Returns
- int
The number of sequence lengths written, or -1 if the model is not an embedding model.
Remarks
Writes up to maxSize lengths to the provided lengths array.
If lengths is null, only returns the count.
Returns -1 if the model is not an embedding model or if signature lengths are not defined.
litert_lm_loaded_file_has_speculative_decoding_support(nint)
Returns true if the loaded LiteRT-LM file supports speculative decoding.
public static extern bool litert_lm_loaded_file_has_speculative_decoding_support(nint loadedFile)
Parameters
loadedFilenint
Returns
- bool
litert_lm_loaded_file_is_dynamic_context(nint)
Returns whether the model has dynamic context.
public static extern bool litert_lm_loaded_file_is_dynamic_context(nint loadedFile)
Parameters
loadedFilenintThe loaded file handle.
Returns
Remarks
Dynamic context means the context size can be configured by the caller up to the maximum limit.
litert_lm_loaded_file_max_context_tokens(nint)
Returns the maximum supported context tokens for the loaded LiteRT-LM file.
public static extern uint litert_lm_loaded_file_max_context_tokens(nint loadedFile)
Parameters
loadedFilenint
Returns
- uint
Returns 0 if not found or on error.
Remarks
litert_lm_loaded_file_max_vision_token_budget(nint)
Returns the maximum vision token budget for the model.
public static extern int litert_lm_loaded_file_max_vision_token_budget(nint loadedFile)
Parameters
loadedFilenint
Returns
- int
Remarks
Returns -1 if the model does not support vision or if the budget is not defined.
litert_lm_loaded_file_min_runtime_version(nint)
Returns the minimum LiteRT-LM runtime version required to run this model.
public static extern nint litert_lm_loaded_file_min_runtime_version(nint loadedFile)
Parameters
loadedFilenintThe loaded file handle.
Returns
- nint
A pointer to the UTF-8 version string, or nint.Zero if not defined.
Remarks
The returned pointer is valid as long as the loaded file is valid. Returns nint.Zero if the version requirement is not defined.
litert_lm_loaded_file_modality_npu_brand(nint, Modality)
Returns the detected NPU brand of the model for a given modality, or Unknown if not NPU-compiled for this modality.
public static extern NpuBrand litert_lm_loaded_file_modality_npu_brand(nint loadedFile, Modality modality)
Parameters
loadedFilenintThe loaded file handle.
modalityModalityThe modality to query.
Returns
- NpuBrand
The detected NPU brand.
litert_lm_loaded_file_modality_soc_name(nint, Modality)
Returns the target SoC name for a given modality (e.g. "SM8750", "Tensor_G5"), or nint.Zero if not specified or not NPU-compiled.
public static extern nint litert_lm_loaded_file_modality_soc_name(nint loadedFile, Modality modality)
Parameters
loadedFilenintThe loaded file handle.
modalityModalityThe modality to query.
Returns
- nint
A pointer to the UTF-8 SoC name string, or nint.Zero if not specified or not NPU-compiled.
Remarks
The returned pointer is valid as long as the loaded file is valid.
litert_lm_loaded_file_modality_supported_backends(nint, Modality, BackendType[]?, int)
Returns the number of supported backends for a given modality, ordered by priority (first entry is the default/highest-priority backend).
public static extern int litert_lm_loaded_file_modality_supported_backends(nint loadedFile, Modality modality, BackendType[]? backends, int maxSize)
Parameters
loadedFilenintmodalityModalitybackendsBackendType[]maxSizeint
Returns
- int
If
backendsis null, only returns the count of supported backends. Returns 0 if the modality is not supported.
Remarks
Writes up to maxSize backends to the provided backends array.
litert_lm_loaded_file_model_type(nint)
Returns the model type of the loaded LiteRT-LM file.
public static extern ModelType litert_lm_loaded_file_model_type(nint loadedFile)
Parameters
loadedFilenintThe loaded file handle.
Returns
- ModelType
The model type.
litert_lm_loaded_file_sampler_temperature(nint)
Returns the default sampler temperature for the model.
public static extern float litert_lm_loaded_file_sampler_temperature(nint loadedFile)
Parameters
loadedFilenint
Returns
- float
litert_lm_loaded_file_sampler_top_k(nint)
Returns the default sampler topK for the model.
public static extern int litert_lm_loaded_file_sampler_top_k(nint loadedFile)
Parameters
loadedFilenint
Returns
- int
litert_lm_loaded_file_sampler_top_p(nint)
Returns the default sampler topP for the model.
public static extern float litert_lm_loaded_file_sampler_top_p(nint loadedFile)
Parameters
loadedFilenint
Returns
- float
litert_lm_loaded_file_sampler_type(nint)
Returns the default sampler type for the model.
public static extern SamplerType litert_lm_loaded_file_sampler_type(nint loadedFile)
Parameters
loadedFilenint
Returns
litert_lm_loaded_file_supports_function_calling(nint)
Returns true if the model supports function calling / tool use. If the metadata is not explicitly set in the model, this returns false.
public static extern bool litert_lm_loaded_file_supports_function_calling(nint loadedFile)
Parameters
loadedFilenint
Returns
- bool
litert_lm_loaded_file_supports_input_modality(nint, Modality)
Returns true if the input modality is supported.
public static extern bool litert_lm_loaded_file_supports_input_modality(nint loadedFile, Modality modality)
Parameters
loadedFilenintmodalityModality
Returns
- bool
litert_lm_loaded_file_supports_thinking(nint)
Returns true if the model supports thinking / reasoning steps. If the metadata is not explicitly set in the model, this returns false.
public static extern bool litert_lm_loaded_file_supports_thinking(nint loadedFile)
Parameters
loadedFilenint
Returns
- bool
litert_lm_loaded_file_vision_signature_selection(nint, int[]?, int)
Returns the number of supported vision token lengths.
public static extern int litert_lm_loaded_file_vision_signature_selection(nint loadedFile, int[]? lengths, int maxSize)
Parameters
loadedFilenintlengthsint[]maxSizeint
Returns
- int
If
lengthsis null, only returns the count. Returns -1 if the model does not support vision.
Remarks
Writes up to maxSize lengths to the provided array.