Skip to content

Commit 933b326

Browse files
committed
Turn llm feature on by default.
Signed-off-by: Ryan Levick <[email protected]>
1 parent b599f30 commit 933b326

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ vergen = { version = "^8.2.1", default-features = false, features = [
110110
wit-component = "0.19.0"
111111

112112
[features]
113-
# TODO(factors): default = ["llm"]
113+
default = ["llm"]
114114
all-tests = ["extern-dependencies-tests"]
115115
extern-dependencies-tests = []
116116
llm = ["spin-trigger-http/llm"]

crates/factor-llm/src/spin.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub fn runtime_config_from_toml(
9191
let config: LlmCompute = value.clone().try_into()?;
9292

9393
Ok(Some(RuntimeConfig {
94-
engine: config.into_engine(state_dir, use_gpu),
94+
engine: config.into_engine(state_dir, use_gpu)?,
9595
}))
9696
}
9797

@@ -103,20 +103,25 @@ pub enum LlmCompute {
103103
}
104104

105105
impl LlmCompute {
106-
fn into_engine(self, state_dir: Option<PathBuf>, use_gpu: bool) -> Arc<Mutex<dyn LlmEngine>> {
107-
match self {
106+
fn into_engine(
107+
self,
108+
state_dir: Option<PathBuf>,
109+
use_gpu: bool,
110+
) -> anyhow::Result<Arc<Mutex<dyn LlmEngine>>> {
111+
let engine = match self {
108112
#[cfg(not(feature = "llm"))]
109113
LlmCompute::Spin => {
110114
let _ = (state_dir, use_gpu);
111115
Arc::new(Mutex::new(noop::NoopLlmEngine))
112116
}
113117
#[cfg(feature = "llm")]
114-
LlmCompute::Spin => default_engine_creator(state_dir, use_gpu).create(),
118+
LlmCompute::Spin => default_engine_creator(state_dir, use_gpu)?.create(),
115119
LlmCompute::RemoteHttp(config) => Arc::new(Mutex::new(RemoteHttpLlmEngine::new(
116120
config.url,
117121
config.auth_token,
118122
))),
119-
}
123+
};
124+
Ok(engine)
120125
}
121126
}
122127

0 commit comments

Comments
 (0)