mcp-ai-agent-guidelines
Version:
A comprehensive Model Context Protocol server providing advanced tools, resources, and prompts for implementing AI agent best practices
49 lines • 1.69 kB
JavaScript
// Model selection helpers for dynamic code example generation
// These functions select appropriate models from models.yaml based on criteria
import { MODELS } from "./model-config.js";
/**
* Select best model for a given use case from models.yaml
*/
export function selectModelByCategory(criteria) {
let candidates = [...MODELS];
if (criteria.taskArea) {
candidates = candidates.filter((m) => m.taskArea === criteria.taskArea);
}
if (criteria.mode && criteria.mode !== "all") {
candidates = candidates.filter((m) => m.modes?.[criteria.mode]);
}
if (criteria.budget === "low") {
candidates = candidates.filter((m) => m.pricingTier === "budget");
}
// Sort based on PRIMARY criterion - return early for special cases
if (criteria.requireLargeContext) {
return candidates.sort((a, b) => b.contextTokens - a.contextTokens)[0];
}
// Default: Return highest scored candidate
return candidates.sort((a, b) => b.baseScore - a.baseScore)[0];
}
/**
* Get best budget-friendly model (low-cost, fast)
*/
export function getBudgetModel() {
return selectModelByCategory({ budget: "low" });
}
/**
* Get model with largest context window
*/
export function getLargeContextModel() {
return selectModelByCategory({ requireLargeContext: true });
}
/**
* Get balanced general-purpose model
*/
export function getBalancedModel() {
return selectModelByCategory({ taskArea: "general-purpose" });
}
/**
* Get advanced reasoning model for complex tasks
*/
export function getAdvancedReasoningModel() {
return selectModelByCategory({ taskArea: "deep-reasoning" });
}
//# sourceMappingURL=model-selectors.js.map