Class NativeAPI.SessionConfig
public static class NativeAPI.SessionConfig
- Inheritance
-
objectNativeAPI.SessionConfig
Methods
litert_lm_session_config_create()
Creates a LiteRT LM Session Config. The caller is responsible for destroying the config using litert_lm_session_config_delete(nint).
public static extern nint litert_lm_session_config_create()
Returns
- nint
A pointer to the created config, or nint.Zero on failure.
litert_lm_session_config_delete(nint)
Destroys a LiteRT LM Session Config.
public static extern void litert_lm_session_config_delete(nint config)
Parameters
confignintThe config to destroy.
litert_lm_session_config_set_apply_prompt_template(nint, bool)
Sets whether to apply prompt template for this session.
public static extern void litert_lm_session_config_set_apply_prompt_template(nint config, bool applyPromptTemplate)
Parameters
confignintThe config to modify.
applyPromptTemplateboolWhether to apply prompt template.
litert_lm_session_config_set_audio_lora_path(nint, string)
Sets the path to the Audio LoRA weights file.
public static extern int litert_lm_session_config_set_audio_lora_path(nint config, string audioLoraPath)
Parameters
confignintThe config to modify.
audioLoraPathstringThe path to the audio LoRA weights file.
Returns
- int
0 on success, non-zero on failure.
litert_lm_session_config_set_enable_speculative_decoding(nint, bool)
Sets whether to enable speculative decoding for this session.
public static extern void litert_lm_session_config_set_enable_speculative_decoding(nint config, bool enableSpeculativeDecoding)
Parameters
confignintThe config to modify.
enableSpeculativeDecodingboolWhether to enable speculative decoding. If set to true, speculative decoding is enabled for this session. If the engine was not initialized with speculative decoding enabled, setting this flag to true causes the executor to perform lazy loading of the MTP drafter on the first session request. If set to false, speculative decoding is explicitly disabled for this session even if the engine was initialized with speculative decoding enabled. If this function is not called on the config, the session inherits the engine's speculative decoding setting by default.
litert_lm_session_config_set_lora_path(nint, string)
Sets the path to the LoRA weights file.
public static extern int litert_lm_session_config_set_lora_path(nint config, string loraPath)
Parameters
confignintThe config to modify.
loraPathstringThe path to the text LoRA weights file.
Returns
- int
0 on success, non-zero on failure.
litert_lm_session_config_set_max_output_tokens(nint, int)
Sets the maximum number of output tokens per decode step for this session.
public static extern void litert_lm_session_config_set_max_output_tokens(nint config, int maxOutputTokens)
Parameters
confignintThe config to modify.
maxOutputTokensintThe maximum number of tokens to generate (including thinking tokens).
Remarks
For thinking models, both thinking (reasoning) tokens and the final response tokens count towards this limit.
litert_lm_session_config_set_sampler_params(nint, nint)
Sets the sampler parameters for this session config.
public static extern void litert_lm_session_config_set_sampler_params(nint config, nint samplerParams)
Parameters
confignintThe config to modify.
samplerParamsnintThe sampler parameters to use.