#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmEngine {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmSession {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmResponses {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmEngineSettings {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmBenchmarkInfo {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmRepetitionPenaltyConfig {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmNoRepeatNgramConfig {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmSuppressTokensConfig {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmDetokenizeResult {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmTokenizeResult {
_unused: [u8; 0],
}
pub const kLiteRtLmTokenUnionTypeString: LiteRtLmTokenUnionType = 0;
pub const kLiteRtLmTokenUnionTypeIds: LiteRtLmTokenUnionType = 1;
pub type LiteRtLmTokenUnionType = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmTokenUnion {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmTokenUnions {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmInputData {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmSessionConfig {
_unused: [u8; 0],
}
pub const kLiteRtLmSamplerTypeUnspecified: LiteRtLmSamplerType = 0;
pub const kLiteRtLmSamplerTypeTopK: LiteRtLmSamplerType = 1;
pub const kLiteRtLmSamplerTypeTopP: LiteRtLmSamplerType = 2;
pub const kLiteRtLmSamplerTypeGreedy: LiteRtLmSamplerType = 3;
pub type LiteRtLmSamplerType = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmSamplerParams {
_unused: [u8; 0],
}
unsafe extern "C" {
pub fn litert_lm_sampler_params_create(
type_: LiteRtLmSamplerType,
) -> *mut LiteRtLmSamplerParams;
}
unsafe extern "C" {
pub fn litert_lm_sampler_params_delete(params: *mut LiteRtLmSamplerParams);
}
unsafe extern "C" {
pub fn litert_lm_sampler_params_set_top_k(params: *mut LiteRtLmSamplerParams, top_k: i32);
}
unsafe extern "C" {
pub fn litert_lm_sampler_params_set_top_p(params: *mut LiteRtLmSamplerParams, top_p: f32);
}
unsafe extern "C" {
pub fn litert_lm_sampler_params_set_temperature(
params: *mut LiteRtLmSamplerParams,
temperature: f32,
);
}
unsafe extern "C" {
pub fn litert_lm_sampler_params_set_seed(params: *mut LiteRtLmSamplerParams, seed: i32);
}
unsafe extern "C" {
pub fn litert_lm_session_config_create() -> *mut LiteRtLmSessionConfig;
}
unsafe extern "C" {
pub fn litert_lm_session_config_set_max_output_tokens(
config: *mut LiteRtLmSessionConfig,
max_output_tokens: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_session_config_set_apply_prompt_template(
config: *mut LiteRtLmSessionConfig,
apply_prompt_template: bool,
);
}
unsafe extern "C" {
pub fn litert_lm_session_config_set_sampler_params(
config: *mut LiteRtLmSessionConfig,
sampler_params: *const LiteRtLmSamplerParams,
);
}
unsafe extern "C" {
pub fn litert_lm_session_config_delete(config: *mut LiteRtLmSessionConfig);
}
unsafe extern "C" {
pub fn litert_lm_session_config_set_lora_path(
config: *mut LiteRtLmSessionConfig,
lora_path: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_session_config_set_audio_lora_path(
config: *mut LiteRtLmSessionConfig,
audio_lora_path: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_repetition_penalty_config_create() -> *mut LiteRtLmRepetitionPenaltyConfig;
}
unsafe extern "C" {
pub fn litert_lm_repetition_penalty_config_delete(config: *mut LiteRtLmRepetitionPenaltyConfig);
}
unsafe extern "C" {
pub fn litert_lm_repetition_penalty_config_set_repetition_penalty(
config: *mut LiteRtLmRepetitionPenaltyConfig,
repetition_penalty: f32,
);
}
unsafe extern "C" {
pub fn litert_lm_repetition_penalty_config_set_presence_penalty(
config: *mut LiteRtLmRepetitionPenaltyConfig,
presence_penalty: f32,
);
}
unsafe extern "C" {
pub fn litert_lm_repetition_penalty_config_set_frequency_penalty(
config: *mut LiteRtLmRepetitionPenaltyConfig,
frequency_penalty: f32,
);
}
unsafe extern "C" {
pub fn litert_lm_repetition_penalty_config_set_window_size(
config: *mut LiteRtLmRepetitionPenaltyConfig,
window_size: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_no_repeat_ngram_config_create() -> *mut LiteRtLmNoRepeatNgramConfig;
}
unsafe extern "C" {
pub fn litert_lm_no_repeat_ngram_config_delete(config: *mut LiteRtLmNoRepeatNgramConfig);
}
unsafe extern "C" {
pub fn litert_lm_no_repeat_ngram_config_set_no_repeat_ngram_size(
config: *mut LiteRtLmNoRepeatNgramConfig,
no_repeat_ngram_size: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_no_repeat_ngram_config_set_window_size(
config: *mut LiteRtLmNoRepeatNgramConfig,
window_size: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_suppress_tokens_config_create() -> *mut LiteRtLmSuppressTokensConfig;
}
unsafe extern "C" {
pub fn litert_lm_suppress_tokens_config_delete(config: *mut LiteRtLmSuppressTokensConfig);
}
unsafe extern "C" {
pub fn litert_lm_suppress_tokens_config_set_suppress_tokens(
config: *mut LiteRtLmSuppressTokensConfig,
suppress_tokens: *const ::std::os::raw::c_int,
num_tokens: usize,
);
}
pub const kLiteRtLmLogSeverityVerbose: LiteRtLmLogSeverity = 0;
pub const kLiteRtLmLogSeverityDebug: LiteRtLmLogSeverity = 1;
pub const kLiteRtLmLogSeverityInfo: LiteRtLmLogSeverity = 2;
pub const kLiteRtLmLogSeverityWarning: LiteRtLmLogSeverity = 3;
pub const kLiteRtLmLogSeverityError: LiteRtLmLogSeverity = 4;
pub const kLiteRtLmLogSeverityFatal: LiteRtLmLogSeverity = 5;
pub const kLiteRtLmLogSeveritySilent: LiteRtLmLogSeverity = 1000;
pub type LiteRtLmLogSeverity = ::std::os::raw::c_uint;
unsafe extern "C" {
pub fn litert_lm_set_min_log_level(level: LiteRtLmLogSeverity);
}
pub const kLiteRtLmInputDataTypeText: LiteRtLmInputDataType = 0;
pub const kLiteRtLmInputDataTypeImage: LiteRtLmInputDataType = 1;
pub const kLiteRtLmInputDataTypeImageEnd: LiteRtLmInputDataType = 2;
pub const kLiteRtLmInputDataTypeAudio: LiteRtLmInputDataType = 3;
pub const kLiteRtLmInputDataTypeAudioEnd: LiteRtLmInputDataType = 4;
pub type LiteRtLmInputDataType = ::std::os::raw::c_uint;
unsafe extern "C" {
pub fn litert_lm_input_data_create(
type_: LiteRtLmInputDataType,
data: *const ::std::os::raw::c_void,
size: usize,
) -> *mut LiteRtLmInputData;
}
unsafe extern "C" {
pub fn litert_lm_input_data_delete(input_data: *mut LiteRtLmInputData);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_create(
model_path: *const ::std::os::raw::c_char,
backend_str: *const ::std::os::raw::c_char,
vision_backend_str: *const ::std::os::raw::c_char,
audio_backend_str: *const ::std::os::raw::c_char,
) -> *mut LiteRtLmEngineSettings;
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_create_from_raw_file_descriptor(
fd: ::std::os::raw::c_int,
backend_str: *const ::std::os::raw::c_char,
vision_backend_str: *const ::std::os::raw::c_char,
audio_backend_str: *const ::std::os::raw::c_char,
) -> *mut LiteRtLmEngineSettings;
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_delete(settings: *mut LiteRtLmEngineSettings);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_max_num_tokens(
settings: *mut LiteRtLmEngineSettings,
max_num_tokens: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_num_threads(
settings: *mut LiteRtLmEngineSettings,
num_threads: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_audio_num_threads(
settings: *mut LiteRtLmEngineSettings,
num_threads: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_parallel_file_section_loading(
settings: *mut LiteRtLmEngineSettings,
parallel_file_section_loading: bool,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_max_num_images(
settings: *mut LiteRtLmEngineSettings,
max_num_images: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_max_vision_tokens_per_image(
settings: *mut LiteRtLmEngineSettings,
max_vision_tokens_per_image: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_cache_dir(
settings: *mut LiteRtLmEngineSettings,
cache_dir: *const ::std::os::raw::c_char,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_litert_dispatch_lib_dir(
settings: *mut LiteRtLmEngineSettings,
lib_dir: *const ::std::os::raw::c_char,
);
}
pub const kLiteRtLmActivationDataTypeFloat32: LiteRtLmActivationDataType = 0;
pub const kLiteRtLmActivationDataTypeFloat16: LiteRtLmActivationDataType = 1;
pub const kLiteRtLmActivationDataTypeInt16: LiteRtLmActivationDataType = 2;
pub const kLiteRtLmActivationDataTypeInt8: LiteRtLmActivationDataType = 3;
pub type LiteRtLmActivationDataType = ::std::os::raw::c_uint;
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_activation_data_type(
settings: *mut LiteRtLmEngineSettings,
activation_data_type: LiteRtLmActivationDataType,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_prefill_chunk_size(
settings: *mut LiteRtLmEngineSettings,
prefill_chunk_size: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_enable_ynnpack(
settings: *mut LiteRtLmEngineSettings,
enable_ynnpack: bool,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_enable_benchmark(settings: *mut LiteRtLmEngineSettings);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_num_prefill_tokens(
settings: *mut LiteRtLmEngineSettings,
num_prefill_tokens: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_num_decode_tokens(
settings: *mut LiteRtLmEngineSettings,
num_decode_tokens: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_enable_speculative_decoding(
settings: *mut LiteRtLmEngineSettings,
enable_speculative_decoding: bool,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_gpu_decode_steps_per_sync(
settings: *mut LiteRtLmEngineSettings,
num_decode_steps_per_sync: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_gpu_wait_for_weight_uploads(
settings: *mut LiteRtLmEngineSettings,
wait_for_weight_uploads: bool,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_use_ringbuffers_local_attention(
settings: *mut LiteRtLmEngineSettings,
use_ringbuffers_local_attention: bool,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_lora_rank(
settings: *mut LiteRtLmEngineSettings,
lora_rank: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_supported_lora_ranks(
settings: *mut LiteRtLmEngineSettings,
lora_ranks: *const ::std::os::raw::c_int,
num_ranks: usize,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_audio_lora_rank(
settings: *mut LiteRtLmEngineSettings,
lora_rank: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_supported_audio_lora_ranks(
settings: *mut LiteRtLmEngineSettings,
lora_ranks: *const ::std::os::raw::c_int,
num_ranks: usize,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_engine_settings_set_gpu_enable_metal_residency_set(
settings: *mut LiteRtLmEngineSettings,
enable_metal_residency_set: bool,
);
}
unsafe extern "C" {
pub fn litert_lm_engine_create(settings: *const LiteRtLmEngineSettings) -> *mut LiteRtLmEngine;
}
unsafe extern "C" {
pub fn litert_lm_engine_delete(engine: *mut LiteRtLmEngine);
}
unsafe extern "C" {
pub fn litert_lm_engine_create_session(
engine: *mut LiteRtLmEngine,
config: *mut LiteRtLmSessionConfig,
) -> *mut LiteRtLmSession;
}
unsafe extern "C" {
pub fn litert_lm_session_delete(session: *mut LiteRtLmSession);
}
unsafe extern "C" {
pub fn litert_lm_session_cancel_process(session: *mut LiteRtLmSession);
}
unsafe extern "C" {
pub fn litert_lm_session_save_checkpoint(
session: *mut LiteRtLmSession,
label: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_session_rewind_to_checkpoint(
session: *mut LiteRtLmSession,
label: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_session_rewind_to_step(
session: *mut LiteRtLmSession,
step: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_session_run_prefill(
session: *mut LiteRtLmSession,
inputs: *const *const LiteRtLmInputData,
num_inputs: usize,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_session_run_decode(session: *mut LiteRtLmSession) -> *mut LiteRtLmResponses;
}
unsafe extern "C" {
pub fn litert_lm_session_run_text_scoring(
session: *mut LiteRtLmSession,
target_text: *mut *const ::std::os::raw::c_char,
num_targets: usize,
store_token_lengths: bool,
) -> *mut LiteRtLmResponses;
}
unsafe extern "C" {
pub fn litert_lm_session_generate_content(
session: *mut LiteRtLmSession,
inputs: *const *const LiteRtLmInputData,
num_inputs: usize,
) -> *mut LiteRtLmResponses;
}
unsafe extern "C" {
pub fn litert_lm_responses_delete(responses: *mut LiteRtLmResponses);
}
unsafe extern "C" {
pub fn litert_lm_responses_get_num_candidates(
responses: *const LiteRtLmResponses,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_responses_get_response_text_at(
responses: *const LiteRtLmResponses,
index: ::std::os::raw::c_int,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn litert_lm_responses_has_score_at(
responses: *const LiteRtLmResponses,
index: ::std::os::raw::c_int,
) -> bool;
}
unsafe extern "C" {
pub fn litert_lm_responses_get_score_at(
responses: *const LiteRtLmResponses,
index: ::std::os::raw::c_int,
) -> f32;
}
unsafe extern "C" {
pub fn litert_lm_responses_has_token_length_at(
responses: *const LiteRtLmResponses,
index: ::std::os::raw::c_int,
) -> bool;
}
unsafe extern "C" {
pub fn litert_lm_responses_get_token_length_at(
responses: *const LiteRtLmResponses,
index: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_responses_has_token_scores_at(
responses: *const LiteRtLmResponses,
index: ::std::os::raw::c_int,
) -> bool;
}
unsafe extern "C" {
pub fn litert_lm_responses_get_num_token_scores_at(
responses: *const LiteRtLmResponses,
index: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_responses_get_token_scores_at(
responses: *const LiteRtLmResponses,
index: ::std::os::raw::c_int,
) -> *const f32;
}
unsafe extern "C" {
pub fn litert_lm_session_get_benchmark_info(
session: *mut LiteRtLmSession,
) -> *mut LiteRtLmBenchmarkInfo;
}
unsafe extern "C" {
pub fn litert_lm_benchmark_info_delete(benchmark_info: *mut LiteRtLmBenchmarkInfo);
}
unsafe extern "C" {
pub fn litert_lm_benchmark_info_get_time_to_first_token(
benchmark_info: *const LiteRtLmBenchmarkInfo,
) -> f64;
}
unsafe extern "C" {
pub fn litert_lm_benchmark_info_get_total_init_time_in_second(
benchmark_info: *const LiteRtLmBenchmarkInfo,
) -> f64;
}
unsafe extern "C" {
pub fn litert_lm_benchmark_info_get_num_prefill_turns(
benchmark_info: *const LiteRtLmBenchmarkInfo,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_benchmark_info_get_num_decode_turns(
benchmark_info: *const LiteRtLmBenchmarkInfo,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_benchmark_info_get_prefill_token_count_at(
benchmark_info: *const LiteRtLmBenchmarkInfo,
index: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_benchmark_info_get_decode_token_count_at(
benchmark_info: *const LiteRtLmBenchmarkInfo,
index: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_benchmark_info_get_prefill_tokens_per_sec_at(
benchmark_info: *const LiteRtLmBenchmarkInfo,
index: ::std::os::raw::c_int,
) -> f64;
}
unsafe extern "C" {
pub fn litert_lm_benchmark_info_get_decode_tokens_per_sec_at(
benchmark_info: *const LiteRtLmBenchmarkInfo,
index: ::std::os::raw::c_int,
) -> f64;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmStreamChunk {
_unused: [u8; 0],
}
unsafe extern "C" {
pub fn litert_lm_stream_chunk_get_text(
chunk: *const LiteRtLmStreamChunk,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn litert_lm_stream_chunk_is_final(chunk: *const LiteRtLmStreamChunk) -> bool;
}
unsafe extern "C" {
pub fn litert_lm_stream_chunk_get_error(
chunk: *const LiteRtLmStreamChunk,
) -> *const ::std::os::raw::c_char;
}
pub type LiteRtLmStreamCallback = ::std::option::Option<
unsafe extern "C" fn(
callback_data: *mut ::std::os::raw::c_void,
chunk: *const LiteRtLmStreamChunk,
),
>;
unsafe extern "C" {
pub fn litert_lm_session_run_decode_async(
session: *mut LiteRtLmSession,
callback: LiteRtLmStreamCallback,
callback_data: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_session_generate_content_stream(
session: *mut LiteRtLmSession,
inputs: *const *const LiteRtLmInputData,
num_inputs: usize,
callback: LiteRtLmStreamCallback,
callback_data: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_engine_tokenize(
engine: *mut LiteRtLmEngine,
text: *const ::std::os::raw::c_char,
) -> *mut LiteRtLmTokenizeResult;
}
unsafe extern "C" {
pub fn litert_lm_tokenize_result_delete(result: *mut LiteRtLmTokenizeResult);
}
unsafe extern "C" {
pub fn litert_lm_tokenize_result_get_tokens(
result: *const LiteRtLmTokenizeResult,
) -> *const ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_tokenize_result_get_num_tokens(result: *const LiteRtLmTokenizeResult)
-> usize;
}
unsafe extern "C" {
pub fn litert_lm_engine_detokenize(
engine: *mut LiteRtLmEngine,
tokens: *const ::std::os::raw::c_int,
num_tokens: usize,
) -> *mut LiteRtLmDetokenizeResult;
}
unsafe extern "C" {
pub fn litert_lm_detokenize_result_delete(result: *mut LiteRtLmDetokenizeResult);
}
unsafe extern "C" {
pub fn litert_lm_detokenize_result_get_string(
result: *const LiteRtLmDetokenizeResult,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn litert_lm_token_union_delete(token_union: *mut LiteRtLmTokenUnion);
}
unsafe extern "C" {
pub fn litert_lm_token_union_get_type(
token_union: *const LiteRtLmTokenUnion,
) -> LiteRtLmTokenUnionType;
}
unsafe extern "C" {
pub fn litert_lm_token_union_get_string(
token_union: *const LiteRtLmTokenUnion,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn litert_lm_token_union_get_ids(
token_union: *const LiteRtLmTokenUnion,
out_tokens: *mut *const ::std::os::raw::c_int,
out_num_tokens: *mut usize,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_token_unions_delete(tokens: *mut LiteRtLmTokenUnions);
}
unsafe extern "C" {
pub fn litert_lm_token_unions_get_num_tokens(tokens: *const LiteRtLmTokenUnions) -> usize;
}
unsafe extern "C" {
pub fn litert_lm_token_unions_get_token_at(
tokens: *const LiteRtLmTokenUnions,
index: usize,
) -> *mut LiteRtLmTokenUnion;
}
unsafe extern "C" {
pub fn litert_lm_engine_get_start_token(engine: *mut LiteRtLmEngine)
-> *mut LiteRtLmTokenUnion;
}
unsafe extern "C" {
pub fn litert_lm_engine_get_stop_tokens(
engine: *mut LiteRtLmEngine,
) -> *mut LiteRtLmTokenUnions;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmConversation {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmConversationOptionalArgs {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmJsonResponse {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmConversationConfig {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LiteRtLmThinkingConfig {
_unused: [u8; 0],
}
pub const kLiteRtLmConstraintTypeNone: LiteRtLmConstraintType = 0;
pub const kLiteRtLmConstraintTypeRegex: LiteRtLmConstraintType = 1;
pub const kLiteRtLmConstraintTypeJsonSchema: LiteRtLmConstraintType = 2;
pub type LiteRtLmConstraintType = ::std::os::raw::c_uint;
pub const kLiteRtLmConstraintProviderTypeLlGuidance: LiteRtLmConstraintProviderType = 1;
pub type LiteRtLmConstraintProviderType = ::std::os::raw::c_uint;
unsafe extern "C" {
pub fn litert_lm_conversation_config_create() -> *mut LiteRtLmConversationConfig;
}
unsafe extern "C" {
pub fn litert_lm_conversation_config_set_session_config(
config: *mut LiteRtLmConversationConfig,
session_config: *const LiteRtLmSessionConfig,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_config_set_system_message(
config: *mut LiteRtLmConversationConfig,
system_message_json: *const ::std::os::raw::c_char,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_config_set_tools(
config: *mut LiteRtLmConversationConfig,
tools_json: *const ::std::os::raw::c_char,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_config_set_messages(
config: *mut LiteRtLmConversationConfig,
messages_json: *const ::std::os::raw::c_char,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_config_set_extra_context(
config: *mut LiteRtLmConversationConfig,
extra_context_json: *const ::std::os::raw::c_char,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_config_set_prompt_template(
config: *mut LiteRtLmConversationConfig,
prompt_template: *const ::std::os::raw::c_char,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_config_set_enable_constrained_decoding(
config: *mut LiteRtLmConversationConfig,
enable_constrained_decoding: bool,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_config_set_constraint_provider(
config: *mut LiteRtLmConversationConfig,
provider_type: *const LiteRtLmConstraintProviderType,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_config_set_filter_channel_content_from_kv_cache(
config: *mut LiteRtLmConversationConfig,
filter_channel_content_from_kv_cache: bool,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_config_set_stream_tool_calls(
config: *mut LiteRtLmConversationConfig,
stream_tool_calls: bool,
channel_name: *const ::std::os::raw::c_char,
);
}
unsafe extern "C" {
pub fn litert_lm_thinking_config_create() -> *mut LiteRtLmThinkingConfig;
}
unsafe extern "C" {
pub fn litert_lm_thinking_config_delete(config: *mut LiteRtLmThinkingConfig);
}
unsafe extern "C" {
pub fn litert_lm_thinking_config_set_enable_thinking(
config: *mut LiteRtLmThinkingConfig,
enable_thinking: bool,
);
}
unsafe extern "C" {
pub fn litert_lm_thinking_config_set_thinking_token_budget(
config: *mut LiteRtLmThinkingConfig,
thinking_token_budget: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_config_set_thinking_config(
config: *mut LiteRtLmConversationConfig,
thinking_config: *const LiteRtLmThinkingConfig,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_config_delete(config: *mut LiteRtLmConversationConfig);
}
unsafe extern "C" {
pub fn litert_lm_conversation_optional_args_create() -> *mut LiteRtLmConversationOptionalArgs;
}
unsafe extern "C" {
pub fn litert_lm_conversation_optional_args_delete(
optional_args: *mut LiteRtLmConversationOptionalArgs,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_optional_args_set_repetition_penalty_config(
optional_args: *mut LiteRtLmConversationOptionalArgs,
repetition_penalty_config: *const LiteRtLmRepetitionPenaltyConfig,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_optional_args_set_no_repeat_ngram_config(
optional_args: *mut LiteRtLmConversationOptionalArgs,
no_repeat_ngram_config: *const LiteRtLmNoRepeatNgramConfig,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_optional_args_set_suppress_tokens_config(
optional_args: *mut LiteRtLmConversationOptionalArgs,
suppress_tokens_config: *const LiteRtLmSuppressTokensConfig,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_optional_args_set_visual_token_budget(
optional_args: *mut LiteRtLmConversationOptionalArgs,
visual_token_budget: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_optional_args_set_max_output_tokens(
optional_args: *mut LiteRtLmConversationOptionalArgs,
max_output_tokens: ::std::os::raw::c_int,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_optional_args_set_thinking_config(
optional_args: *mut LiteRtLmConversationOptionalArgs,
thinking_config: *const LiteRtLmThinkingConfig,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_optional_args_set_constraint(
optional_args: *mut LiteRtLmConversationOptionalArgs,
constraint_type: LiteRtLmConstraintType,
constraint_string: *const ::std::os::raw::c_char,
);
}
unsafe extern "C" {
pub fn litert_lm_conversation_create(
engine: *mut LiteRtLmEngine,
config: *mut LiteRtLmConversationConfig,
) -> *mut LiteRtLmConversation;
}
unsafe extern "C" {
pub fn litert_lm_conversation_delete(conversation: *mut LiteRtLmConversation);
}
unsafe extern "C" {
pub fn litert_lm_conversation_clone(
conversation: *mut LiteRtLmConversation,
) -> *mut LiteRtLmConversation;
}
unsafe extern "C" {
pub fn litert_lm_conversation_send_message(
conversation: *mut LiteRtLmConversation,
message_json: *const ::std::os::raw::c_char,
extra_context: *const ::std::os::raw::c_char,
optional_args: *const LiteRtLmConversationOptionalArgs,
) -> *mut LiteRtLmJsonResponse;
}
unsafe extern "C" {
pub fn litert_lm_json_response_delete(response: *mut LiteRtLmJsonResponse);
}
unsafe extern "C" {
pub fn litert_lm_json_response_get_string(
response: *const LiteRtLmJsonResponse,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn litert_lm_conversation_send_message_stream(
conversation: *mut LiteRtLmConversation,
message_json: *const ::std::os::raw::c_char,
extra_context: *const ::std::os::raw::c_char,
optional_args: *const LiteRtLmConversationOptionalArgs,
callback: LiteRtLmStreamCallback,
callback_data: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn litert_lm_conversation_render_message_to_string(
conversation: *mut LiteRtLmConversation,
message_json: *const ::std::os::raw::c_char,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn litert_lm_conversation_render_preface_to_string(
conversation: *mut LiteRtLmConversation,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn litert_lm_conversation_cancel_process(conversation: *mut LiteRtLmConversation);
}
unsafe extern "C" {
pub fn litert_lm_conversation_get_benchmark_info(
conversation: *mut LiteRtLmConversation,
) -> *mut LiteRtLmBenchmarkInfo;
}
unsafe extern "C" {
pub fn litert_lm_conversation_get_token_count(
conversation: *mut LiteRtLmConversation,
) -> ::std::os::raw::c_int;
}