mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
Added lmstudio declarative provider (#7455)
This commit is contained in:
@@ -266,7 +266,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,
|
||||
@@ -306,8 +309,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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user