Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

401 B
Raw Blame
export function countBudgetViolations(report, budgets) {
  const counts = {};
  for (const file of report) {
    for (const message of file.messages) {
      if (message.ruleId in budgets) {
        counts[message.ruleId] = (counts[message.ruleId] || 0) + 1;
      }
    }
  }
  return Object.fromEntries(
    Object.keys(budgets)
      .sort()
      .map((rule) => [rule, counts[rule] || 0]),
  );
}