diff --git a/app/static/builder/command-builder-core.js b/app/static/builder/command-builder-core.js index 55cf0f1b3..8bd41a8c1 100644 --- a/app/static/builder/command-builder-core.js +++ b/app/static/builder/command-builder-core.js @@ -436,6 +436,14 @@ } const serving = (p, apis) => !PROVIDER_INFO[p].protocols || apis.some(a => PROVIDER_INFO[p].protocols.includes(a)); const providersOf = r => PROVIDERS.filter(p => !r || consumersOf(r).every(apis => serving(p, apis))); + // What part of a recipe a provider cannot serve, as the Model step names it beside a greyed provider; '' when it serves all. + function refusedPart(r, p) { + if (!isStandard(r)) return serving(p, ['chat']) ? '' : 'this recipe'; + const b = standardBench(r) || {}, all = standard().agents.concat(standard().modules); + const of = k => all.find(o => o.key === k) || (b.setups || []).find(x => x.key === k) || {}; + const k = chosenOf(r).filter(k => !(b.controls || []).some(c => c.key === k)).find(k => !serving(p, of(k).apis || ['chat'])); + return k === undefined ? '' : of(k).label || (b.label || 'the benchmark') + ' as published'; + } const recipeProvider = r => isStandard(r) ? r.provider : providerOf(r, r.model || r.userModel); const choiceOf = r => recipeProvider(r) === 'custom' && r.endpoint ? 'custom:' + r.endpoint : recipeProvider(r); // The Model step's choice into the recipe: its provider, and for a named endpoint its id. @@ -1030,5 +1038,5 @@ // A recipe nobody changed: Start over has nothing to ask about. A new one, or that one as a reloaded draft holds it // (fromJSON fills in what a new one leaves out). The page's own values are compared as they are: reading would drop the bad ones. const atDefaults = r => { const s = JSON.stringify(r); return s === JSON.stringify(prefill({})) || s === JSON.stringify(fromJSON(prefill({}))); }; - return {setTaskSet,keepTaskSets,setStartWith,keepStartWith,nestedDatasets,wholeOf,swapDataset,STANDARD_PHASES,STEPS,STEP,runners,RUNNER_GONE,isStandard,standard,standardBase,standardBench,standardOthers,ownAgentsOf,ownChosen,runsOf,standardKeyless,paperModels,paperListed,paperOffered,leaderboard,setModelChoice,servedRoles,servedList,setServed,reasoningRoles,setReasoning,LEVEL_NAMES,addServed,removeServed,setModelOf,servedModelOf,servedKey,servedCompiled,servedRow,stepShown,chosenOf,toggleParticipant,datasetsOf,whereList,machineLabel,createStandard,setStandardBenchmark,openingStep,runnersOf,runnerFor,benchKey,whereLabel,create,benchmarks,routeBlocker,dataset,sources,setBenchmark,parameters,scopes,validate,compile,runnable,fromJSON,fromJob,prefill,atDefaults,deleteAsk,review,copy,packDraft,unpackDraft,adapterPath,taskCount,PROVIDERS,PROVIDER_LABEL,PROVIDER_NEEDS,available,labelOf,needsOf,choiceOf,setChoice,providersOf,recipeProvider,providerBlocker,blockedProvider,roleChoiceOf,setRoleChoice,roleProvidersOf,ownRole,providerOf,bareModel,settleModel,agentModel,quote:q,path,defaults,needsCredentials,credentialBindings,declaredTimeouts,effectiveTimeouts,setPhaseMinutes,PHASES,harborExecutable,harborPin,harborProblem,harborKey,harborRepoUrl,harborLabel,repoLabel,agents,mergeAgents,setScanned,COMMON,agentById}; + return {setTaskSet,keepTaskSets,setStartWith,keepStartWith,nestedDatasets,wholeOf,swapDataset,STANDARD_PHASES,STEPS,STEP,runners,RUNNER_GONE,isStandard,standard,standardBase,standardBench,standardOthers,ownAgentsOf,ownChosen,runsOf,standardKeyless,paperModels,paperListed,paperOffered,leaderboard,setModelChoice,servedRoles,servedList,setServed,reasoningRoles,setReasoning,LEVEL_NAMES,addServed,removeServed,setModelOf,servedModelOf,servedKey,servedCompiled,servedRow,stepShown,refusedPart,chosenOf,toggleParticipant,datasetsOf,whereList,machineLabel,createStandard,setStandardBenchmark,openingStep,runnersOf,runnerFor,benchKey,whereLabel,create,benchmarks,routeBlocker,dataset,sources,setBenchmark,parameters,scopes,validate,compile,runnable,fromJSON,fromJob,prefill,atDefaults,deleteAsk,review,copy,packDraft,unpackDraft,adapterPath,taskCount,PROVIDERS,PROVIDER_LABEL,PROVIDER_NEEDS,available,labelOf,needsOf,choiceOf,setChoice,providersOf,recipeProvider,providerBlocker,blockedProvider,roleChoiceOf,setRoleChoice,roleProvidersOf,ownRole,providerOf,bareModel,settleModel,agentModel,quote:q,path,defaults,needsCredentials,credentialBindings,declaredTimeouts,effectiveTimeouts,setPhaseMinutes,PHASES,harborExecutable,harborPin,harborProblem,harborKey,harborRepoUrl,harborLabel,repoLabel,agents,mergeAgents,setScanned,COMMON,agentById}; }); diff --git a/app/static/builder/command-builder.js b/app/static/builder/command-builder.js index c00cd890e..58874bcc0 100644 --- a/app/static/builder/command-builder.js +++ b/app/static/builder/command-builder.js @@ -481,21 +481,29 @@ }; // The provider is one whose key (an OpenAI-compatible endpoint: its URL) is set in Settings, each endpoint by its // name: a select of those alone, at any size; none set, every provider. A recipe naming one whose key is not set - // keeps it, shown as nothing chosen, until another is chosen. + // keeps it, shown as nothing chosen, until another is chosen. One set (or, with none set, any) that cannot serve + // this recipe is shown greyed, with the part it cannot serve. const providerField = (rec, offered) => { - const have = C.available().filter(p => offered.includes(p.split(':')[0])), current = C.choiceOf(rec); - return select('Provider', 'provider', current, (have.length ? have : offered).map(p => [p, C.labelOf(p)]), 'Choose a provider'); + const kind = p => p.split(':')[0], set = C.available(); + const have = set.filter(p => offered.includes(kind(p))), current = C.choiceOf(rec); + const refused = (set.length ? set : C.PROVIDERS).filter(p => !offered.includes(kind(p))); + return select('Provider', 'provider', current, [...(have.length ? have : offered).map(p => [p, C.labelOf(p)]), + ...refused.map(p => [p, C.labelOf(p) + ' · does not serve ' + C.refusedPart(rec, kind(p)), true])], 'Choose a provider'); }; // The standard's, a role's on its line, the same choices; the judge's and the user simulator's are Same as the // agent, or another that serves chat. const roleProvider = (rec, role, who) => { const own = role !== 'model', offered = own ? C.roleProvidersOf() : C.providersOf(rec), agent = C.choiceOf(rec); - const have = C.available().filter(p => offered.includes(p.split(':')[0])), current = own ? (C.ownRole(rec, role) ? C.roleChoiceOf(rec, role) : '') : agent; + const kind = p => p.split(':')[0], set = C.available(); + const have = set.filter(p => offered.includes(kind(p))), current = own ? (C.ownRole(rec, role) ? C.roleChoiceOf(rec, role) : '') : agent; + // the agent's line: one set (or, with none set, any) that cannot serve it, greyed, with what it cannot serve + const refused = own ? [] : (set.length ? set : C.PROVIDERS).filter(p => !offered.includes(kind(p))); // only those set; none set, every one that fits. A recipe's own choice not among them shows as none chosen. const shown = (have.length ? have : offered).filter(p => !own || p !== agent); - const options = (own ? ['', ...shown] : shown).map(p => [p, p ? C.labelOf(p) : 'Same as ' + who.toLowerCase().replace('module', 'Module')]); - const none = !options.some(([v]) => v === current) ? '' : ''; - return ``; + const options = [...(own ? ['', ...shown] : shown).map(p => [p, p ? C.labelOf(p) : 'Same as ' + who.toLowerCase().replace('module', 'Module')]), + ...refused.map(p => [p, C.labelOf(p) + ' · does not serve ' + C.refusedPart(rec, kind(p)), true])]; + const none = !options.some(([v, , off]) => v === current && !off) ? '' : ''; + return ``; }; // A role's model field, listing its own provider's models (model-picker.js), or its fixed model like the paper. const modelInput = (rec, role, key, value, placeholder, name) => ``; @@ -1116,7 +1124,7 @@ // after: what sits on the input's line, after it (a model's reasoning) const field = (label,key,value,{type='text',hint='',list='',min='',max='',placeholder='',declared=false}={}) => { const input = ``; return ``; }; // placeholder: shown while value is none of the options - const select = (label,key,value,options,placeholder='') => ``; + const select = (label,key,value,options,placeholder='') => ``; const fixed = (label,value,whose='official') => ``; const note = (title,text) => `
${title}${text}
`; function customRows(agent = '') { diff --git a/app/ui_tests/test_command_builder_providers.py b/app/ui_tests/test_command_builder_providers.py index 88b6600fb..6d21dc153 100644 --- a/app/ui_tests/test_command_builder_providers.py +++ b/app/ui_tests/test_command_builder_providers.py @@ -216,6 +216,14 @@ def test_run_waits_for_a_provider_that_is_set_and_never_switches_one(self): "process.stdout.write(JSON.stringify(C.providerBlocker(r)))"), '') + def test_a_provider_set_that_cannot_serve_the_recipe_says_what_it_cannot(self): + """A provider that cannot serve the agent: the Model step greys it and names the agent. + The judge has a provider of its own, so it refuses none.""" + code = ("const r=C.createStandard('healthagentbench',%s);" + "process.stdout.write(JSON.stringify(['anthropic','openrouter'].map(p=>[C.providersOf(r).includes(p),C.refusedPart(r,p)])))") + self.assertEqual(self.on(['anthropic'], code % "'goose'"), [[False, 'Goose'], [True, '']]) + self.assertEqual(self.on(['anthropic'], code % "'claude-code'"), [[True, ''], [False, 'Claude Code']]) + class CredentialReferences(CompilerCase): def test_custom_source_names_match_run(self): diff --git a/docs/builder.md b/docs/builder.md index 7fb82c7c4..b66cb5615 100644 --- a/docs/builder.md +++ b/docs/builder.md @@ -52,7 +52,7 @@ If one of the recipe's providers failed its last [test in Settings](settings/mod ### Which providers -A provider is *set* when Settings holds its key, or the base URL of a custom provider. Each custom provider is a choice of its own, listed by its name. The Model step offers a provider only where it serves what the recipe's agents speak ([protocols](settings/model-providers.md#protocols)): Anthropic for an agent of the standard that speaks `messages`, never for a Harbor recipe. +A provider is *set* when Settings holds its key, or the base URL of a custom provider. Each custom provider is a choice of its own, listed by its name. The Model step offers a provider only where it serves what the recipe's agents speak ([protocols](settings/model-providers.md#protocols)): Anthropic for an agent of the standard that speaks `messages`, never for a Harbor recipe. One set that cannot serve the agent is shown greyed, with its name. | Set in Settings | Model stage | Run | | --- | --- | --- |