mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
add topK function to transform, add temp defaults for glm and minimax
This commit is contained in:
parent
210b3e905b
commit
3d2ef28fa8
2 changed files with 17 additions and 5 deletions
|
|
@ -200,10 +200,12 @@ export namespace ProviderTransform {
|
|||
|
||||
export function temperature(model: Provider.Model) {
|
||||
const id = model.id.toLowerCase()
|
||||
if (id.toLowerCase().includes("qwen")) return 0.55
|
||||
if (id.toLowerCase().includes("claude")) return undefined
|
||||
if (id.toLowerCase().includes("gemini-3-pro")) return 1.0
|
||||
// if (id.toLowerCase().includes("kimi-k2")) {
|
||||
if (id.includes("qwen")) return 0.55
|
||||
if (id.includes("claude")) return undefined
|
||||
if (id.includes("gemini-3-pro")) return 1.0
|
||||
if (id.includes("glm-4.6")) return 1.0
|
||||
if (id.includes("minimax-m2")) return 1.0
|
||||
// if (id.includes("kimi-k2")) {
|
||||
// if (id.includes("thinking")) return 1.0
|
||||
// return 0.6
|
||||
// }
|
||||
|
|
@ -211,7 +213,15 @@ export namespace ProviderTransform {
|
|||
}
|
||||
|
||||
export function topP(model: Provider.Model) {
|
||||
if (model.api.id.toLowerCase().includes("qwen")) return 1
|
||||
const id = model.id.toLowerCase()
|
||||
if (id.includes("qwen")) return 1
|
||||
if (id.includes("minimax-m2")) return 0.95
|
||||
return undefined
|
||||
}
|
||||
|
||||
export function topK(model: Provider.Model) {
|
||||
const id = model.id.toLowerCase()
|
||||
if (id.includes("minimax-m2")) return 40
|
||||
return undefined
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -506,6 +506,7 @@ export namespace SessionPrompt {
|
|||
? (agent.temperature ?? ProviderTransform.temperature(model))
|
||||
: undefined,
|
||||
topP: agent.topP ?? ProviderTransform.topP(model),
|
||||
topK: ProviderTransform.topK(model),
|
||||
options: pipe(
|
||||
{},
|
||||
mergeDeep(ProviderTransform.options(model, sessionID, provider?.options)),
|
||||
|
|
@ -611,6 +612,7 @@ export namespace SessionPrompt {
|
|||
stopWhen: stepCountIs(1),
|
||||
temperature: params.temperature,
|
||||
topP: params.topP,
|
||||
topK: params.topK,
|
||||
toolChoice: isLastStep ? "none" : undefined,
|
||||
messages,
|
||||
tools: model.capabilities.toolcall === false ? undefined : tools,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue