鼎稔道學館
← 開源 LLM/Cookbook/07
07

How we trace Citations

CC0

Demo E 重現:引文回溯 + ABCD 信賴度分級 + 「只回溯不解讀」原則。

引文回溯信賴度trigram

對應 Live Demo

🔒 重現條件鎖
MODEL    = "lius-cc/Daoism-Qwen3.5-9B"
DATASET  = "lius-cc/daoism-knowledge-rag@v1"
RAG_API  = "https://lius.cc/api/llm-rag"
SNAPSHOT = "2026-05-17"

ABCD 啟發式信賴度

  • A:name 直接命中
  • B:summary 完整 query 命中
  • C:content 詞命中
  • D:低分模糊命中
  • import requests
    
    def grade(hit, query):
        q = query.lower()
        if hit["name"].lower() in q or q in hit["name"].lower():
            return "A"
        toks = [t for t in q.split() if len(t) >= 2]
        if toks and all(t in hit.get("summary", "").lower() for t in toks):
            return "B"
        if toks and all(t in hit.get("content", "").lower() for t in toks):
            return "C"
        return "D"
    
    quote = "天地不仁 以萬物為芻狗"
    res = requests.post(
        "https://lius.cc/api/llm-rag",
        json={"q": quote, "n": 5, "types": ["scripture", "concept", "paper"]},
        timeout=10,
    )
    res.raise_for_status()
    r = res.json()
    
    for h in r.get("hits", []):
        g = grade(h, quote)
        print(f"[{g}] {h['name']:25} {h['url']}")

    📜 本 recipe 採 CC0 1.0 · 改一行 prompt → 寫到論文裡 → 引用 LIUS API

    引用建議:We use the open-source Daoism-Qwen3.5-9B with the public RAG API at https://lius.cc/api/llm-rag (Liu & Dingren Daoxue Lab, 2026).

    ← 回 Cookbook 索引

    07 · How we trace Citations · Cookbook · 鼎稔道學館