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]

769 B
Raw Blame
import { MCP_CALL_TYPES } from "../constants";

/**
 * Derive a short, human-readable display name for a log entry.
 * Strips provider prefixes, date suffixes, and version tags.
 */
export function getEventDisplayName(callType: string, model: string): string {
  const raw = (model || "").trim();
  const isMcp = MCP_CALL_TYPES.includes(callType);

  if (isMcp) {
    return (
      raw
        .replace(/^mcp:\s*/i, "")
        .split("/")
        .pop() ||
      raw ||
      "mcp_tool"
    );
  }

  const lastSegment = raw.split("/").pop() || raw;
  const noSuffix = lastSegment.replace(/-20\d{6}.*$/i, "").replace(/:.*$/, "");
  const claudeMatch = noSuffix.match(/claude-[a-z0-9-]+/i);
  if (claudeMatch) return claudeMatch[0];
  return noSuffix || "llm_call";
}