Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Rename Ensu inference module to llm

Manav Rathi24d9ff2e9002
diff --git a/rust/apps/ensu/src-tauri/src/commands/inference.rs b/rust/apps/ensu/src-tauri/src/commands/llm.rs
similarity index 90%
rename from rust/apps/ensu/src-tauri/src/commands/inference.rs
rename to rust/apps/ensu/src-tauri/src/commands/llm.rs
index 55efe4e967..90d61eac0f 100644
--- a/rust/apps/ensu/src-tauri/src/commands/inference.rs
+++ b/rust/apps/ensu/src-tauri/src/commands/llm.rs
@@ -4,7 +4,7 @@ use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};
use ente_ensu::config;
-use ente_ensu::inference;
+use ente_ensu::llm;
use serde::{Deserialize, Serialize};
use tauri::async_runtime;
use tauri::{AppHandle, Emitter, Manager, State, WebviewWindow};
@@ -14,8 +14,8 @@ use crate::logging;
#[derive(Default)]
pub struct LlmState {
- model: Mutex<Option<inference::ModelHandleRef>>,
- context: Mutex<Option<inference::ContextHandleRef>>,
+ model: Mutex<Option<llm::ModelHandleRef>>,
+ context: Mutex<Option<llm::ContextHandleRef>>,
}
pub struct LlmModelDownloadState {
@@ -118,8 +118,8 @@ fn fs_thread_error() -> ApiError {
pub(crate) fn replace_llm_state(
llm_state: &LlmState,
- model: Option<inference::ModelHandleRef>,
- context: Option<inference::ContextHandleRef>,
+ model: Option<llm::ModelHandleRef>,
+ context: Option<llm::ContextHandleRef>,
) -> Result<(), ApiError> {
let mut model_guard = llm_state
.model
@@ -148,23 +148,23 @@ fn default_llm_threads() -> i32 {
#[serde(tag = "type", rename_all = "snake_case")]
enum LlmEvent {
Text {
- job_id: inference::JobId,
+ job_id: llm::JobId,
text: String,
token_id: Option<i32>,
},
Done {
- summary: inference::GenerateSummary,
+ summary: llm::GenerateSummary,
},
Error {
- job_id: inference::JobId,
+ job_id: llm::JobId,
message: String,
},
}
-impl From<inference::GenerateEvent> for LlmEvent {
- fn from(value: inference::GenerateEvent) -> Self {
+impl From<llm::GenerateEvent> for LlmEvent {
+ fn from(value: llm::GenerateEvent) -> Self {
match value {
- inference::GenerateEvent::Text {
+ llm::GenerateEvent::Text {
job_id,
text,
token_id,
@@ -173,8 +173,8 @@ impl From<inference::GenerateEvent> for LlmEvent {
text,
token_id,
},
- inference::GenerateEvent::Done { summary } => Self::Done { summary },
- inference::GenerateEvent::Error { job_id, message } => Self::Error { job_id, message },
+ llm::GenerateEvent::Done { summary } => Self::Done { summary },
+ llm::GenerateEvent::Error { job_id, message } => Self::Error { job_id, message },
}
}
}
@@ -185,7 +185,7 @@ const LLM_EVENT_BATCH_BYTES: usize = 2048;
struct LlmEventSink {
window: WebviewWindow,
buffered_text: String,
- buffered_job_id: Option<inference::JobId>,
+ buffered_job_id: Option<llm::JobId>,
buffered_token_id: Option<i32>,
last_emit: Instant,
}
@@ -225,10 +225,10 @@ impl LlmEventSink {
}
}
-impl inference::EventSink for LlmEventSink {
- fn add(&mut self, event: inference::GenerateEvent) {
+impl llm::EventSink for LlmEventSink {
+ fn add(&mut self, event: llm::GenerateEvent) {
match event {
- inference::GenerateEvent::Text {
+ llm::GenerateEvent::Text {
job_id,
text,
token_id,
@@ -254,11 +254,11 @@ impl inference::EventSink for LlmEventSink {
self.flush_text();
}
}
- inference::GenerateEvent::Done { summary } => {
+ llm::GenerateEvent::Done { summary } => {
self.flush_text();
let _ = self.window.emit("llm-event", LlmEvent::Done { summary });
}
- inference::GenerateEvent::Error { job_id, message } => {
+ llm::GenerateEvent::Error { job_id, message } => {
self.flush_text();
let _ = self
.window
@@ -283,7 +283,7 @@ pub async fn llm_download_model_files(
cancel_requested.store(false, Ordering::SeqCst);
let targets = downloads
.into_iter()
- .map(|download| inference::LlmModelDownloadTarget {
+ .map(|download| llm::LlmModelDownloadTarget {
label: download.label,
url: download.url,
destination_path: download.path,
@@ -292,7 +292,7 @@ pub async fn llm_download_model_files(
async_runtime::spawn_blocking(move || {
let progress_window = window.clone();
- inference::download_llm_model_files(
+ llm::download_llm_model_files(
targets,
move |progress| {
log_download_metrics(&progress);
@@ -313,7 +313,7 @@ pub fn llm_cancel_model_download(state: State<'_, LlmModelDownloadState>) {
}
fn tauri_download_progress(
- progress: inference::LlmModelDownloadProgress,
+ progress: llm::LlmModelDownloadProgress,
) -> TauriLlmModelDownloadProgress {
let percent = if progress.total_bytes.is_some() {
progress.percentage.round().clamp(0.0, 100.0) as i32
@@ -333,7 +333,7 @@ fn tauri_download_progress(
}
}
-fn download_progress_status(progress: &inference::LlmModelDownloadProgress) -> String {
+fn download_progress_status(progress: &llm::LlmModelDownloadProgress) -> String {
if progress.label == "Complete" {
return "Download complete".to_string();
}
@@ -358,7 +358,7 @@ fn download_progress_status(progress: &inference::LlmModelDownloadProgress) -> S
}
}
-fn log_download_metrics(progress: &inference::LlmModelDownloadProgress) {
+fn log_download_metrics(progress: &llm::LlmModelDownloadProgress) {
if progress.file_complete {
logging::log(
"LLMDownload",
@@ -413,7 +413,7 @@ fn format_rate(bytes_per_second: f64) -> String {
pub async fn llm_init_backend() -> Result<(), ApiError> {
logging::log("LLM", "init backend requested");
async_runtime::spawn_blocking(|| {
- match catch_unwind(AssertUnwindSafe(inference::init_backend)) {
+ match catch_unwind(AssertUnwindSafe(llm::init_backend)) {
Ok(result) => result.map_err(llm_error),
Err(payload) => {
let message = panic_message(payload);
@@ -437,14 +437,14 @@ pub async fn llm_init_backend() -> Result<(), ApiError> {
#[tauri::command]
pub async fn llm_load_model(
state: State<'_, LlmState>,
- params: inference::ModelLoadParams,
+ params: llm::ModelLoadParams,
) -> Result<(), ApiError> {
logging::log(
"LLM",
format!("load model requested model_path={}", params.model_path),
);
let model = async_runtime::spawn_blocking(move || {
- match catch_unwind(AssertUnwindSafe(|| inference::load_model(params))) {
+ match catch_unwind(AssertUnwindSafe(|| llm::load_model(params))) {
Ok(result) => result.map_err(llm_error),
Err(payload) => {
let message = panic_message(payload);
@@ -470,7 +470,7 @@ pub async fn llm_load_model(
#[tauri::command]
pub async fn llm_create_context(
state: State<'_, LlmState>,
- params: inference::ContextParams,
+ params: llm::ContextParams,
) -> Result<(), ApiError> {
let model = state
.model
@@ -493,7 +493,7 @@ pub async fn llm_create_context(
let context = async_runtime::spawn_blocking(move || {
match catch_unwind(AssertUnwindSafe(|| {
- inference::create_context(model, params)
+ llm::create_context(model, params)
})) {
Ok(result) => result.map_err(llm_error),
Err(payload) => {
@@ -556,7 +556,7 @@ pub async fn llm_prewarm_multimodal_context(
);
async_runtime::spawn_blocking(move || {
match catch_unwind(AssertUnwindSafe(|| {
- inference::prewarm_multimodal_context(context.as_ref(), mmproj_path, media_marker)
+ llm::prewarm_multimodal_context(context.as_ref(), mmproj_path, media_marker)
})) {
Ok(result) => result.map_err(llm_error),
Err(payload) => {
@@ -582,7 +582,7 @@ pub async fn llm_prewarm_multimodal_context(
pub fn llm_generate_chat_stream(
state: State<LlmState>,
window: WebviewWindow,
- request: inference::GenerateChatRequest,
+ request: llm::GenerateChatRequest,
) -> Result<(), ApiError> {
let context = state
.context
@@ -594,7 +594,7 @@ pub fn llm_generate_chat_stream(
async_runtime::spawn_blocking(move || {
match catch_unwind(AssertUnwindSafe(|| {
let mut sink = LlmEventSink::new(window.clone());
- let _ = inference::generate_chat_stream(context.as_ref(), request, &mut sink);
+ let _ = llm::generate_chat_stream(context.as_ref(), request, &mut sink);
})) {
Ok(()) => {}
Err(payload) => {
@@ -616,7 +616,7 @@ pub fn llm_generate_chat_stream(
#[tauri::command]
pub fn llm_cancel(job_id: i64) -> Result<(), ApiError> {
- inference::cancel(job_id).map_err(llm_error)
+ llm::cancel(job_id).map_err(llm_error)
}
pub(crate) fn clear_for_exit(app: &AppHandle) {
diff --git a/rust/apps/ensu/src-tauri/src/commands/mod.rs b/rust/apps/ensu/src-tauri/src/commands/mod.rs
index f52b70c585..539bb4fcdb 100644
--- a/rust/apps/ensu/src-tauri/src/commands/mod.rs
+++ b/rust/apps/ensu/src-tauri/src/commands/mod.rs
@@ -2,7 +2,7 @@ pub(crate) mod chat_db;
mod common;
pub(crate) mod crypto;
pub(crate) mod fs;
-pub(crate) mod inference;
+pub(crate) mod llm;
pub(crate) mod secure_storage;
pub(crate) mod system;
@@ -12,7 +12,7 @@ use crate::logging;
pub fn cleanup_for_exit(app: &AppHandle) {
logging::log("App", "cleanup_for_exit start");
- inference::clear_for_exit(app);
+ llm::clear_for_exit(app);
chat_db::clear_for_exit(app);
logging::log("App", "cleanup_for_exit complete");
}
diff --git a/rust/apps/ensu/src-tauri/src/main.rs b/rust/apps/ensu/src-tauri/src/main.rs
index afcc441a5c..c39dca6116 100644
--- a/rust/apps/ensu/src-tauri/src/main.rs
+++ b/rust/apps/ensu/src-tauri/src/main.rs
@@ -15,8 +15,8 @@ fn main() {
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_process::init())
.plugin(tauri_plugin_updater::Builder::new().build())
- .manage(commands::inference::LlmState::default())
- .manage(commands::inference::LlmModelDownloadState::default())
+ .manage(commands::llm::LlmState::default())
+ .manage(commands::llm::LlmModelDownloadState::default())
.manage(commands::chat_db::ChatDbState::default())
.setup(|app| {
logging::init_logging(app.handle());
@@ -55,18 +55,18 @@ fn main() {
commands::chat_db::chat_db_compress_attachment_image_file,
commands::chat_db::chat_db_reset,
commands::chat_db::chat_db_migrate_legacy,
- commands::inference::llm_init_backend,
- commands::inference::llm_load_model,
- commands::inference::llm_create_context,
- commands::inference::llm_free_context,
- commands::inference::llm_free_model,
- commands::inference::llm_prewarm_multimodal_context,
- commands::inference::llm_generate_chat_stream,
- commands::inference::llm_cancel,
+ commands::llm::llm_init_backend,
+ commands::llm::llm_load_model,
+ commands::llm::llm_create_context,
+ commands::llm::llm_free_context,
+ commands::llm::llm_free_model,
+ commands::llm::llm_prewarm_multimodal_context,
+ commands::llm::llm_generate_chat_stream,
+ commands::llm::llm_cancel,
commands::system::system_info,
- commands::inference::get_ensu_defaults,
- commands::inference::llm_download_model_files,
- commands::inference::llm_cancel_model_download,
+ commands::llm::get_ensu_defaults,
+ commands::llm::llm_download_model_files,
+ commands::llm::llm_cancel_model_download,
commands::fs::fs_file_size,
commands::fs::fs_read_head,
])
diff --git a/rust/bindings/uniffi/ensu/src/lib.rs b/rust/bindings/uniffi/ensu/src/lib.rs
index c6bc4b83c6..1be4926472 100644
--- a/rust/bindings/uniffi/ensu/src/lib.rs
+++ b/rust/bindings/uniffi/ensu/src/lib.rs
@@ -1,5 +1,5 @@
uniffi::setup_scaffolding!("ensu");
pub mod db;
-pub mod inference;
+pub mod llm;
pub mod transcription;
diff --git a/rust/bindings/uniffi/ensu/src/inference.rs b/rust/bindings/uniffi/ensu/src/llm.rs
similarity index 78%
rename from rust/bindings/uniffi/ensu/src/inference.rs
rename to rust/bindings/uniffi/ensu/src/llm.rs
index d7f6df285b..b3bbc8791c 100644
--- a/rust/bindings/uniffi/ensu/src/inference.rs
+++ b/rust/bindings/uniffi/ensu/src/llm.rs
@@ -1,22 +1,22 @@
use ente_ensu::config;
-use ente_ensu::inference as core;
+use ente_ensu::llm as core;
use std::sync::Arc;
use thiserror::Error;
#[derive(Debug, Error, uniffi::Error)]
-pub enum InferenceError {
+pub enum LlmError {
#[error("{0}")]
Message(String),
}
-impl From<String> for InferenceError {
+impl From<String> for LlmError {
fn from(value: String) -> Self {
Self::Message(value)
}
}
#[derive(Debug, Clone, uniffi::Record)]
-pub struct ModelLoadParams {
+pub struct LlmModelLoadParams {
pub model_path: String,
pub n_gpu_layers: Option<i32>,
pub use_mmap: Option<bool>,
@@ -24,14 +24,14 @@ pub struct ModelLoadParams {
}
#[derive(Debug, Clone, uniffi::Record)]
-pub struct ContextParams {
+pub struct LlmContextParams {
pub context_size: Option<i32>,
pub n_threads: Option<i32>,
pub n_batch: Option<i32>,
}
#[derive(Debug, Clone, uniffi::Record)]
-pub struct EnsuModelPreset {
+pub struct LlmModelPreset {
pub id: String,
pub title: String,
pub url: String,
@@ -44,21 +44,21 @@ pub struct EnsuDefaults {
pub desktop_system_prompt_body: String,
pub system_prompt_date_placeholder: String,
pub session_summary_system_prompt: String,
- pub mobile_default_model: EnsuModelPreset,
- pub mobile_model_presets: Vec<EnsuModelPreset>,
- pub desktop_default_model: EnsuModelPreset,
- pub desktop_model_presets: Vec<EnsuModelPreset>,
+ pub mobile_default_model: LlmModelPreset,
+ pub mobile_model_presets: Vec<LlmModelPreset>,
+ pub desktop_default_model: LlmModelPreset,
+ pub desktop_model_presets: Vec<LlmModelPreset>,
}
#[derive(Debug, Clone, uniffi::Record)]
-pub struct ChatMessage {
+pub struct LlmChatMessage {
pub role: String,
pub content: String,
}
#[derive(Debug, Clone, uniffi::Record)]
-pub struct GenerateChatRequest {
- pub messages: Vec<ChatMessage>,
+pub struct LlmGenerateChatRequest {
+ pub messages: Vec<LlmChatMessage>,
pub template_override: Option<String>,
pub add_assistant: Option<bool>,
pub image_paths: Option<Vec<String>>,
@@ -77,7 +77,7 @@ pub struct GenerateChatRequest {
}
#[derive(Debug, Clone, uniffi::Record)]
-pub struct GenerateSummary {
+pub struct LlmGenerateSummary {
pub job_id: i64,
pub prompt_tokens: Option<i32>,
pub generated_tokens: Option<i32>,
@@ -110,14 +110,14 @@ pub struct LlmModelDownloadProgress {
}
#[derive(Debug, Clone, uniffi::Enum)]
-pub enum GenerateEvent {
+pub enum LlmGenerateEvent {
Text {
job_id: i64,
text: String,
token_id: Option<i32>,
},
Done {
- summary: GenerateSummary,
+ summary: LlmGenerateSummary,
},
Error {
job_id: i64,
@@ -126,18 +126,18 @@ pub enum GenerateEvent {
}
#[derive(uniffi::Object)]
-pub struct ModelHandle {
+pub struct LlmModelHandle {
handle: core::ModelHandleRef,
}
#[derive(uniffi::Object)]
-pub struct ContextHandle {
+pub struct LlmContextHandle {
handle: core::ContextHandleRef,
}
#[uniffi::export(callback_interface)]
-pub trait GenerateEventCallback: Send + Sync {
- fn on_event(&self, event: GenerateEvent);
+pub trait LlmGenerateEventCallback: Send + Sync {
+ fn on_event(&self, event: LlmGenerateEvent);
}
#[uniffi::export(callback_interface)]
@@ -146,8 +146,8 @@ pub trait LlmModelDownloadCallback: Send + Sync {
fn is_cancelled(&self) -> bool;
}
-impl From<ModelLoadParams> for core::ModelLoadParams {
- fn from(value: ModelLoadParams) -> Self {
+impl From<LlmModelLoadParams> for core::ModelLoadParams {
+ fn from(value: LlmModelLoadParams) -> Self {
Self {
model_path: value.model_path,
n_gpu_layers: value.n_gpu_layers,
@@ -157,8 +157,8 @@ impl From<ModelLoadParams> for core::ModelLoadParams {
}
}
-impl From<ContextParams> for core::ContextParams {
- fn from(value: ContextParams) -> Self {
+impl From<LlmContextParams> for core::ContextParams {
+ fn from(value: LlmContextParams) -> Self {
Self {
context_size: value.context_size,
n_threads: value.n_threads,
@@ -167,7 +167,7 @@ impl From<ContextParams> for core::ContextParams {
}
}
-impl From<config::ModelPreset> for EnsuModelPreset {
+impl From<config::ModelPreset> for LlmModelPreset {
fn from(value: config::ModelPreset) -> Self {
Self {
id: value.id,
@@ -201,8 +201,8 @@ impl From<config::Defaults> for EnsuDefaults {
}
}
-impl From<ChatMessage> for core::ChatMessage {
- fn from(value: ChatMessage) -> Self {
+impl From<LlmChatMessage> for core::ChatMessage {
+ fn from(value: LlmChatMessage) -> Self {
Self {
role: value.role,
content: value.content,
@@ -210,8 +210,8 @@ impl From<ChatMessage> for core::ChatMessage {
}
}
-impl From<GenerateChatRequest> for core::GenerateChatRequest {
- fn from(value: GenerateChatRequest) -> Self {
+impl From<LlmGenerateChatRequest> for core::GenerateChatRequest {
+ fn from(value: LlmGenerateChatRequest) -> Self {
Self {
messages: value.messages.into_iter().map(Into::into).collect(),
template_override: value.template_override,
@@ -243,7 +243,7 @@ impl From<LlmModelDownloadTarget> for core::LlmModelDownloadTarget {
}
}
-impl From<core::GenerateSummary> for GenerateSummary {
+impl From<core::GenerateSummary> for LlmGenerateSummary {
fn from(value: core::GenerateSummary) -> Self {
Self {
job_id: value.job_id,
@@ -275,7 +275,7 @@ impl From<core::LlmModelDownloadProgress> for LlmModelDownloadProgress {
}
}
-impl From<core::GenerateEvent> for GenerateEvent {
+impl From<core::GenerateEvent> for LlmGenerateEvent {
fn from(value: core::GenerateEvent) -> Self {
match value {
core::GenerateEvent::Text {
@@ -304,7 +304,7 @@ fn u32_to_i32(value: u32) -> i32 {
}
struct CallbackSink {
- callback: Box<dyn GenerateEventCallback>,
+ callback: Box<dyn LlmGenerateEventCallback>,
}
impl core::EventSink for CallbackSink {
@@ -314,24 +314,24 @@ impl core::EventSink for CallbackSink {
}
#[uniffi::export]
-pub fn init_backend() -> Result<(), InferenceError> {
- core::init_backend().map_err(InferenceError::from)
+pub fn llm_init_backend() -> Result<(), LlmError> {
+ core::init_backend().map_err(LlmError::from)
}
#[uniffi::export]
-pub fn load_model(params: ModelLoadParams) -> Result<Arc<ModelHandle>, InferenceError> {
- let model = core::load_model(params.into()).map_err(InferenceError::from)?;
- Ok(Arc::new(ModelHandle { handle: model }))
+pub fn llm_load_model(params: LlmModelLoadParams) -> Result<Arc<LlmModelHandle>, LlmError> {
+ let model = core::load_model(params.into()).map_err(LlmError::from)?;
+ Ok(Arc::new(LlmModelHandle { handle: model }))
}
#[uniffi::export]
-pub fn create_context(
- model: Arc<ModelHandle>,
- params: ContextParams,
-) -> Result<Arc<ContextHandle>, InferenceError> {
+pub fn llm_create_context(
+ model: Arc<LlmModelHandle>,
+ params: LlmContextParams,
+) -> Result<Arc<LlmContextHandle>, LlmError> {
let context =
- core::create_context(model.handle.clone(), params.into()).map_err(InferenceError::from)?;
- Ok(Arc::new(ContextHandle { handle: context }))
+ core::create_context(model.handle.clone(), params.into()).map_err(LlmError::from)?;
+ Ok(Arc::new(LlmContextHandle { handle: context }))
}
#[uniffi::export]
@@ -340,10 +340,10 @@ pub fn get_ensu_defaults() -> EnsuDefaults {
}
#[uniffi::export]
-pub fn download_llm_model_files(
+pub fn llm_download_model_files(
targets: Vec<LlmModelDownloadTarget>,
callback: Box<dyn LlmModelDownloadCallback>,
-) -> Result<(), InferenceError> {
+) -> Result<(), LlmError> {
let callback: Arc<dyn LlmModelDownloadCallback> = Arc::from(callback);
let progress_callback = Arc::clone(&callback);
let cancel_callback = Arc::clone(&callback);
@@ -353,32 +353,32 @@ pub fn download_llm_model_files(
move |progress| progress_callback.on_progress(progress.into()),
move || cancel_callback.is_cancelled(),
)
- .map_err(InferenceError::from)
+ .map_err(LlmError::from)
}
#[uniffi::export]
-pub fn prewarm_multimodal_context(
- context: Arc<ContextHandle>,
+pub fn llm_prewarm_multimodal_context(
+ context: Arc<LlmContextHandle>,
mmproj_path: String,
media_marker: Option<String>,
-) -> Result<(), InferenceError> {
+) -> Result<(), LlmError> {
core::prewarm_multimodal_context(context.handle.as_ref(), mmproj_path, media_marker)
- .map_err(InferenceError::from)
+ .map_err(LlmError::from)
}
#[uniffi::export]
-pub fn generate_chat_stream(
- context: Arc<ContextHandle>,
- request: GenerateChatRequest,
- callback: Box<dyn GenerateEventCallback>,
-) -> Result<GenerateSummary, InferenceError> {
+pub fn llm_generate_chat_stream(
+ context: Arc<LlmContextHandle>,
+ request: LlmGenerateChatRequest,
+ callback: Box<dyn LlmGenerateEventCallback>,
+) -> Result<LlmGenerateSummary, LlmError> {
let mut sink = CallbackSink { callback };
core::generate_chat_stream(context.handle.as_ref(), request.into(), &mut sink)
.map(Into::into)
- .map_err(InferenceError::from)
+ .map_err(LlmError::from)
}
#[uniffi::export]
-pub fn cancel(job_id: i64) {
+pub fn llm_cancel(job_id: i64) {
let _ = core::cancel(job_id);
}
diff --git a/rust/crates/ensu/src/lib.rs b/rust/crates/ensu/src/lib.rs
index 6783c92a42..1a2f29fce9 100644
--- a/rust/crates/ensu/src/lib.rs
+++ b/rust/crates/ensu/src/lib.rs
@@ -1,6 +1,6 @@
pub mod config;
pub mod db;
-pub mod inference;
+pub mod llm;
#[cfg(feature = "transcription")]
pub mod transcription;
diff --git a/rust/crates/ensu/src/inference/context.rs b/rust/crates/ensu/src/llm/context.rs
similarity index 100%
rename from rust/crates/ensu/src/inference/context.rs
rename to rust/crates/ensu/src/llm/context.rs
diff --git a/rust/crates/ensu/src/inference/event.rs b/rust/crates/ensu/src/llm/event.rs
similarity index 100%
rename from rust/crates/ensu/src/inference/event.rs
rename to rust/crates/ensu/src/llm/event.rs
diff --git a/rust/crates/ensu/src/inference/generate.rs b/rust/crates/ensu/src/llm/generate.rs
similarity index 100%
rename from rust/crates/ensu/src/inference/generate.rs
rename to rust/crates/ensu/src/llm/generate.rs
diff --git a/rust/crates/ensu/src/inference/mod.rs b/rust/crates/ensu/src/llm/mod.rs
similarity index 100%
rename from rust/crates/ensu/src/inference/mod.rs
rename to rust/crates/ensu/src/llm/mod.rs
diff --git a/rust/crates/ensu/src/inference/model.rs b/rust/crates/ensu/src/llm/model.rs
similarity index 100%
rename from rust/crates/ensu/src/inference/model.rs
rename to rust/crates/ensu/src/llm/model.rs
diff --git a/rust/crates/ensu/src/inference/model_download.rs b/rust/crates/ensu/src/llm/model_download.rs
similarity index 100%
rename from rust/crates/ensu/src/inference/model_download.rs
rename to rust/crates/ensu/src/llm/model_download.rs
diff --git a/web/apps/ensu/src/pages/chat.tsx b/web/apps/ensu/src/pages/chat.tsx
index e7586a0f6e..128662b140 100644
--- a/web/apps/ensu/src/pages/chat.tsx
+++ b/web/apps/ensu/src/pages/chat.tsx
@@ -3174,7 +3174,7 @@ const Page: React.FC = () => {
}, [advancedUnlocked]);
// Hardcoded fallbacks used when Rust defaults are not available (web-only
- // mode). These must stay in sync with rust/crates/ensu/src/inference/defaults.rs.
+ // mode). These must stay in sync with rust/crates/ensu/src/llm/defaults.rs.
const fallbackSuggestedModels = useMemo(
() =>
isTauriRuntime
diff --git a/web/apps/ensu/src/services/llm/provider.ts b/web/apps/ensu/src/services/llm/provider.ts
index e87c0e2a12..363639fecf 100644
--- a/web/apps/ensu/src/services/llm/provider.ts
+++ b/web/apps/ensu/src/services/llm/provider.ts
@@ -15,7 +15,7 @@ const DEFAULT_GENERATION_MAX_TOKENS = 8_192;
const OVERFLOW_SAFETY_TOKENS = 256;
const MIN_DESKTOP_DEFAULT_MEMORY_BYTES = 16 * 1024 * 1024 * 1024;
-// These fallback values must stay in sync with rust/crates/ensu/src/inference/defaults.rs.
+// These fallback values must stay in sync with rust/crates/ensu/src/llm/defaults.rs.
// When running inside Tauri, resolveDefaultModelForDevice() overwrites them with
// values fetched from the Rust get_ensu_defaults command.
export const DEFAULT_MODEL: ModelInfo = {