feat(knowledge): expose Cohere reranker controls#4429
Conversation
Add a self-hosted Cohere API key field (mirroring the agent block's hosted-key pattern), a configurable reranker input pool size (1-100), and surface meta.warnings from Cohere rerank responses via logger.warn. All new contract fields are optional and nullable for full backwards compatibility. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Supports self-hosted Cohere usage by adding an optional per-request Reviewed by Cursor Bugbot for commit 5803229. Configure here. |
Greptile SummaryThis PR exposes three new Cohere reranker controls on the Knowledge block: a BYOK Confidence Score: 5/5Safe to merge — no bugs found; previous review feedback was addressed and all new fields are backwards-compatible. All changed files reviewed thoroughly. The key resolution chain, field visibility conditions, Zod schema, client-side clamping, and server-side guard logic are all correct. The required: true re-introduction in commit 232b1ca is intentional and correctly paired with the isCohereConfigured hide-field mechanism. No P0 or P1 issues found. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "fix(knowledge): treat empty rerankerInpu..." | Re-trigger Greptile |
- Drop required:true on apiKey field — server has BYOK→env→rotation fallback chain, so self-hosted users with COHERE_API_KEY env should not be blocked - Drop .min(1) on rerankerApiKey contract field so empty strings coerce to undefined via the transform (matches the existing query field pattern) - Log a warning when rerankerInputCount is clamped up to topK so users notice their setting was overridden Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1cfdfaa to
3fcd053
Compare
…anker Restore required:true on the Cohere API Key field and hide it server-side via a new NEXT_PUBLIC_COHERE_CONFIGURED public env flag — same pattern the Agent block uses for Azure (NEXT_PUBLIC_AZURE_CONFIGURED). Self-hosters who set COHERE_API_KEY in their environment also set NEXT_PUBLIC_COHERE_CONFIGURED=true, which removes the field from the UI; everyone else sees a required field. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
An empty string from the Documents Sent to Reranker input passed the
undefined/null guard, so Number('') = 0 → clamped to 1, sending only 1
document to the reranker instead of falling back to the 4× topK auto
default. Add the empty-string check to the guard.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 5803229. Configure here.
Summary
getCohereRerankerApiKeyCondition) so BYOK works for self-hosted while staying invisible on hostedrerankerInputCount(1–100) advanced field to control how many vector results are sent to the Cohere reranker (defaults to4× topK, capped at 100)meta.warningsfrom Cohere/v2/rerankresponses vialogger.warnTest plan
rerankerInputCountclamps to [1, 100] and respects the topK floorbun run check:api-validationpasses