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

View file

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