Skip to content

Commit 45e5296

Browse files
authored
🐛 fix: fix cohere calling
1 parent 94cb887 commit 45e5296

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/libs/agent-runtime/cohere/index.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,15 @@ export const LobeCohereAI = LobeOpenAICompatibleFactory({
2020

2121
return {
2222
...rest,
23-
frequency_penalty: frequency_penalty !== undefined ? Math.max(0, Math.min(1, frequency_penalty / 2)) : undefined,
24-
presence_penalty: presence_penalty !== undefined ? Math.max(0, Math.min(1, presence_penalty / 2)) : undefined,
25-
top_p: top_p !== undefined ? Math.max(0.01, Math.min(0.99, top_p)) : undefined,
23+
frequency_penalty:
24+
frequency_penalty !== undefined && frequency_penalty > 0 && frequency_penalty <= 1
25+
? frequency_penalty
26+
: undefined,
27+
presence_penalty:
28+
presence_penalty !== undefined && presence_penalty > 0 && presence_penalty <= 1
29+
? presence_penalty
30+
: undefined,
31+
top_p: top_p !== undefined && top_p > 0 && top_p < 1 ? top_p : undefined,
2632
} as any;
2733
},
2834
noUserId: true,

0 commit comments

Comments
 (0)