Skip to content
Merged
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
17 changes: 14 additions & 3 deletions crates/goose/src/config/declarative_providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ pub fn load_provider(id: &str) -> Result<LoadedProvider> {
.contents_utf8()
.ok_or_else(|| anyhow::anyhow!("Failed to read file as UTF-8: {:?}", file.path()))?;

let config: DeclarativeProviderConfig = serde_json::from_str(content)?;
let config: DeclarativeProviderConfig = match serde_json::from_str(content) {
Ok(config) => config,
Err(_) => continue,
};
if config.name == id {
return Ok(LoadedProvider {
config,
Expand Down Expand Up @@ -300,8 +303,16 @@ fn load_fixed_providers() -> Result<Vec<DeclarativeProviderConfig>> {
.contents_utf8()
.ok_or_else(|| anyhow::anyhow!("Failed to read file as UTF-8: {:?}", file.path()))?;

let config: DeclarativeProviderConfig = serde_json::from_str(content)?;
res.push(config)
match serde_json::from_str(content) {
Ok(config) => res.push(config),
Err(e) => {
tracing::warn!(
"Skipping invalid declarative provider {:?}: {}",
file.path(),
e
);
}
}
}

Ok(res)
Expand Down
28 changes: 11 additions & 17 deletions crates/goose/src/providers/declarative/kimi.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
{
"name": "Kimi",
"metadata": {
"homepage": "https://kimi.ai",
"docs": "https://platform.moonshot.cn/docs/intro",
"description": "Kimi Code AI models optimized for coding tasks"
},
"engine": {
"type": "openai",
"base_url": "https://api.moonshot.cn/v1",
"api_key_env_var": "MOONSHOT_API_KEY"
},
"models": [
{"name": "kimi-for-coding", "context_limit": 262144},
{"name": "kimi-code", "context_limit": 262144}
],
"streaming_default": true,
"pricing_info_url": "https://platform.moonshot.cn/pricing"
"name": "kimi",
"engine": "openai",
"display_name": "Kimi",
"description": "Kimi Code AI models optimized for coding tasks",
"api_key_env": "MOONSHOT_API_KEY",
"base_url": "https://api.moonshot.cn/v1/chat/completions",
"models": [
{"name": "kimi-for-coding", "context_limit": 262144},
{"name": "kimi-code", "context_limit": 262144}
],
"supports_streaming": true
}
11 changes: 11 additions & 0 deletions crates/goose/src/providers/declarative/lmstudio.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "lmstudio",
"engine": "openai",
"display_name": "LM Studio",
"description": "Run local models with LM Studio",
"api_key_env": "",
"base_url": "http://localhost:1234/v1/chat/completions",
"models": [],
"supports_streaming": true,
"requires_auth": false
}
36 changes: 15 additions & 21 deletions crates/goose/src/providers/declarative/moonshot.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
{
"name": "Moonshot",
"metadata": {
"homepage": "https://kimi.moonshot.cn/",
"docs": "https://platform.moonshot.cn/docs/intro",
"description": "Moonshot AI (Kimi) models"
},
"engine": {
"type": "openai",
"base_url": "https://api.moonshot.cn/v1",
"api_key_env_var": "MOONSHOT_API_KEY"
},
"models": [
{"name": "kimi-latest", "context_limit": 131072},
{"name": "kimi-thinking-preview", "context_limit": 131072},
{"name": "kimi-k2-0711", "context_limit": 131072},
{"name": "kimi-k2", "context_limit": 262144},
{"name": "moonshot-v1-8k", "context_limit": 8192},
{"name": "moonshot-v1-32k", "context_limit": 32768}
],
"streaming_default": true,
"pricing_info_url": "https://platform.moonshot.cn/pricing"
"name": "moonshot",
"engine": "openai",
"display_name": "Moonshot",
"description": "Moonshot AI (Kimi) models",
"api_key_env": "MOONSHOT_API_KEY",
"base_url": "https://api.moonshot.cn/v1/chat/completions",
"models": [
{"name": "kimi-latest", "context_limit": 131072},
{"name": "kimi-thinking-preview", "context_limit": 131072},
{"name": "kimi-k2-0711", "context_limit": 131072},
{"name": "kimi-k2", "context_limit": 262144},
{"name": "moonshot-v1-8k", "context_limit": 8192},
{"name": "moonshot-v1-32k", "context_limit": 32768}
],
"supports_streaming": true
}
Loading