feat: pass koboldcpp reasoning effort (#5491) Fixes #5489
Signed| @@ -2522,6 +2522,25 @@ function getReasoningEffort(settings = null, model = null) { | ||
| 2522 | 2522 | } |
| 2523 | 2523 | } |
| 2524 | 2524 | |
| 2525 | + if (settings.chat_completion_source === chat_completion_sources.CUSTOM && /^koboldcpp\/(.+)$/.test(model)) { | |
| 2526 | + switch (settings.reasoning_effort) { | |
| 2527 | + case reasoning_effort_types.auto: | |
| 2528 | + return undefined; | |
| 2529 | + case reasoning_effort_types.min: | |
| 2530 | + return 'minimal'; | |
| 2531 | + case reasoning_effort_types.low: | |
| 2532 | + return 'low'; | |
| 2533 | + case reasoning_effort_types.medium: | |
| 2534 | + return 'medium'; | |
| 2535 | + case reasoning_effort_types.high: | |
| 2536 | + return 'high'; | |
| 2537 | + case reasoning_effort_types.max: | |
| 2538 | + return 'xhigh'; | |
| 2539 | + default: | |
| 2540 | + return settings.reasoning_effort; | |
| 2541 | + } | |
| 2542 | + } | |
| 2543 | + | |
| 2525 | 2544 | switch (settings.reasoning_effort) { |
| 2526 | 2545 | case reasoning_effort_types.auto: |
| 2527 | 2546 | return undefined; |
| @@ -2485,6 +2485,9 @@ router.post('/generate', async function (request, response) { | ||
| 2485 | 2485 | if (OPENAI_REASONING_EFFORT_MODELS.includes(request.body.model)) { |
| 2486 | 2486 | bodyParams['reasoning_effort'] = OPENAI_FIXED_REASONING_EFFORT[request.body.model] ?? OPENAI_REASONING_EFFORT_MAP[request.body.reasoning_effort] ?? request.body.reasoning_effort; |
| 2487 | 2487 | } |
| 2488 | + if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.CUSTOM && /^koboldcpp\/(.+)$/.test(request.body.model)) { | |
| 2489 | + bodyParams['reasoning_effort'] = request.body.reasoning_effort; | |
| 2490 | + } | |
| 2488 | 2491 | } |
| 2489 | 2492 | |
| 2490 | 2493 | if (request.body.verbosity && [CHAT_COMPLETION_SOURCES.CUSTOM, CHAT_COMPLETION_SOURCES.OPENAI].includes(request.body.chat_completion_source)) { |