Skip to content

Commit 8fd0557

Browse files
waleedlatif1claude
andcommitted
fix(knowledge): prefer singular Cohere key before rotation
Match resolveOpenAIKey/resolveGeminiKey order: check the singular COHERE_API_KEY before falling back to rotating keys. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 99743d9 commit 8fd0557

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

apps/sim/lib/knowledge/reranker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ async function resolveCohereKey(
6565
return { apiKey: byokResult.apiKey, isBYOK: true }
6666
}
6767
}
68+
if (env.COHERE_API_KEY) {
69+
return { apiKey: env.COHERE_API_KEY, isBYOK: false }
70+
}
6871
try {
6972
return { apiKey: getRotatingApiKey('cohere'), isBYOK: false }
7073
} catch {
71-
if (env.COHERE_API_KEY) return { apiKey: env.COHERE_API_KEY, isBYOK: false }
7274
throw new Error(
7375
'No Cohere API key configured. Set COHERE_API_KEY_1/2/3 (rotation) or COHERE_API_KEY.'
7476
)

0 commit comments

Comments
 (0)