fix(models): serve qwen3-rerank on the native DashScope rerank protocol
The catalog rebuild marked qwen3-rerank unsupported because Alibaba also documents a flat /compatible-api/v1/reranks shape for it. The native text-rerank endpoint serves the same model with identical scores (#3558), and v0.8.0 routed it there, so existing Aliyun rerank rows naming it failed with "failed to get rerank model" after upgrading. Drop the unsupported override and the deprecated flag so the model resolves to dashscope-rerank again and shows up in the picker.main
parent
2e712a97a1
commit
a1b0d0cb6c
|
|
@ -865,13 +865,9 @@
|
|||
},
|
||||
{
|
||||
"id": "qwen3-rerank",
|
||||
"name": "Qwen3 Rerank (separate endpoint, not implemented)",
|
||||
"name": "Qwen3 Rerank",
|
||||
"type": "Rerank",
|
||||
"deprecated": true,
|
||||
"source": "https://help.aliyun.com/zh/model-studio/text-rerank-api",
|
||||
"compat": {
|
||||
"unsupported_reason": "qwen3-rerank speaks a different protocol (/compatible-api/v1/reranks, flat request, results at the top level) that no protocol package implements yet"
|
||||
}
|
||||
"source": "https://help.aliyun.com/zh/model-studio/text-rerank-api"
|
||||
},
|
||||
{
|
||||
"id": "gte-rerank-v2",
|
||||
|
|
|
|||
|
|
@ -404,13 +404,6 @@
|
|||
"max_batch_size": 20
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "qwen3-rerank",
|
||||
"type": "Rerank",
|
||||
"compat": {
|
||||
"unsupported_reason": "qwen3-rerank speaks a different protocol (/compatible-api/v1/reranks, flat request, results at the top level) that no protocol package implements yet"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "qwen3-asr-flash",
|
||||
"type": "ASR",
|
||||
|
|
|
|||
|
|
@ -619,9 +619,8 @@
|
|||
},
|
||||
{
|
||||
"id": "qwen3-rerank",
|
||||
"name": "Qwen3 Rerank (separate endpoint, not implemented)",
|
||||
"name": "Qwen3 Rerank",
|
||||
"type": "Rerank",
|
||||
"deprecated": true,
|
||||
"source": "https://help.aliyun.com/zh/model-studio/text-rerank-api"
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -115,6 +115,17 @@ func TestRerankOutboundShapePerProtocol(t *testing.T) {
|
|||
assert.NotContains(t, body, "documents", "documents live under input")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "dashscope shape for qwen3-rerank", provider: "aliyun", model: "qwen3-rerank",
|
||||
reply: `{"output":{"results":[{"index":0,"relevance_score":0.5,"document":{"text":"d0"}}]}}`,
|
||||
assert: func(t *testing.T, path string, body map[string]any) {
|
||||
assert.Equal(t, "/api/v1/services/rerank/text-rerank/text-rerank", path)
|
||||
assert.Equal(t, "qwen3-rerank", body["model"])
|
||||
input, ok := body["input"].(map[string]any)
|
||||
require.True(t, ok, "qwen3-rerank goes out in the native input wrapper")
|
||||
assert.Equal(t, "q", input["query"])
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "nim shape", provider: "nvidia", model: "nvidia/nv-rerankqa-mistral-4b-v3",
|
||||
reply: `{"rankings":[{"index":0,"logit":0.0}]}`,
|
||||
|
|
@ -365,12 +376,12 @@ func TestRerankScoreScalesMatchTheVendorDocs(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestUnimplementedRerankDialectsAreRefused covers a model that names a
|
||||
// protocol no package implements. Hiding it from the picker stops new rows;
|
||||
// a row that already names it has to fail somewhere, and failing at
|
||||
// construction with the reason beats sending a request shaped for the wrong
|
||||
// protocol and reporting whatever the decoder makes of the reply.
|
||||
func TestUnimplementedRerankDialectsAreRefused(t *testing.T) {
|
||||
// TestQwen3RerankUsesNativeDashScopeProtocol keeps qwen3-rerank on the
|
||||
// native text-rerank endpoint. Alibaba also documents a flat
|
||||
// /compatible-api/v1/reranks shape for it, but the native endpoint serves the
|
||||
// same model with identical scores (#3558), and v0.8.0 deployments already
|
||||
// have rows that name it — refusing it would break them on upgrade.
|
||||
func TestQwen3RerankUsesNativeDashScopeProtocol(t *testing.T) {
|
||||
v, ok := modelruntime.Get("aliyun")
|
||||
require.True(t, ok)
|
||||
|
||||
|
|
@ -378,21 +389,16 @@ func TestUnimplementedRerankDialectsAreRefused(t *testing.T) {
|
|||
for _, m := range v.ModelsByType(types.ModelTypeRerank) {
|
||||
offered = append(offered, m.ID)
|
||||
}
|
||||
assert.NotContains(t, offered, "qwen3-rerank", "the picker must not offer an unimplemented dialect")
|
||||
assert.Contains(t, offered, "qwen3-rerank")
|
||||
assert.Contains(t, offered, "gte-rerank-v2")
|
||||
|
||||
_, err := modelruntime.Resolve(modelruntime.Ref{
|
||||
Provider: "aliyun", Model: "qwen3-rerank", ModelType: types.ModelTypeRerank,
|
||||
})
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "/compatible-api/v1/reranks",
|
||||
"the error should name the protocol the model actually speaks")
|
||||
|
||||
// The vendor's other rerank model is unaffected.
|
||||
_, err = modelruntime.Resolve(modelruntime.Ref{
|
||||
Provider: "aliyun", Model: "gte-rerank-v2", ModelType: types.ModelTypeRerank,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
for _, model := range []string{"qwen3-rerank", "gte-rerank-v2"} {
|
||||
resolved, err := modelruntime.Resolve(modelruntime.Ref{
|
||||
Provider: "aliyun", Model: model, ModelType: types.ModelTypeRerank,
|
||||
})
|
||||
require.NoError(t, err, model)
|
||||
assert.Equal(t, api.RerankDashScope, resolved.RerankAPI, model)
|
||||
}
|
||||
}
|
||||
|
||||
// TestGatewayRerankEndpoints pins the URL each gateway's rerank rows reach.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
"aliyun/KnowledgeQA/qwq-32b": "b05df754c2d09e0fe937e85c6bda28b71ef3e694c0e06c17dccdbd9217fecb28",
|
||||
"aliyun/KnowledgeQA/qwq-plus": "7139911fda2d14b002889abbd06c185e550bec0984cea85116510b17ba4063ea",
|
||||
"aliyun/Rerank/gte-rerank-v2": "27219a2ffc212a35e9eeacf87da136410342e1915dd1141dc3357d7b40f9595b",
|
||||
"aliyun/Rerank/qwen3-rerank": "error: catalog: aliyun does not serve \"qwen3-rerank\" through a protocol this build implements: qwen3-rerank speaks a different protocol (/compatible-api/v1/reranks, flat request, results at the top level) that no protocol package implements yet",
|
||||
"aliyun/Rerank/qwen3-rerank": "2b0b10a4c768fb157901e45586d0092e4ebe5ee5e92064a592aa726d8d133df2",
|
||||
"anthropic/KnowledgeQA/claude-fable-5": "8cb0c332960f271acac66df25e0b8a1259c863994b6d4ef3c9be3df47f85b5bc",
|
||||
"anthropic/KnowledgeQA/claude-fable-5-1": "fe4ee19f613745815e5caa1f258e67f9f9a901f5fc45c1d4cce030bfa6287b72",
|
||||
"anthropic/KnowledgeQA/claude-haiku-4-5": "5eb4abef41f957d98c0a15c83de48c0e6b46be48d59f761ba6006c29010487f9",
|
||||
|
|
|
|||
|
|
@ -58,17 +58,13 @@
|
|||
// - rerank is a separate DashScope-native endpoint
|
||||
// (/api/v1/services/rerank/text-rerank/text-rerank).
|
||||
//
|
||||
// qwen3-rerank is a second, incompatible rerank protocol on the same vendor.
|
||||
// The text-rerank page puts it on /compatible-api/v1/reranks and states
|
||||
// outright that "两种接口的请求体结构和响应格式不同": its request is flat
|
||||
// (query / documents at the top level, no input/parameters wrapper) and its
|
||||
// response carries `results` at the top level with no `output` object. This
|
||||
// package implements only the native shape that gte-rerank-v2 and
|
||||
// qwen3.7-text-rerank use, so the entry is marked deprecated: it stays
|
||||
// resolvable for a row that already names it, but the picker no longer offers
|
||||
// a model that would be sent to the wrong path and decoded with the wrong
|
||||
// shape. Serving it needs a fourth rerank protocol package
|
||||
// (https://help.aliyun.com/zh/model-studio/text-rerank-api).
|
||||
// qwen3-rerank is also documented on a second, flat endpoint
|
||||
// (/compatible-api/v1/reranks: query / documents at the top level, results
|
||||
// with no `output` object), but the native text-rerank endpoint serves it too
|
||||
// and returns the same scores (verified against the live API in #3558), so it
|
||||
// stays on the native protocol like gte-rerank-v2 and qwen3.7-text-rerank.
|
||||
// A dedicated package for the flat shape is only needed if a model ever ships
|
||||
// on that endpoint alone (https://help.aliyun.com/zh/model-studio/text-rerank-api).
|
||||
//
|
||||
// unverified: no page states whether `prompt_cache_key` is accepted, so the
|
||||
// protocol default (not sent) is kept.
|
||||
|
|
|
|||
Loading…
Reference in New Issue