Skip to content

Commit 0aea068

Browse files
Ryan CoxRyan Cox
authored andcommitted
fix: apply canonical metadata to ollama cloud models
Signed-off-by: Ryan Cox <ryancox@GoDSyNcs-MBP.godsync.com>
1 parent 398c023 commit 0aea068

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

crates/goose/src/model.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,20 @@ mod tests {
460460
assert_eq!(config.reasoning, Some(false));
461461
}
462462

463+
#[test]
464+
fn sets_limits_from_canonical_ollama_cloud_model() {
465+
let _guard = env_lock::lock_env([
466+
("GOOSE_MAX_TOKENS", None::<&str>),
467+
("GOOSE_CONTEXT_LIMIT", None::<&str>),
468+
]);
469+
let config = ModelConfig::new_or_fail("gemini-3-flash-preview")
470+
.with_canonical_limits("ollama_cloud");
471+
472+
assert_eq!(config.context_limit, Some(1_048_576));
473+
assert_eq!(config.max_tokens, Some(65_536));
474+
assert_eq!(config.reasoning, Some(true));
475+
}
476+
463477
#[test]
464478
fn does_not_override_existing_context_limit() {
465479
let _guard = env_lock::lock_env([

crates/goose/src/providers/canonical/name_builder.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pub fn map_provider_name(provider: &str) -> &str {
4747
"aws_bedrock" => "amazon-bedrock",
4848
"gcp_vertex_ai" => "google-vertex",
4949
"gemini_oauth" => "google",
50+
"ollama_cloud" => "ollama-cloud",
5051
"zhipu" => "zhipuai",
5152
_ => provider,
5253
}
@@ -302,6 +303,11 @@ pub fn strip_version_suffix(model: &str) -> String {
302303
mod tests {
303304
use super::*;
304305

306+
#[test]
307+
fn test_map_provider_name_for_ollama_cloud() {
308+
assert_eq!(map_provider_name("ollama_cloud"), "ollama-cloud");
309+
}
310+
305311
#[test]
306312
fn test_map_to_canonical_model() {
307313
let r = super::super::CanonicalModelRegistry::bundled().unwrap();
@@ -501,6 +507,16 @@ mod tests {
501507
Some("zhipuai/glm-5".to_string())
502508
);
503509

510+
// === Ollama Cloud ===
511+
assert_eq!(
512+
map_to_canonical_model("ollama_cloud", "glm-5", r),
513+
Some("ollama-cloud/glm-5".to_string())
514+
);
515+
assert_eq!(
516+
map_to_canonical_model("ollama_cloud", "gemini-3-flash-preview", r),
517+
Some("ollama-cloud/gemini-3-flash-preview".to_string())
518+
);
519+
504520
// === GCP Vertex AI ===
505521
assert_eq!(
506522
map_to_canonical_model("gcp_vertex_ai", "gemini-2.5-flash", r),

0 commit comments

Comments
 (0)