provider: Ark's plan models that see images are sent them, not their descriptions (tongzhenbao on X)
tongzhenbao on X (10-29): an image sent to a Volcengine model took 100+ s to the first token. Ark's Coding and Agent Plans list no models (/models is empty for them), so their models come from arkPlanModels with no word on images, and the gateway judged them by models.dev (catalog.SeesImages). That says no for doubao-seed-2.1-pro (resellers tie), doubao-seed-2.1-lite and ark-code-latest, so blindTo held them blind and every image was first described by the vision model (visionTimeout 3 min, up to 4 at once) before the model was asked at all. Not a regression of today: SeesImages answers the same at479de8900(10-26), and describing for an unknown model dates from6cab11673(10-03). Region.Images now says which plan models take images, as Ark's own /api/coding/v3/models says (input_modalities, read 10-29): doubao-seed-evolving, doubao-seed-2.1-pro, -2.1-lite, -2.0-mini and kimi-k3.1-pro do; glm-5.3-flash and the deepseek-v4 models don't. planModels sets ImageInput/Images for those. ark-code-latest, glm-5.3, kimi-k3, kimi-k2.8-preview and minimax-m3 aren't in that list and are judged as before. Timings (mote, M5 Pro, BenchmarkImageRequest, 8 images, 20.2 MB per request, fake upstream): magpie's own work is 133-288 ms a request (responses-to-chat 228 ms, chat-to-chat 182, messages-to-chat 133, responses-to-responses 288), unchanged here; it was never the 100 s. The describer step, one vision call per image before the model is asked, is gone for a plan model that sees. Tests: - TestArkPlanImagesAreThePlans: every listed id is a plan model and planModels marks images exactly as the list says, nil for the rest. - TestArkPlanModelThatSeesIsSentTheImage: doubao-seed-2.1-pro on the plan gets the image itself and glm-5.3-flash the description, the describer asked once. Run at 06074b6c0 (origin/main has moved by00e0fd11bsince, GUI files only): gofmt -l internal cmd clean; go vet ./internal/provider ./internal/gateway on darwin, linux and windows ok; go test -count=1 -timeout 45m ./internal/provider (85.7s) ./internal/gateway (468.6s) ./internal/catalog ok, all on mote. Broken by hand: with the Images map unread in planModels, TestArkPlanModelThatSeesIsSentTheImage is red (doubao-seed-2.1-pro was sent the description) and TestArkPlanImagesAreThePlans red. Not tried: a real Coding or Agent Plan key (none here), so the 100 s itself wasn't reproduced; the pay-as-you-go Ark key lists its own models and isn't on this path.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/yetone/magpie/internal/provider"
|
||||
)
|
||||
|
||||
// tongzhenbao on X: an image to Volcengine Ark's Coding Plan took 100+s to
|
||||
// the first token. The plan's /models lists none of its models, and
|
||||
// models.dev's resellers disagree on doubao-seed-2.1-pro, so magpie took
|
||||
// it for text-only and had another model describe every image before Ark
|
||||
// was asked. Ark's own list says it sees: its image goes to it as sent, and
|
||||
// the describer isn't asked. A plan model Ark's list says is text-only
|
||||
// (glm-5.3-flash) still has its image described.
|
||||
func TestArkPlanModelThatSeesIsSentTheImage(t *testing.T) {
|
||||
s, u := eyed(t)
|
||||
up := strings.TrimSuffix(mustFind(t, "probe").Chat, "/v1")
|
||||
if err := provider.Save(provider.Provider{ID: "volcengine", Name: "Volcengine Ark", Preset: "volcengine", Chat: up + "/api/coding/v3", Key: "ark-k",
|
||||
Models: []string{"doubao-seed-2.1-pro", "glm-5.3-flash"}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, model := range []string{"doubao-seed-2.1-pro", "glm-5.3-flash"} {
|
||||
body := `{"model":"volcengine/` + model + `","input":[{"role":"user","content":[{"type":"input_text","text":"read"},{"type":"input_image","image_url":"data:image/png;base64,aGVsbG8="}]}]}`
|
||||
rec := httptest.NewRecorder()
|
||||
s.Handler().ServeHTTP(rec, httptest.NewRequest("POST", "/v1/responses", strings.NewReader(body)))
|
||||
if rec.Code != 200 {
|
||||
t.Fatalf("%s: %d %s", model, rec.Code, rec.Body.String())
|
||||
}
|
||||
}
|
||||
if got := u.sent("doubao-seed-2.1-pro"); len(got) != 1 || !strings.Contains(got[0], "aGVsbG8=") || strings.Contains(got[0], "HELLO") {
|
||||
t.Fatalf("doubao-seed-2.1-pro, which Ark says sees, was sent %v", got)
|
||||
}
|
||||
if got := u.sent("glm-5.3-flash"); len(got) != 1 || strings.Contains(got[0], "aGVsbG8=") || !strings.Contains(got[0], "HELLO") {
|
||||
t.Fatalf("glm-5.3-flash, which Ark says is text-only, was sent %v", got)
|
||||
}
|
||||
if n := len(u.sent("eye")); n != 1 {
|
||||
t.Fatalf("the describer was asked %d times, want once (for glm-5.3-flash alone)", n)
|
||||
}
|
||||
}
|
||||
@@ -1103,8 +1103,16 @@ func (p Provider) planModels(ms []catalog.Model) []catalog.Model {
|
||||
}
|
||||
}
|
||||
if len(out) == 0 {
|
||||
var images map[string]bool
|
||||
if r := p.regionOf(pr); r != nil {
|
||||
images = r.Images
|
||||
}
|
||||
for _, id := range models {
|
||||
out = append(out, catalog.Model{ID: id, Name: id})
|
||||
m := catalog.Model{ID: id, Name: id}
|
||||
if v, ok := images[id]; ok {
|
||||
m.ImageInput, m.Images = &v, v
|
||||
}
|
||||
out = append(out, m)
|
||||
}
|
||||
}
|
||||
if len(free) == 0 && p.IsCline() {
|
||||
|
||||
@@ -105,6 +105,10 @@ type Region struct {
|
||||
Embeddings []string `json:"embeddings,omitempty"`
|
||||
Drawers []string `json:"drawers,omitempty"`
|
||||
Videos []string `json:"videos,omitempty"`
|
||||
// Images says which of Models take images, as the vendor's own list
|
||||
// says, for a plan whose /models doesn't list its models: a model
|
||||
// it leaves out is judged as before (models.dev, the user's say).
|
||||
Images map[string]bool `json:"-"`
|
||||
// Decide is the region's decision API, for a preset that routes groups
|
||||
Decide string `json:"decide,omitempty"`
|
||||
}
|
||||
@@ -129,6 +133,19 @@ var arkPlanModels = []string{"ark-code-latest", "doubao-seed-evolving", "doubao-
|
||||
"doubao-seed-2.0-mini", "minimax-m3", "glm-5.3", "glm-5.3-flash", "deepseek-v4.1-flash", "deepseek-v4.1-flash-economy", "deepseek-v4-flash", "deepseek-v4-pro",
|
||||
"kimi-k2.8-preview", "kimi-k3", "kimi-k3.1-pro"}
|
||||
|
||||
// arkPlanImages are which of arkPlanModels take images, as Ark's own
|
||||
// /api/coding/v3/models says of the dated model each one is (its
|
||||
// input_modalities, 10-29): models.dev's resellers disagree on
|
||||
// doubao-seed-2.1-pro and say nothing of 2.1-lite, so magpie took them for
|
||||
// text-only and had every image of theirs described by another model
|
||||
// first, a minute or more before the first token (tongzhenbao on X). The
|
||||
// ones Ark's list doesn't name (ark-code-latest, glm-5.3, kimi-k3,
|
||||
// kimi-k2.8-preview, minimax-m3) are left to models.dev.
|
||||
var arkPlanImages = map[string]bool{
|
||||
"doubao-seed-evolving": true, "doubao-seed-2.1-pro": true, "doubao-seed-2.1-lite": true, "doubao-seed-2.0-mini": true, "kimi-k3.1-pro": true,
|
||||
"glm-5.3-flash": false, "deepseek-v4.1-flash": false, "deepseek-v4.1-flash-economy": false, "deepseek-v4-flash": false, "deepseek-v4-pro": false,
|
||||
}
|
||||
|
||||
// alibabaPlanModels are the text models of Alibaba's Token Plan, the same
|
||||
// on the Qwen AI platform's and on Bailian's, as their overviews list them.
|
||||
var alibabaPlanModels = []string{"auto", "qwen3.8-max", "qwen3.8-flash", "qwen3.7-max", "qwen3.7-plus", "qwen3.6-flash",
|
||||
@@ -344,10 +361,10 @@ var presets = []PresetDef{
|
||||
Website: "https://www.volcengine.com/docs/82379/1925114", KeysURL: "https://ark.volcengine.com/region:cn-beijing/apikey",
|
||||
RegionLabel: "Plan", KeyPlans: true, Regions: []Region{
|
||||
{ID: "coding", Name: "Coding Plan", Chat: "https://ark.cn-beijing.volces.com/api/coding/v3", Responses: "https://ark.cn-beijing.volces.com/api/coding/v3", Anthropic: "https://ark.cn-beijing.volces.com/api/coding",
|
||||
Models: arkPlanModels,
|
||||
Models: arkPlanModels, Images: arkPlanImages,
|
||||
Embeddings: []string{"doubao-embedding-vision"}},
|
||||
{ID: "agent", Name: "Agent Plan", Chat: "https://ark.cn-beijing.volces.com/api/plan/v3", Responses: "https://ark.cn-beijing.volces.com/api/plan/v3", Anthropic: "https://ark.cn-beijing.volces.com/api/plan",
|
||||
Models: arkPlanModels,
|
||||
Models: arkPlanModels, Images: arkPlanImages,
|
||||
Embeddings: []string{"doubao-embedding-vision"},
|
||||
Drawers: []string{"doubao-seedream-5-0-pro", "doubao-seedream-5.0-flash"},
|
||||
Videos: []string{"doubao-seedance-2.0", "doubao-seedance-2.0-fast", "doubao-seedance-2.0-mini", "doubao-seedance-2.5"}},
|
||||
|
||||
@@ -200,3 +200,26 @@ func TestVolcenginePlanModelsAsDocumented(t *testing.T) {
|
||||
t.Fatalf("a user's picks %v exposed as %v", p.Models, got)
|
||||
}
|
||||
}
|
||||
|
||||
// What Ark's list says of a plan model's images names a model of the
|
||||
// plan, and reaches the plan's models (tongzhenbao on X).
|
||||
func TestArkPlanImagesAreThePlans(t *testing.T) {
|
||||
for id := range arkPlanImages {
|
||||
if !slices.Contains(arkPlanModels, id) {
|
||||
t.Errorf("arkPlanImages names %q, which isn't a plan model", id)
|
||||
}
|
||||
}
|
||||
p, err := FromPreset("volcengine")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, m := range p.planModels(nil) {
|
||||
want, ok := arkPlanImages[m.ID]
|
||||
switch {
|
||||
case !ok && m.ImageInput != nil:
|
||||
t.Errorf("%s: Ark's list doesn't name it, but it is marked %v", m.ID, *m.ImageInput)
|
||||
case ok && (m.ImageInput == nil || *m.ImageInput != want || m.Images != want):
|
||||
t.Errorf("%s: images %v (%v), want %v", m.ID, m.Images, m.ImageInput, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user