finish adding effort budget

This commit is contained in:
Andrew Pareles 2025-05-05 01:15:51 -07:00
parent 7846b117bd
commit b73c11429c
2 changed files with 55 additions and 26 deletions

View file

@ -199,7 +199,7 @@ const ReasoningOptionSlider = ({ featureName }: { featureName: FeatureName }) =>
step={stepSize}
value={value}
onChange={(newVal) => {
const isOff = canTurnOffReasoning && newVal === min
const isOff = canTurnOffReasoning && newVal === valueIfOff
voidSettingsService.setOptionsOfModelSelection(featureName, modelSelection.providerName, modelSelection.modelName, { reasoningEnabled: !isOff, reasoningBudget: newVal })
}}
/>
@ -214,27 +214,24 @@ const ReasoningOptionSlider = ({ featureName }: { featureName: FeatureName }) =>
const min = canTurnOffReasoning ? -1 : 0
const max = values.length - 1
const currentEffort = voidSettingsState.optionsOfModelSelection[featureName][modelSelection.providerName]?.[modelSelection.modelName]?.reasoningEffort ?? defaultVal
const valueIfOff = -1
const value = isReasoningEnabled ?
values.indexOf(voidSettingsState.optionsOfModelSelection[featureName][modelSelection.providerName]?.[modelSelection.modelName]?.reasoningEffort ?? defaultVal)
: valueIfOff
const value = isReasoningEnabled && currentEffort ? values.indexOf(currentEffort) : valueIfOff
return <div className='flex items-center gap-x-2'>
<span className='text-void-fg-3 text-xs pointer-events-none inline-block w-10 pr-1'>Thinking</span>
<VoidSlider
width={50}
width={30}
size='xs'
min={min}
max={max}
step={1}
value={value}
onChange={(newVal) => {
const isOff = canTurnOffReasoning && newVal === min
voidSettingsService.setOptionsOfModelSelection(featureName, modelSelection.providerName, modelSelection.modelName, { reasoningEnabled: !isOff, reasoningBudget: newVal })
const isOff = canTurnOffReasoning && newVal === valueIfOff
voidSettingsService.setOptionsOfModelSelection(featureName, modelSelection.providerName, modelSelection.modelName, { reasoningEnabled: !isOff, reasoningEffort: values[newVal] ?? undefined })
}}
/>
<span className='text-void-fg-3 text-xs pointer-events-none'>{isReasoningEnabled ? `${value}` : 'Thinking disabled'}</span>
<span className='text-void-fg-3 text-xs pointer-events-none'>{isReasoningEnabled ? `${currentEffort}` : 'Thinking disabled'}</span>
</div>
}

View file

@ -517,7 +517,7 @@ const openAIModelOptions = { // https://platform.openai.com/docs/pricing
supportsFIM: false,
specialToolFormat: 'openai-style',
supportsSystemMessage: 'developer-role',
reasoningCapabilities: false,
reasoningCapabilities: { supportsReasoning: true, canTurnOffReasoning: false, canIOReasoning: false, reasoningSlider: { type: 'effort_slider', values: ['low', 'medium', 'high'], default: 'low' } },
},
'o4-mini': {
contextWindow: 1_047_576,
@ -527,7 +527,7 @@ const openAIModelOptions = { // https://platform.openai.com/docs/pricing
supportsFIM: false,
specialToolFormat: 'openai-style',
supportsSystemMessage: 'developer-role',
reasoningCapabilities: false,
reasoningCapabilities: { supportsReasoning: true, canTurnOffReasoning: false, canIOReasoning: false, reasoningSlider: { type: 'effort_slider', values: ['low', 'medium', 'high'], default: 'low' } },
},
'gpt-4.1': {
contextWindow: 1_047_576,
@ -566,7 +566,7 @@ const openAIModelOptions = { // https://platform.openai.com/docs/pricing
downloadable: false,
supportsFIM: false,
supportsSystemMessage: 'developer-role',
reasoningCapabilities: { supportsReasoning: true, canIOReasoning: false, canTurnOffReasoning: false }, // it doesn't actually output reasoning, but our logic is fine with it
reasoningCapabilities: { supportsReasoning: true, canTurnOffReasoning: false, canIOReasoning: false, reasoningSlider: { type: 'effort_slider', values: ['low', 'medium', 'high'], default: 'low' } },
},
'o3-mini': {
contextWindow: 200_000,
@ -575,7 +575,7 @@ const openAIModelOptions = { // https://platform.openai.com/docs/pricing
downloadable: false,
supportsFIM: false,
supportsSystemMessage: 'developer-role',
reasoningCapabilities: { supportsReasoning: true, canIOReasoning: false, canTurnOffReasoning: false },
reasoningCapabilities: { supportsReasoning: true, canTurnOffReasoning: false, canIOReasoning: false, reasoningSlider: { type: 'effort_slider', values: ['low', 'medium', 'high'], default: 'low' } },
},
'gpt-4o': {
contextWindow: 128_000,
@ -594,7 +594,7 @@ const openAIModelOptions = { // https://platform.openai.com/docs/pricing
downloadable: false,
supportsFIM: false,
supportsSystemMessage: false, // does not support any system
reasoningCapabilities: { supportsReasoning: true, canIOReasoning: false, canTurnOffReasoning: false },
reasoningCapabilities: { supportsReasoning: true, canTurnOffReasoning: false, canIOReasoning: false, reasoningSlider: { type: 'effort_slider', values: ['low', 'medium', 'high'], default: 'low' } },
},
'gpt-4o-mini': {
contextWindow: 128_000,
@ -635,24 +635,54 @@ const openAISettings: VoidStaticProviderInfo = {
// ---------------- XAI ----------------
const xAIModelOptions = {
// https://docs.x.ai/docs/guides/reasoning#reasoning
// https://docs.x.ai/docs/models#models-and-pricing
'grok-2': {
contextWindow: 131_072,
reservedOutputTokenSpace: null, // 131_072,
reservedOutputTokenSpace: null,
cost: { input: 2.00, output: 10.00 },
downloadable: false,
supportsFIM: false,
supportsSystemMessage: 'system-role',
reasoningCapabilities: false,
},
// 'grok-3': {
// contextWindow: 1_000_000,
// reservedOutputTokenSpace: null,
// cost: {},
// downloadable: false,
// supportsFIM: false,
// supportsSystemMessage: 'system-role',
// reasoningCapabilities: {canIOReasoning:false, canTurnOffReasoning:true,},
// }
'grok-3': {
contextWindow: 131_072,
reservedOutputTokenSpace: null,
cost: { input: 3.00, output: 15.00 },
downloadable: false,
supportsFIM: false,
supportsSystemMessage: 'system-role',
reasoningCapabilities: false,
},
'grok-3-fast': {
contextWindow: 131_072,
reservedOutputTokenSpace: null,
cost: { input: 5.00, output: 25.00 },
downloadable: false,
supportsFIM: false,
supportsSystemMessage: 'system-role',
reasoningCapabilities: false,
},
// only mini supports thinking
'grok-3-mini': {
contextWindow: 131_072,
reservedOutputTokenSpace: null,
cost: { input: 0.30, output: 0.50 },
downloadable: false,
supportsFIM: false,
supportsSystemMessage: 'system-role',
reasoningCapabilities: { supportsReasoning: true, canTurnOffReasoning: false, canIOReasoning: false, reasoningSlider: { type: 'effort_slider', values: ['low', 'high'], default: 'low' } },
},
'grok-3-mini-fast': {
contextWindow: 131_072,
reservedOutputTokenSpace: null,
cost: { input: 0.60, output: 4.00 },
downloadable: false,
supportsFIM: false,
supportsSystemMessage: 'system-role',
reasoningCapabilities: { supportsReasoning: true, canTurnOffReasoning: false, canIOReasoning: false, reasoningSlider: { type: 'effort_slider', values: ['low', 'high'], default: 'low' } },
},
} as const satisfies { [s: string]: VoidStaticModelInfo }
const xAISettings: VoidStaticProviderInfo = {
@ -663,7 +693,9 @@ const xAISettings: VoidStaticProviderInfo = {
if (lower.includes('grok-2')) fallbackName = 'grok-2'
if (fallbackName) return { modelName: fallbackName, ...xAIModelOptions[fallbackName] }
return null
}
},
// same implementation as openai
providerReasoningIOSettings: openAISettings.providerReasoningIOSettings,
}