diff --git a/crates/goose-local-inference/Cargo.toml b/crates/goose-local-inference/Cargo.toml index bc60fc257..785ad2af1 100644 --- a/crates/goose-local-inference/Cargo.toml +++ b/crates/goose-local-inference/Cargo.toml @@ -45,12 +45,11 @@ tracing = { workspace = true } uuid = { workspace = true, features = ["v4", "std"] } tempfile = { workspace = true } +[target.'cfg(target_os = "macos")'.dependencies] +llama-cpp-2 = { workspace = true, features = ["sampler", "metal", "mtmd"] } safemlx = { default-features = false, features = ["accelerate", "metal", "safetensors"], optional = true, version = "0.1.2" } safemlx-lm = { optional = true, version = "0.1.5" } safemlx-lm-utils = { optional = true, version = "0.1.2" } -[target.'cfg(target_os = "macos")'.dependencies] -llama-cpp-2 = { workspace = true, features = ["sampler", "metal", "mtmd"] } - [dev-dependencies] env-lock.workspace = true diff --git a/crates/goose-local-inference/src/hf_models.rs b/crates/goose-local-inference/src/hf_models.rs index a4ba502b0..970fdbb05 100644 --- a/crates/goose-local-inference/src/hf_models.rs +++ b/crates/goose-local-inference/src/hf_models.rs @@ -1842,14 +1842,14 @@ fn mlx_config_support(config: &Option) -> Option { mlx_config_support_for_value(config) } -#[cfg(feature = "mlx")] +#[cfg(all(feature = "mlx", target_os = "macos"))] fn mlx_config_support_for_value(config: &serde_json::Value) -> Option { safemlx_lm::check_model_config(config) .unsupported_reason() .map(str::to_string) } -#[cfg(not(feature = "mlx"))] +#[cfg(not(all(feature = "mlx", target_os = "macos")))] fn mlx_config_support_for_value(_config: &serde_json::Value) -> Option { None } diff --git a/crates/goose-local-inference/src/mlx.rs b/crates/goose-local-inference/src/mlx.rs index 6b6ddb0fd..145980087 100644 --- a/crates/goose-local-inference/src/mlx.rs +++ b/crates/goose-local-inference/src/mlx.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "mlx")] +#[cfg(all(feature = "mlx", target_os = "macos"))] mod imp { use std::any::Any; use std::path::{Path, PathBuf}; @@ -990,7 +990,7 @@ mod imp { } } -#[cfg(not(feature = "mlx"))] +#[cfg(not(all(feature = "mlx", target_os = "macos")))] mod imp { use crate::backend::{BackendLoadedModel, LocalGenerationRequest, LocalInferenceBackend}; use crate::local_model_registry::ModelSettings;