Repository navigation
fix(channel): declare native embeddings and rerank routes for SiliconFlow - #834
Conversation
…Flow The SiliconFlow preset binds provider kind `openai-compatible` with a fixed base URL of https://api.siliconflow.cn/v1, but its route table only declared chat completions, model listing and probe plus converted Responses/Anthropic/ Gemini. It never declared the two protocols SiliconFlow serves natively: - POST /v1/embeddings (e.g. BAAI/bge-m3) - POST /v1/rerank (e.g. BAAI/bge-reranker-v2-m3) The execution layer already supports both for this provider kind: `nativeRouteImplemented` accepts rerank for `ProviderOpenAICompatible`, and `prepareRerank` resolves the upstream URL as base URL + `/rerank`, which is exactly https://api.siliconflow.cn/v1/rerank. The generic `openai_compatible` channel pointed at the same base URL already works, so only the preset route declaration was missing and every SiliconFlow group answered `no_available_candidate` (HTTP 503) for embeddings and rerank. Declare the four routes and update the contracts that freeze the route table: the rerank/embeddings capability tests and the built-in route golden digest. Verified with a local build against the real upstream: before the change a SiliconFlow group returned 503 `no_available_candidate` for both endpoints; after the change /v1/rerank and /v1/embeddings return 200.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughSiliconFlow 新增 OpenAI Embeddings 创建与探测路由,以及 Rerank 执行与探测路由。对应能力测试现将 SiliconFlow 纳入预期支持的渠道。内置路由摘要的预期值也已更新,摘要计算和不匹配时的失败逻辑保持不变。 Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The new routes resolve to the intended SiliconFlow embeddings and rerank endpoints, and the updated capability checks and route contract include them. No actionable merge risk is evident. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Sync upstream through 6c6380a (tbphp#828, tbphp#832, tbphp#834): Bifrost compatible assistant tool turn merging, SiliconFlow native embeddings and rerank routes, and README sponsorship update. No conflicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XfNx753nmeMu5mT6AX6bpt
关联 Issue / Related Issue
Closes #833
变更内容 / Change Content
内置渠道
SiliconFlow的路由表没有声明它原生支持的openai-embeddings与rerank,导致用该渠道建组后/v1/embeddings和/v1/rerank全部返回503 no_available_candidate。internal/channel/modules/siliconflow.go绑定的是ProviderOpenAICompatible+FixedBaseURL: https://api.siliconflow.cn/v1,执行层对此 provider kind 已经放行这两个协议:internal/execution/bifrost/capabilities.go:nativeRouteImplemented对ProviderOpenAICompatible放行protocol.Rerank,并在OpenAIEmbeddings分支放行OperationEmbeddingsCreate/OperationProbe。internal/execution/bifrost/rerank.go:prepareRerank对非网关 provider 使用 path/rerank,配合固定 base URL 正好拼成https://api.siliconflow.cn/v1/rerank。openai_compatible渠道的base_url指向同一地址时,两个端点都能 200,说明缺口只在预设渠道的路由声明。改动内容:
internal/channel/modules/siliconflow.go:新增 4 条 native 路由(OpenAIEmbeddings的 create/probe、Rerank的 rerank/probe)。internal/channel/rerank_module_test.go:把SiliconFlow加入 rerank 能力白名单。internal/channel/embeddings_module_test.go:把SiliconFlow加入 embeddings 能力白名单。internal/channel/route_golden_test.go:更新内置路由契约摘要wantDigest。自查清单 / Checklist
make check,或在说明中写明无法运行的原因和未验证范围。补充说明:
gofmt -l(干净)、go vet ./internal/channel/... ./internal/execution/...(无输出)、go test -count=1 . ./internal/...(7773 passed / 41 skipped)。唯一的失败internal/gateway的TestCodexLiveCreatesAcrossGroupsPinsOwnerAndLogsOnce(websocket: bad handshake)与本改动无关且不稳定,单独重跑一次通过。make check中的前端 lint/format/build 与make release-simulate(本机未安装 pnpm 及验收所需的 DBX 辅助脚本);改动不涉及web/。openai_compatible+base_url=https://api.siliconflow.cn/v1的绕过配置不受影响。注意rerank请求路径对ProviderOpenAICompatible是base_url + /rerank,故 base URL 需保持包含/v1的形式(预设默认值即https://api.siliconflow.cn/v1)。siliconflow渠道的/v1/rerank、/v1/embeddings均 503no_available_candidate;改动后两者均 200 并返回真实结果。rerank走别名bge-reranker-v2-m3正常,未配置别名的上游 ID 不在模型列表中,行为与其他渠道一致。