fix(providers): map kimi_code provider name and pass correct provider to create_request (#11130)
This commit is contained in:
@@ -132,4 +132,13 @@ mod tests {
|
||||
assert!(canonical.cost.input.is_some());
|
||||
assert!(canonical.cost.output.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn kimi_code_k3_resolves_with_reasoning_and_context_limit() {
|
||||
let canonical = maybe_get_canonical_model("kimi_code", "k3")
|
||||
.expect("kimi_code/k3 should resolve via kimi-for-coding provider mapping");
|
||||
assert_eq!(canonical.limit.context, 1_048_576);
|
||||
assert_eq!(canonical.reasoning, Some(true));
|
||||
assert_eq!(canonical.temperature, Some(false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ pub fn map_provider_name(provider: &str) -> &str {
|
||||
"novita" => "novita-ai",
|
||||
"opencode_go" => "opencode-go",
|
||||
"ollama_cloud" => "ollama-cloud",
|
||||
"kimi_code" => "kimi-for-coding",
|
||||
_ => provider,
|
||||
}
|
||||
}
|
||||
@@ -532,6 +533,16 @@ mod tests {
|
||||
Some("zhipuai/glm-5".to_string())
|
||||
);
|
||||
|
||||
// === Kimi Code ===
|
||||
assert_eq!(
|
||||
map_to_canonical_model("kimi_code", "kimi-for-coding", r),
|
||||
Some("kimi-for-coding/kimi-for-coding".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
map_to_canonical_model("kimi_code", "kimi-for-coding-highspeed", r),
|
||||
Some("kimi-for-coding/kimi-for-coding-highspeed".to_string())
|
||||
);
|
||||
|
||||
// === GCP Vertex AI ===
|
||||
assert_eq!(
|
||||
map_to_canonical_model("gcp_vertex_ai", "gemini-2.5-flash", r),
|
||||
|
||||
@@ -4,7 +4,7 @@ use async_stream::try_stream;
|
||||
use async_trait::async_trait;
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use futures::TryStreamExt;
|
||||
use goose_providers::formats::anthropic::{AnthropicFormatOptions, ANTHROPIC_PROVIDER_NAME};
|
||||
use goose_providers::formats::anthropic::AnthropicFormatOptions;
|
||||
use reqwest::header::{HeaderMap, HeaderValue};
|
||||
use reqwest::Client;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -420,7 +420,7 @@ impl Provider for KimiCodeProvider {
|
||||
tools: &[Tool],
|
||||
) -> Result<MessageStream, ProviderError> {
|
||||
let mut payload = create_request(
|
||||
ANTHROPIC_PROVIDER_NAME,
|
||||
KIMI_CODE_PROVIDER_NAME,
|
||||
model_config,
|
||||
system,
|
||||
messages,
|
||||
|
||||
Reference in New Issue
Block a user