Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Stop Guessing Where Your LLM Prompt Tokens Go: prompt-flamegraph

说明与用途

prompt‑flamegraph 可视化 LLM 提示中的 token 使用,检测重复、过大 RAG、长聊天记录和过多工具等浪费,帮助降低 API 成本。

问题

Developers building LLM‑powered applications pay per token but lack visibility into which parts of a prompt consume the budget, leading to wasted spend on oversized RAG context, long chat history, or unnecessary tools.

结果

Developers gain clear insight into token consumption, identify and eliminate waste, and reduce API costs by up to 30% or more.

工作流

  • Install prompt‑flamegraph via pip
  • Prepare a structured prompt JSON with system_prompt, tools, rag_context, chat_history
  • Run prompt‑flamegraph CLI or profile_prompt() to generate an interactive HTML flamegraph
  • Review the report for total tokens, estimated cost, and waste findings
  • Optionally use detect_waste() in code to programmatically identify waste
  • Use prompt‑optimizer to automatically clean up the prompt

证据

prompt‑flamegraph takes a structured prompt — system prompt, tools, RAG context, chat history — and renders it as an interactive HTML flamegraph.

来源

Waste detection: duplicate text, oversized RAG, long history, too many tools.

来源

It removes duplicate RAG chunks, trims long history, and suggests fewer tools.

来源

  • 记录日期: 2026-09-15T12:17:13.016Z