Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/h-lu/agentic-nlp --skill llm-viz명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
SOC 직업 분류 기준
| name | llm-viz |
| description | 创建高质量 LLM 应用可视化的指南。包含 Token 使用图、RAG 检索效果、Agent 流程图、评估指标图。 |
| argument-hint | <week_id> [chart_type] |
| allowed-tools | Read, Write, Edit, Grep, Glob, Bash, WebSearch |
| disable-model-invocation | true |
/llm-viz week_XX # 显示本周应该生成的图表类型
/llm-viz week_XX token_usage # 生成特定类型的图表
为 chapters/week_XX/ 创建高质量的 LLM 应用可视化:
examples/NN_chart_xxx.py(可复现)images/xxx.png(嵌入正文)| 你想展示什么 | 推荐图表 | 说明 |
|---|---|---|
| Token 使用分布 | 柱状图 | 展示不同任务的 Token 消耗 |
| 成本对比 | 条形图 | 不同模型/配置的成本比较 |
| RAG 检索效果 | 柱状图 + 折线 | Recall@K、MRR 等指标 |
| Agent 执行流程 | 流程图/时序图 | 用 Mermaid 或 Matplotlib |
| 评估指标对比 | 雷达图/条形图 | 多维度性能对比 |
| 延迟分布 | 箱线图/直方图 | 响应时间分析 |
| 混合检索效果 | 分组柱状图 | 向量检索 vs 关键词检索 |
| 避免 | 原因 | 替代方案 |
|---|---|---|
| 3D 图表 | 透视 distort 数值感知 | 2D 图表 + 分面 |
| 过多颜色 | 认知过载 | 使用色调渐变或分组 |
| 复杂饼图 | 人眼难以比较角度 | 条形图 |
# ❌ 错误:截断 Y 轴夸大差异
plt.ylim(95, 100) # 从 95 开始,5% 差距看起来很大
# ✅ 正确:从 0 开始(柱状图必须)
plt.ylim(0, None) # 或不设置,让 matplotlib 自动选择
# ❌ 错误:一张图展示所有东西
sns.scatterplot(data=df, x='a', y='b', hue='c', size='d', style='e')
# ✅ 正确:分面或分图
g = sns.relplot(data=df, x='a', y='b', hue='c', col='e')
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
def setup_chinese_font() -> str:
"""配置中文字体,返回使用的字体名称"""
chinese_fonts = ['SimHei', 'Noto Sans CJK SC', 'Arial Unicode MS',
'PingFang SC', 'Microsoft YaHei']
available = [f.name for f in fm.fontManager.ttflist]
for font in chinese_fonts:
if font in available:
plt.rcParams['font.sans-serif'] = [font]
plt.rcParams['axes.unicode_minus'] = False
return font
plt.rcParams['font.sans-serif'] = ['DejaVu Sans']
return 'DejaVu Sans'
"""
示例:生成不同 LLM 任务的 Token 使用对比图。
运行方式:python3 chapters/week_XX/examples/01_token_chart.py
预期输出:生成 images/token_usage.png
"""
from __future__ import annotations
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
from pathlib import Path
def setup_chinese_font() -> str:
chinese_fonts = ['SimHei', 'Noto Sans CJK SC', 'Arial Unicode MS']
available = [f.name for f in fm.fontManager.ttflist]
for font in chinese_fonts:
if font in available:
plt.rcParams['font.sans-serif'] = [font]
plt.rcParams['axes.unicode_minus'] = False
return font
return 'DejaVu Sans'
def main() -> None:
font = setup_chinese_font()
tasks = ['分类', '摘要', '抽取', '问答']
input_tokens = [150, 500, 200, 300]
output_tokens = [20, 100, 50, 150]
fig, ax = plt.subplots(figsize=(10, 6))
x = range(len(tasks))
width = 0.35
bars1 = ax.bar([i - width/ i x], input_tokens, width,
label=, color=)
bars2 = ax.bar([i + width/ i x], output_tokens, width,
label=, color=)
ax.set_xlabel(, fontsize=)
ax.set_ylabel(, fontsize=)
ax.set_title(, fontsize=)
ax.set_xticks(x)
ax.set_xticklabels(tasks)
ax.legend()
bar bars1 + bars2:
height = bar.get_height()
ax.annotate(,
xy=(bar.get_x() + bar.get_width() / , height),
ha=, va=, fontsize=)
output_dir = Path(__file__).parent.parent /
output_dir.mkdir(exist_ok=)
plt.savefig(output_dir / , dpi=, bbox_inches=)
plt.close()
()
__name__ == :
main()
| 阶段 | 周次 | 推荐图表 |
|---|---|---|
| LLM 基础 | 01-02 | Token 使用图、成本对比图 |
| RAG 系统 | 03-04 | 检索效果对比、RAGAS 评估雷达图 |
| LLM Agents | 05-06 | Agent 流程图、工具调用时序图 |
| 企业应用 | 07-08 | 端到端性能图、评估仪表板 |
当调用此 skill 时:
chapters/week_XX/CHAPTER.md 确定需要什么图表images/ 目录examples/NN_chart_xxx.pyimages/xxx.pngvalidate_week.py 仍然通过