MCPcopy Create free account
hub / github.com/cortexkit/magic-context / pickModel

Function pickModel

packages/cli/src/lib/model-picker.ts:71–92  ·  view source on GitHub ↗
(
    prompts: PromptIO,
    allModels: string[],
    role: ModelRole,
)

Source from the content-addressed store, hash-verified

69 * — never block setup behind an empty list.
70 */
71export async function pickModel(
72 prompts: PromptIO,
73 allModels: string[],
74 role: ModelRole,
75): Promise<string> {
76 const copy = ROLE_COPY[role];
77 prompts.note(copy.blurb, copy.title);
78
79 const options = modelOptions(allModels);
80 if (options.length === 0) {
81 return (
82 await prompts.text(`${copy.pickMessage} (type a provider/model id)`, {
83 placeholder: "e.g. anthropic/claude-haiku-4-5",
84 validate: (value) =>
85 value.trim().length === 0 ? "A model id is required" : undefined,
86 })
87 ).trim();
88 }
89 return prompts.selectAutocomplete(copy.pickMessage, options, {
90 placeholder: copy.placeholder,
91 });
92}

Callers 3

runSetupFunction · 0.90
runSetupFunction · 0.90
runDreamerSetupFunction · 0.90

Calls 4

modelOptionsFunction · 0.85
noteMethod · 0.65
textMethod · 0.65
selectAutocompleteMethod · 0.65

Tested by

no test coverage detected