use crate::define_tool;
use crate::tools::common::{InstallError, has, run};
define_tool!(VLLM, {
command: "vllm",
custom_install: install_vllm,
});
fn install_vllm(_min_hint: &str) -> Result<(), InstallError> {
if has("vllm") {
return Ok(());
}
let has_python = has("python3") || has("python");
if !has_python {
return Err(InstallError::Prereq(
"Python not found. Install Python 3.10+ and re-run.",
));
}
let pip_cmd = if has("pip3") { "pip3" } else { "pip" };
if !has(pip_cmd) {
return Err(InstallError::Prereq(
"pip not found. Install pip and re-run.",
));
}
run(pip_cmd, &["install", "vllm"])?;
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn ensure_vllm_no_panic() {
let res = ensure("");
assert!(res.is_ok() || res.is_err());
}
}