Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/goose/src/config/declarative_providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ pub struct DeclarativeProviderConfig {
pub env_vars: Option<Vec<EnvVarConfig>>,
#[serde(default)]
pub dynamic_models: Option<bool>,
#[serde(default)]
pub skip_canonical_filtering: bool,
}

fn default_requires_auth() -> bool {
Expand Down Expand Up @@ -215,6 +217,7 @@ pub fn create_custom_provider(
base_path: params.base_path,
env_vars: None,
dynamic_models: None,
skip_canonical_filtering: false,
};

let custom_providers_dir = custom_providers_dir();
Expand Down Expand Up @@ -280,6 +283,7 @@ pub fn update_custom_provider(params: UpdateCustomProviderParams) -> Result<()>
base_path: params.base_path,
env_vars: existing_config.env_vars,
dynamic_models: existing_config.dynamic_models,
skip_canonical_filtering: existing_config.skip_canonical_filtering,
};

let file_path = custom_providers_dir().join(format!("{}.json", updated_config.name));
Expand Down
8 changes: 8 additions & 0 deletions crates/goose/src/providers/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,18 @@ pub trait Provider: Send + Sync {
Ok(vec![])
}

fn skip_canonical_filtering(&self) -> bool {
false
}

/// Fetch models filtered by canonical registry and usability
async fn fetch_recommended_models(&self) -> Result<Vec<String>, ProviderError> {
let all_models = self.fetch_supported_models().await?;

if self.skip_canonical_filtering() {
return Ok(all_models);
}

let registry = CanonicalModelRegistry::bundled().map_err(|e| {
ProviderError::ExecutionError(format!("Failed to load canonical registry: {}", e))
})?;
Expand Down
3 changes: 2 additions & 1 deletion crates/goose/src/providers/declarative/lmstudio.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"base_url": "http://localhost:1234/v1/chat/completions",
"models": [],
"supports_streaming": true,
"requires_auth": false
"requires_auth": false,
"skip_canonical_filtering": true
}
9 changes: 9 additions & 0 deletions crates/goose/src/providers/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ pub struct OpenAiProvider {
custom_headers: Option<HashMap<String, String>>,
supports_streaming: bool,
name: String,
skip_canonical_filtering: bool,
}

impl OpenAiProvider {
Expand Down Expand Up @@ -126,6 +127,7 @@ impl OpenAiProvider {
custom_headers,
supports_streaming: true,
name: OPEN_AI_PROVIDER_NAME.to_string(),
skip_canonical_filtering: false,
})
}

Expand All @@ -140,6 +142,7 @@ impl OpenAiProvider {
custom_headers: None,
supports_streaming: true,
name: OPEN_AI_PROVIDER_NAME.to_string(),
skip_canonical_filtering: false,
}
}

Expand Down Expand Up @@ -208,6 +211,7 @@ impl OpenAiProvider {
custom_headers: config.headers,
supports_streaming: config.supports_streaming.unwrap_or(true),
name: config.name.clone(),
skip_canonical_filtering: config.skip_canonical_filtering,
})
}

Expand Down Expand Up @@ -361,6 +365,10 @@ impl Provider for OpenAiProvider {
&self.name
}

fn skip_canonical_filtering(&self) -> bool {
self.skip_canonical_filtering
}

fn get_model_config(&self) -> ModelConfig {
self.model.clone()
}
Expand Down Expand Up @@ -617,6 +625,7 @@ mod tests {
custom_headers: None,
supports_streaming: true,
name: name.to_string(),
skip_canonical_filtering: false,
}
}

Expand Down
3 changes: 3 additions & 0 deletions ui/desktop/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4633,6 +4633,9 @@
"requires_auth": {
"type": "boolean"
},
"skip_canonical_filtering": {
"type": "boolean"
},
"supports_streaming": {
"type": "boolean",
"nullable": true
Expand Down
1 change: 1 addition & 0 deletions ui/desktop/src/api/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export type DeclarativeProviderConfig = {
models: Array<ModelInfo>;
name: string;
requires_auth?: boolean;
skip_canonical_filtering?: boolean;
supports_streaming?: boolean | null;
timeout_seconds?: number | null;
};
Expand Down
Loading