mirror of
https://github.com/block/goose.git
synced 2026-10-14 03:42:43 +00:00
fix(databricks_v2): send Claude model services through the Anthropic route (#12486)
Some checks failed
Canary / bundle-macos-x64 (push) Blocked by required conditions
Canary / bundle-windows (push) Blocked by required conditions
Canary / bundle-windows-cuda (push) Blocked by required conditions
Canary / Release (push) Blocked by required conditions
Canary / bundle-macos-arm64 (push) Blocked by required conditions
Canary / Prepare Version (push) Waiting to run
Canary / build-cli-linux (push) Blocked by required conditions
Canary / Upload Install Script (push) Waiting to run
Unused Dependencies / machete (push) Waiting to run
CI / changes (push) Waiting to run
CI / goose ACP npm packages (push) Blocked by required conditions
CI / Check Rust Code Format (push) Blocked by required conditions
CI / Check GDK Release Configuration (push) Waiting to run
CI / Check GDK API Reference is Up-to-Date (push) Waiting to run
CI / Build and Test Rust Project (push) Blocked by required conditions
CI / Build Lean ACP Binary (push) Blocked by required conditions
CI / Check goose-sdk UniFFI (push) Blocked by required conditions
CI / Test Kotlin GDK package (push) Blocked by required conditions
CI / Build and Test TLS Backend (native-tls) (push) Blocked by required conditions
CI / Build and Test TLS Backend (rustls-tls) (push) Blocked by required conditions
CI / Build and Test Roaming Feature (push) Blocked by required conditions
CI / Build Rust Project on Windows (push) Waiting to run
CI / Check MSRV (push) Blocked by required conditions
CI / Lint Rust Code (push) Blocked by required conditions
CI / Check Generated Schemas are Up-to-Date (push) Blocked by required conditions
CI / Test and Lint Electron Desktop App (push) Blocked by required conditions
CI / Test Desktop Updater Install (ubuntu-latest) (push) Blocked by required conditions
CI / Test Desktop Updater Install (windows-latest) (push) Blocked by required conditions
MCP Conformance / Build Conformance Binaries (push) Waiting to run
MCP Conformance / Conformance 2025-11-25 / 0.1.16 (push) Blocked by required conditions
MCP Conformance / Conformance 2025-11-25 / 0.2.0-alpha.10 (push) Blocked by required conditions
MCP Conformance / Conformance 2026-07-28 / 0.2.0-alpha.10 (push) Blocked by required conditions
Create Minor Release PR / check-version-bump-pr (push) Waiting to run
Create Minor Release PR / release (push) Blocked by required conditions
Live Provider Tests / changes (push) Blocked by required conditions
Live Provider Tests / check-fork (push) Waiting to run
Publish Docker Image / docker (push) Waiting to run
Live Provider Tests / Build Binary (push) Blocked by required conditions
Live Provider Tests / Smoke Tests (push) Blocked by required conditions
Live Provider Tests / Smoke Tests (Code Execution) (push) Blocked by required conditions
Live Provider Tests / Compaction Tests (push) Blocked by required conditions
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Prepare GDK release / Create or update GDK release PR (push) Has been cancelled
Some checks failed
Canary / bundle-macos-x64 (push) Blocked by required conditions
Canary / bundle-windows (push) Blocked by required conditions
Canary / bundle-windows-cuda (push) Blocked by required conditions
Canary / Release (push) Blocked by required conditions
Canary / bundle-macos-arm64 (push) Blocked by required conditions
Canary / Prepare Version (push) Waiting to run
Canary / build-cli-linux (push) Blocked by required conditions
Canary / Upload Install Script (push) Waiting to run
Unused Dependencies / machete (push) Waiting to run
CI / changes (push) Waiting to run
CI / goose ACP npm packages (push) Blocked by required conditions
CI / Check Rust Code Format (push) Blocked by required conditions
CI / Check GDK Release Configuration (push) Waiting to run
CI / Check GDK API Reference is Up-to-Date (push) Waiting to run
CI / Build and Test Rust Project (push) Blocked by required conditions
CI / Build Lean ACP Binary (push) Blocked by required conditions
CI / Check goose-sdk UniFFI (push) Blocked by required conditions
CI / Test Kotlin GDK package (push) Blocked by required conditions
CI / Build and Test TLS Backend (native-tls) (push) Blocked by required conditions
CI / Build and Test TLS Backend (rustls-tls) (push) Blocked by required conditions
CI / Build and Test Roaming Feature (push) Blocked by required conditions
CI / Build Rust Project on Windows (push) Waiting to run
CI / Check MSRV (push) Blocked by required conditions
CI / Lint Rust Code (push) Blocked by required conditions
CI / Check Generated Schemas are Up-to-Date (push) Blocked by required conditions
CI / Test and Lint Electron Desktop App (push) Blocked by required conditions
CI / Test Desktop Updater Install (ubuntu-latest) (push) Blocked by required conditions
CI / Test Desktop Updater Install (windows-latest) (push) Blocked by required conditions
MCP Conformance / Build Conformance Binaries (push) Waiting to run
MCP Conformance / Conformance 2025-11-25 / 0.1.16 (push) Blocked by required conditions
MCP Conformance / Conformance 2025-11-25 / 0.2.0-alpha.10 (push) Blocked by required conditions
MCP Conformance / Conformance 2026-07-28 / 0.2.0-alpha.10 (push) Blocked by required conditions
Create Minor Release PR / check-version-bump-pr (push) Waiting to run
Create Minor Release PR / release (push) Blocked by required conditions
Live Provider Tests / changes (push) Blocked by required conditions
Live Provider Tests / check-fork (push) Waiting to run
Publish Docker Image / docker (push) Waiting to run
Live Provider Tests / Build Binary (push) Blocked by required conditions
Live Provider Tests / Smoke Tests (push) Blocked by required conditions
Live Provider Tests / Smoke Tests (Code Execution) (push) Blocked by required conditions
Live Provider Tests / Compaction Tests (push) Blocked by required conditions
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Prepare GDK release / Create or update GDK release PR (push) Has been cancelled
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b509488afd
commit
9adae14b64
1 changed files with 51 additions and 7 deletions
|
|
@ -226,10 +226,10 @@ impl DatabricksV2Provider {
|
|||
let (clean_name, _) = extract_reasoning_effort(routing_name);
|
||||
let lower = clean_name.to_lowercase();
|
||||
|
||||
// Claude model services also serve `anthropic/v1/messages`; the MLflow
|
||||
// chat route drops the prompt-cache breakpoints Anthropic needs.
|
||||
if is_openai_responses_model(&clean_name) || Self::looks_like_gpt5(&lower) {
|
||||
DatabricksV2Route::OpenAiResponses
|
||||
} else if is_model_service {
|
||||
DatabricksV2Route::MlflowChatCompletions
|
||||
} else if Self::is_claude_model(&lower) {
|
||||
DatabricksV2Route::AnthropicMessages
|
||||
} else {
|
||||
|
|
@ -682,7 +682,12 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
for model in ["databricks-claude-opus-4-7", "databricks-claude-sonnet-4-6"] {
|
||||
for model in [
|
||||
"databricks-claude-opus-4-7",
|
||||
"databricks-claude-sonnet-4-6",
|
||||
"catalog.schema.claude-alias",
|
||||
"data_workflow_tools.goose.goose-claude-fable-5-1",
|
||||
] {
|
||||
assert_eq!(
|
||||
DatabricksV2Provider::route_for_model(model),
|
||||
DatabricksV2Route::AnthropicMessages,
|
||||
|
|
@ -694,10 +699,6 @@ mod tests {
|
|||
DatabricksV2Provider::route_for_model("custom-model"),
|
||||
DatabricksV2Route::MlflowChatCompletions
|
||||
);
|
||||
assert_eq!(
|
||||
DatabricksV2Provider::route_for_model("catalog.schema.claude-alias"),
|
||||
DatabricksV2Route::MlflowChatCompletions
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -924,6 +925,49 @@ mod tests {
|
|||
.expect("GPT-6 model service should use the Responses API");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn model_service_claude_uses_messages_route_with_cache_breakpoints() {
|
||||
let model = "data_workflow_tools.goose.goose-claude-fable-5-1";
|
||||
let body = concat!(
|
||||
r#"data: {"type":"message_start","message":{"id":"msg_1","role":"assistant","content":[],"usage":{"input_tokens":1,"output_tokens":0}}}"#,
|
||||
"\n",
|
||||
r#"data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":1}}"#,
|
||||
"\n",
|
||||
r#"data: {"type":"message_stop"}"#,
|
||||
"\n",
|
||||
);
|
||||
|
||||
let server = MockServer::start().await;
|
||||
Mock::given(method("POST"))
|
||||
.and(path("/ai-gateway/anthropic/v1/messages"))
|
||||
.and(body_partial_json(json!({
|
||||
"model": model,
|
||||
"system": [{"cache_control": {"type": "ephemeral"}}]
|
||||
})))
|
||||
.respond_with(
|
||||
ResponseTemplate::new(200)
|
||||
.set_body_string(body)
|
||||
.append_header("content-type", "text/event-stream"),
|
||||
)
|
||||
.expect(1)
|
||||
.mount(&server)
|
||||
.await;
|
||||
|
||||
provider(server.uri())
|
||||
.complete(
|
||||
&ModelConfig::new(model),
|
||||
"system",
|
||||
&[
|
||||
Message::user().with_text("hi"),
|
||||
Message::assistant().with_text("hello"),
|
||||
Message::user().with_text("continue"),
|
||||
],
|
||||
&[],
|
||||
)
|
||||
.await
|
||||
.expect("Claude model service should use the Anthropic Messages API");
|
||||
}
|
||||
|
||||
#[test_case::test_case("catalog.schema.goose-glm-5-3" ; "glm 5.3")]
|
||||
#[test_case::test_case("catalog.schema.goose-kimi-k3" ; "kimi k3")]
|
||||
#[tokio::test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue