# 使用此工具的 DocSummarizer 部件@ 2 @ {-}

<!--category-- AI, LLM, RAG, C#, Docling, Ollama, Qdrant, Tools -->
<datetime class="hidden">2025-12-21T11:00</datetime>

[![释放GitHub](https://img.shields.io/github/v/release/scottgal/mostlylucidweb?filter=docsummarizer*&label=docsummarizer)](https://github.com/scottgal/mostlylucidweb/releases?q=docsummarizer)
[![“.NET”](https://img.shields.io/badge/.NET-8.0%20%7C%2010.0-512BD4)](https://dotnet.microsoft.com/)

这是 **部分#2** 文档缩写器序列中的“.”和“DocSummerizer” [部分#1](/blog/building-a-document-summarizer-with-rag) 结构和图案的架构和模式 [部分#3](/blog/docsummarizer-advanced-concepts) 深层技术潜入嵌入和检索@,}或 [部分#4](/blog/docsummarizer-rag-pipeline) 以使用 NuGet 库来构建您自己的 RAG Apps.

> **将文档或 URL 转换为证据@- @_ 背景摘要 @-} 用于人类或 AI 代理 {-} , 未向云端发送任何文件\ .} ***

每个索赔都是可追踪的.}每个事实都引证其来源*.}Self\-}自足的二进制 *,}完全在你的机器上运行

```bash
# Human-readable summary
docsummarizer -f contract.pdf

# JSON for agents/pipelines
docsummarizer tool -u "https://docs.example.com"
```

**本条所包括的内容**:安裝@,關鍵模式 @(Auto}/BertRag/Bert),樣本_,和通用例}{.

**上面写着什么?**: 完整命令引用@, 配置选项 @, 排除故障 @MS K3 架构细节}{.

完整文档请见 [阅读](https://github.com/scottgal/mostlylucidweb/blob/main/Mostlylucid.DocSummarizer/README.md)@._Q#关于内部工作方式@,}请看 [部分#3](/blog/docsummarizer-advanced-concepts).

[TOC]

## 为何存在

大部分总结者给你的文本@.}这给了你 *证据证明*.

- **每项索赔包括 `[chunk-N]` 引用** 返回源材料
- **信任度** @(#high@/}根据证据提供的证据 /_low}){
- **结构化 JSON 输出** 或 MCP 服务器
- **质量衡量标准** 趁他们逃跑前,捕捉幻觉

需要时 *信任信托基金* @- 或将之反馈到其他系统@- 重要

## 特点

- **🚀伯特拉格管道**:producation -gage BERT 提取 *→ relicing *%→LM合成
- **🤖 自动模式**基于文档和查询的 :智能模式选择
- *** ⚡ 伯特模式**@:_纯采掘总结@-}不需要LLM *,}在网外工作 (~3-5{s)}
- **证据=-}四舍五入输出**:“Citations” ,}信任度 *,}可追踪索赔
- **多个模式**:自动, BertRag,Bert{,BernHybrid}, MapRuce}MS K5 Rag,迭代
- **工具工具模式**用于LLM代理商的:清洁JSON MSC服务器@,CI
- **13模板**@: 默认 , prose , 简略, 单线, 子弹MS K5 执行{, 详细MS
- **大型文件**:+Handles *{500+}页面有等级处理
- **Web 获取中**-=YTET -伊甸园字幕组=- 翻译:
- **普lay人模式**@:_# 无头浏览器用于 JavaScript@-}%s minded page = @ ( SPAS},}重现应用程序{)
- **ONNX 嵌入装置**: Zero-config 本地嵌入@- 模型自动 *- 下载首次使用
- **质量分析**“:” 幻觉检测“,” 实体提取
- **具有弹性的 LLM**:Polly-基重试,使用 jitt 后端@+断路器
- **仅本地**你的机器没有留下任何东西

## 用作 LLM 工具

缩略 `tool` 输出结构化的 JSON 使用证据支撑

### 基本工具使用

```bash
# Summarize a URL and get JSON output
docsummarizer tool --url "https://example.com/docs.html"

# Summarize a local file
docsummarizer tool -f document.pdf

# With a focus query
docsummarizer tool -f contract.pdf -q "payment terms and conditions"

# Pipe to jq for processing
docsummarizer tool -f doc.pdf | jq '.summary.keyFacts'
```

### 工具输出结构

工具指令返回结构化的 JSON JSonson, 带有证据跟踪@: @%

```json
{
  "success": true,
  "source": "https://example.com/docs.html",
  "contentType": "text/html",
  "summary": {
    "executive": "Brief summary of the document.",
    "keyFacts": [
      {
        "claim": "The system supports 10,000 TPS.",
        "confidence": "high",
        "evidence": ["chunk-3", "chunk-7"],
        "type": "fact"
      }
    ],
    "topics": [
      {
        "name": "Architecture",
        "summary": "The system uses microservices...",
        "evidence": ["chunk-1", "chunk-2"]
      }
    ],
    "entities": {
      "people": ["John Smith"],
      "organizations": ["Acme Corp"],
      "concepts": ["OAuth 2.0", "REST API"]
    },
    "openQuestions": ["What is the disaster recovery plan?"]
  },
  "metadata": {
    "processingSeconds": 12.5,
    "chunksProcessed": 15,
    "model": "qwen2.5:1.5b",
    "mode": "MapReduce",
    "coverageScore": 0.95,
    "citationRate": 1.2,
    "fetchedAt": "2025-01-15T10:30:00Z"
  }
}
```

### 工具命令选项

```bash
docsummarizer tool [options]
```

{\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}
|--------|-------|-------------|
| `--url` | `-u` 用于获取和摘要 @| @ URL
| `--file` | `-f` | 总结檔案 @|
| `--query` | `-q` |可选焦点查询@|
| `--mode` | `-m` |+Summarization模式 @(_Auto},+BertRag,}伯特•,{贝尔特•赫布里德}MS K5#MPReduce=,}(拉加・,)
| `--model` 使用 |的 Ollama 模型
| `--config` | `-c` | 配置文件路径 @ MS K1

### 关键设计原则

- **证据依据**“:” - 每项索赔包括: `evidence` 引用源块的 ID
- **信任度***:* 索赔额定 `high`, `medium`,或 `low` 基于佐证证据
- **清洁输出**# :# `executive` 摘要中没有用于轻松显示的引用标记
- **元中元数据**:处理数据有助于调试和质量评估。
- **错误处理**失败返回 `success: false` 具有 a 和 `error` 信件消息

### 整合实例

**Python 脚本@ : @**

```python
import subprocess
import json

result = subprocess.run(
    ["docsummarizer", "tool", "-u", "https://example.com/api-docs"],
    capture_output=True, text=True
)
data = json.loads(result.stdout)

if data["success"]:
    for fact in data["summary"]["keyFacts"]:
        if fact["confidence"] == "high":
            print(f"- {fact['claim']}")
```

**壳牌输油管:**

```bash
# Extract high-confidence facts only
docsummarizer tool -f doc.pdf | jq '[.summary.keyFacts[] | select(.confidence == "high")]'

# Get just the executive summary
docsummarizer tool -u "https://example.com" | jq -r '.summary.executive'
```

## 快速启动

### 下载前端@- @% 已建二进制

创建的本地可执行文件 [GitHub 释放](https://github.com/scottgal/mostlylucidweb/releases?q=docsummarizer):

|平台 @|建筑#|下载@|
|----------|--------------|----------|
|+Windows #|# x#64} @|+% `docsummarizer-win-x64.zip` |
@| @Windows | @ARM#64} @ | @ `docsummarizer-win-arm64.zip` |
|Linux | xMS K2 □| `docsummarizer-linux-x64.tar.gz` |
|Linux|ARMMS K2| `docsummarizer-linux-arm64.tar.gz` |
|+MACOS#|+X64+(+Intel@)} @|_ `docsummarizer-osx-x64.tar.gz` |
@| @ macOS @ | @ AR64 @ @ I( @ 苹果硅@ MS K5# `docsummarizer-osx-arm64.tar.gz` |

```bash
# Download and extract (Linux/macOS)
curl -L -o docsummarizer.tar.gz https://github.com/scottgal/mostlylucidweb/releases/download/docsummarizer-v3.1.0/docsummarizer-linux-x64.tar.gz
tar -xzf docsummarizer.tar.gz
chmod +x docsummarizer

# Download and extract (Windows PowerShell)
Invoke-WebRequest -Uri "https://github.com/scottgal/mostlylucidweb/releases/download/docsummarizer-v3.1.0/docsummarizer-win-x64.zip" -OutFile "docsummarizer.zip"
Expand-Archive -Path "docsummarizer.zip" -DestinationPath "."
```

### 先决条件

#### 伯特模式@(无外部服务 @)

用于纯采掘总结@, @% **不需要外部服务**:

```bash
docsummarizer -f document.md -m Bert
```

ONNX 模型自动=-\从 Hugging Face 第一次使用时的下載@(~23}{MB}).}在 @~3-5}秒@MS K4}返回

#### LLM 模式 @(Auto, BertRagMS K2 MapRuce},等+.)

对于 LLM - 动力总和 *, * Ollama 需要\ MS K2 *

```bash
# Install Ollama from https://ollama.ai
ollama pull llama3.2:3b        # Default model - good balance of speed/quality
ollama serve
```

> **速度提示**“: 快速摘要”“(~3 与 @~15 ), 使用” `--model qwen2.5:1.5b`

#### 可选的 :docling @(Binary格式@)

PDF, DOCXMS K1 XLSX , PPTXMPK3 HTML, 影像@(PNG/JPGMSKO7TIFFMK8CSVMSsk9VTTMSOK10和AsciDoc文件{.} **直接读取标记和纯文本文件@ - @ no docling needed\ .**

```bash
docker run -d -p 5001:5001 quay.io/docling-project/docling-serve
```

#### 可选的 :Qdrant (Pisticent 矢量存储@)

@ - BertRag 在 MS K1 memory 矢量. 启用用于持续存储的Qdrant, 以避免在后续运行中重新MS K3\ 编组文档@:}

```bash
docker run -d -p 6333:6333 -p 6334:6334 qdrant/qdrant
```

然后配置 `docsummarizer.json`:

```json
{
  "bertRag": {
    "vectorStore": "Qdrant",
    "collectionName": "docsummarizer",
    "persistVectors": true
  }
}
```

#### Ollama 嵌入式

如果您更喜欢 Ollama 嵌入, 而不是 ONNX: @

```bash
ollama pull nomic-embed-text   # Or mxbai-embed-large
# Then use: --embedding-backend Ollama
```

### 核查依赖性

```bash
docsummarizer check --verbose
```

预期输出显示格式化的表格@: @%

```
              Dependency Status              
╭─────────┬────────┬────────────────────────╮
│ Service │ Status │ Endpoint               │
├─────────┼────────┼────────────────────────┤
│ Ollama  │   OK   │ http://localhost:11434 │
│ Docling │ Optional │ http://localhost:5001 │
│ Qdrant  │ Optional │ localhost:6333        │
╰─────────┴────────┴────────────────────────╯

        Default Model Info         
╭────────────────┬────────────────╮
│ Property       │ Value          │
├────────────────┼────────────────┤
│ Name           │ llama3.2:3b    │
│ Family         │ llama          │
│ Parameters     │ 3.2B           │
│ Context Window │ 128,000 tokens │
╰────────────────┴────────────────╯

Ready to summarize! Ollama is available.
```

> **注注注注注释注注说明附注注注,注注 注注的注 注 注 注注说明注注附注注 注的注注 注注说注注的附注注说明,注 注,注说明的注说明说明注 注说明注说明 注注 注附注注的注释注 注 注 注注释注说明注释注的说明注,说明注的 注 注说明说明说明 注 注的说明说明,说明说明的附注 注注附注说明注附注的注附注 注 注注释说明注注释的注注释 注注注释注释注,的注, 注注,注释注附注附注注注释说明的说明 注说明 注的注释 注 注附注说明说明注释说明说明附注 注说明的注释注释注释说明 注注释注释 注说明注释注释的说明注释 注注释 注的附注注释注注释,注注释附注注附注注释的 注注脚注注注**@ :_ docling 和 Qdrant 显示 MS K1} Markdown\ MPK2 只有工作流程@ MSC3 可以吗?

## 用法

### 默认行为行为

运行中 `docsummarizer` 没有参数将 :\ {}

1. 查找 `README.md` 在当前目录中
2. 使用 **自动自动模式** (#smart 模式选择@) @%
3. 用漂亮的面板 UI 打印控制台的概要
4. 自动- @save 到 `readme.summary.md`

```bash
# Summarize README.md in current directory
docsummarizer

# Shows a formatted panel with:
# - Document info table (file, mode, model)
# - Progress indicators during processing
# - Summary panel with the result
# - Topics tree if available
# - Saved: readme.summary.md
```

### 基本概况

```bash
# Just run it - Auto mode picks the best approach
docsummarizer -f document.pdf

# Fast mode - no LLM, pure extraction (~3-5s)
docsummarizer -f document.pdf -m Bert

# Production mode - best quality with validated citations
docsummarizer -f document.pdf -m BertRag

# Focused on specific topic
docsummarizer -f manual.pdf -m BertRag --focus "installation steps"

# Verbose progress
docsummarizer -f document.pdf -v
```

## 总结模式

此工具从 @ " @ just MapReduce+"}进化为完整管道@ MS K2这里 @ '}每个模式实际上都做什么 @ MPK4}

### 自动 ( @ default_)@

选择基于您@'re 要求的正确模式“.}使用此选项,除非您有理由不“MS K2 ” 。

```bash
docsummarizer -f doc.pdf
```

### 伯特拉格(production)

这是您想要的 用于生产“. 3 ” “- ” 管道中段“MS K2 ”

1. **解压缩** - 将文档解析成片段@, 将其嵌入 BERT
2. **检索** 找到相关部分 @(_ssemantic search@+}突出评分=)
3. **同步合成** -LLM写下这些部分的流利摘要。

```bash
docsummarizer -f doc.pdf -m BertRag
docsummarizer -f doc.pdf -m BertRag --focus "payment terms"
```

**为何使用@:** 每个索赔都追溯到源段@.}没有幻觉\.}缩放至任何文档大小 {.} <LLM > 只运行在+(cheap).}结尾

### 伯特・(Fast,}没有LLM•)

使用本地的 ONNX 模型进行纯采掘@.}没有LLM 呼叫 *.

```bash
docsummarizer -f doc.pdf -m Bert
```

**为何使用@:** 在“~3-5”秒中工作 .返回@.确定性 @(same 输入 @=}同样的输出@MS K5 足够快速扫描=.#

### 贝尔赫布里德

BERT 提取,LLM抛光.Bert和BertRagMS K2之间的中地

```bash
docsummarizer -f doc.pdf -m BertHybrid
```

### 地图驱动器 @ / @ Rag @ I/ @ 迭代

原始模式@.仍然在工作 @,,但BertRag取代了多数使用的案例_.

- **下图地图**-=YTET -伊甸园字幕组=- 翻译:
- **鼠角**@: 矢量搜索@, 对焦点查询有好处 @MS K2legacy {- BertRag做这个更好}#)
- **迭替**: 序列处理 *, 仅用于小医生

```bash
docsummarizer -f doc.pdf -m MapReduce  # Full coverage
docsummarizer -f doc.pdf -m Rag --focus "query"  # Legacy focused mode
```

### 查询模式

而不是总结@, @ 询问关于文件的提问 @ :} @

```bash
docsummarizer -f manual.pdf --query "How do I install the software?"
```

### 网络 URL 抓取中

直接总结网页而不下载@: @%

```bash
# Summarize a web article
docsummarizer --url "https://example.com/article.html" --web-enabled

# Summarize a remote PDF
docsummarizer --url "https://example.com/document.pdf" --web-enabled

# With structured JSON extraction
docsummarizer --url "https://example.com/api-docs.html" --web-enabled --structured
```

**支持内容**:+HTML HTML @(#sanitized@),+PDF},+Markdown,}图像=%(_OCR), 办公室文档 *.大图象自动重新缩放\.{

**安全安保安全**:+SSRF保护=,QDNS 重新绑定保护,}内容MS K3+GTING},+解除压缩炸弹防护 □,#HTML防疫=MS K6}

**JavaScript\ - 发送页面**: 使用 `--web-mode Playwright` 用于 SPA 和 React Apps @(_auto-}安装铬(首次使用) *).}*

### 结构模式

解压缩机-可读 JSON 代替发音MS K1

```bash
docsummarizer -f document.pdf --structured -o Json
```

@( 充满信心的#), 不确定的_, 定额通道@.

### 摘要模板

```bash
# Use a template
docsummarizer -f doc.pdf --template executive
docsummarizer -f doc.pdf -t bullets

# Specify custom word count with template:wordcount syntax
docsummarizer -f doc.pdf -t bookreport:500
docsummarizer -f doc.pdf -t executive:100

# Or use --words to override any template's default
docsummarizer -f doc.pdf -t detailed --words 300
```

|+模板 @|+Words@|_BARBAR_|#最佳词
|----------|-------|----------|
| `default` “|”“~300”“|”“平衡摘要,主题为:“(2”,段落: ) {|}
| `prose` --无元数据 @|
| `brief` 句子摘要: @|
| `oneliner` 单句摘要
| `bullets` | 自动 @| 弹点列表@(5-7 项) MS K4
| `executive` 内容提要的执行简报
| `detailed` -=YTET -伊甸园字幕组=- 翻译:
| `technical` “|”“~350”“|”“技术文件,包括实施细节”
| `academic` 学习抽象格式 @|
| `citations` @|_Outo {|} 关键引号仅引用源代码@|}
| `bookreport` @| @ ~500 @ @ I| 书目报告 @ MPK3king, 字元@ MS K5plot_ , 主题 @ ) @ *|#
| `meeting` 会议注意到 (决定 MS K4 行动
| `strict` | MS K1 I| 托肯 MAK3 有效率 , NSK5 子弹最大, 不套套套

查看包含描述的所有可用模板@: @%

```bash
docsummarizer templates
```

### 示范基准制定

比较同一文档中使用 `benchmark` 子命令@: @%

```bash
docsummarizer benchmark -f doc.pdf -m "qwen2.5:1.5b,llama3.2:3b,ministral-3:3b"
```

基准命令将文档一次切换为“, ” ,然后在相同的块上运行每个模型以进行公平的比较 “. ”输出显示每个模式的定时@, 字数\ , 和 words @/ 秒

### 批次处理

处理整个目录@: @%

```bash
# Use BertRag for quality
docsummarizer -d ./documents -m BertRag -v

# Fast offline batch (no LLM needed)
docsummarizer -d ./documents -m Bert -o Json --output-dir ./summaries

# Process only PDFs recursively
docsummarizer -d ./documents -e .pdf --recursive -v
```

### 命令@-Line 选项

“| 选项”“|”简称“MS K2”描述“MSC3 默认”“|”
|--------|-------|-------------|---------|
| `--file` | `-f` | 文档路径 @DOCX},PDF,MDMS K4|-#|
| `--directory` | `-d` 批量处理目录路径 @ | @ @ MPK2} @ I|#
| `--url` | `-u` @|_网络 URL 来获取并总结@|}-}{|}
| `--web-enabled` @ | @ @ I| @ 启用网络获取@ MS K2 @ required 用于 @ MCK3 @ url) @ @ *|} `false` |
| `--mode` | `-m` |+Summarization模式@:+Autoñ,+BertRag,+Bert{,}BertHybrid},+MapReduce=,+Rag_,+迭代性 @|# `Auto` |
| `--structured` | `-s` 使用结构化的 JSON 提取模式 `false` |
| `--focus` @ | @ MPK1} RAG 模式的焦点查询@ MS K2 non * MSC3
| `--query` | `-q` |查询模式,而不是汇总@| None @|
| `--model` 使用 |的 Ollama 模型 `llama3.2:3b` |
| `--verbose` | `-v` @|_progress 详细的进展与现场UI@|} `false` |
| `--config` | `-c` | 配置文件路径 @ MS K1 Auto - 发现@|
| `--output-format` | `-o` | 输出格式@: 控制台 @, Text, Markdown}, Json _| `Console` |
| `--output-dir` | | 输出文件输出目录 @| 当前目录@|
| `--extensions` | `-e` @ |_ 批量模式的扩展名@ MS K1} 所有文件格式 {|} 的文件扩展名
| `--recursive` | `-r` @ | 进程目录递归 *\ | `false` |
| `--template` | `-t` |+简略模板 @(_default@,}简短的,\junts *,QE 执行官*,Q 等#.){|} `default` |
| `--words` | `-w` | 目标字数@(override 模板 @)}{| 模板默认=#|}

| `--embedding-backend` | MS K1 嵌入后端 : Onnx, Ollama | `Onnx` |
| `--embedding-model` | NSK1 ONNX 型号 @(RAG 模式@) MS K4 `AllMiniLmL6V2` |
| `--web-mode` | MS K1 网络接驳模式: 简单, 播放器| `Simple` |
| `--analyze` | `-a` @| 运行对摘要的质量分析 *#| `false` |

## 总结模式

### 地图显示 @ ( @ 推荐@ MS K1

最好全面摘要,包括全部文件内容

```bash
docsummarizer -f document.pdf -m MapReduce -v
```

**如何运作**:

1. 将文档分割成结构块 @ ( @ by 标题@ MS K1} {
2. 使用 LLM 以平行方式对每个块段进行汇总
3. 用引文将摘要减少为内容提要
4. 校验所有引用引用参考真实块

**长期文件的等级裁减**:

对于总块摘要超过模型@' @s 上下文窗口 ,} MapRduce 自动使用等级递减QS:

1. **条纹**: 将摘要分成符合背景的批次
2. **中间削减**: 将每批数量减为压缩摘要
3. **最终削减**: 将中间摘要合并到最终输出中
4. **连续递归**: 如果中间体仍然太大 ,增加更多的水平

```
100 chunks → 100 summaries → 5 batches → 5 intermediate summaries → final
```

工具估计符号@(~4chars @/}token)和目标 <60%> 上下文窗口每个切换通道的利用率\.{

**Pros**: fast, 完整覆盖 *, 平行处理*, 处理任何文档长度
**共**@ :_ mays miss cross @ I- section connection {\fn微软雅黑\fs12\bord0\3cH000000\4cH00FFFF\b0} @,} 在很长的文档中慢一些

### RAG ( 聚焦查詢最大量} )

最好在您需要关注特定议题或有针对性问题时,

```bash
docsummarizer -f document.pdf -m Rag --focus "pricing and payment terms" -v
```

**如何运作**:

1. 在 Qdrant 中作为矢量嵌入的矢量记录索引块
2. 从文件标题中提取关键主题
3. 使用语义搜索获取每个专题的相关块块
4. 用引文合成重点突出的概要

**何时在 MapRedduce 上使用 RAG**:

最佳模式 | *
|----------|-----------|
|{"_Summarized this whole document 整个文档"}MS K3| MapRduce @|
上面写着安全吗?
| MapRuce (ihiarranchical) @MS K6需要一切
@|_ 500-_page manual_,}需要特定章节={|}{RAG+|}
“| 需要快速结果”“, @ don't '}没有Qdrant @| @ MapReduce @|

RAG 是 **否** 用于处理长文档的“% - ” MapRduce 手控程序 **相关筛选**: 当您想要忽略文档中的 @90%, 并关注与您的特定问题相关的事项\.

**Pros**@ : @ Topic=- @ pocused_ , 语义理解@,}再利用指数 @,对焦点查询更快
**共**@:_ 可能错过焦点区域以外的内容@,}需要 Qdrant , 慢化初始索引

### 迭替

最好用于叙述性文件,如果上下文依序流动\.

```bash
docsummarizer -f story.pdf -m Iterative -v
```

**警告警告警告**: 减慢并可能丢失长文档的上下文@(>10块 @).

## 大文件指南

### 选择正确模式

| 文档类型 @| 目标@| 模式#| 为什么\|
|---------------|------|------|-----|
@|_|}完整的覆盖 ~|#
|+|+需要时间环境 @|+#
“| 法定合同”“|”“完整摘要”“|”“MapReduce @|” Can''t missions & |
“| 法定合同”“|”“"”、“Payment terms ?"”、“|”“RAG @|”专注特定章节“MS K6”
@| @API docs@(200_page#)}|}{"} 如何工作?
“|”研究论文“|”全文摘要:“|”地图“MPRduce |”结构“MSSK4”需要一切|

### 子集对非 - & Fiction

“|”内容类型“|”最佳模式“|”注:“|”
|--------------|-----------|-------|
| **缩略语** | MapReduce |Plot 需要相继的上下文@|
| **技术文件** | 两种| 用于概览的 Mapruce @, 具体细节的RAG+|
| **法律合同** “| MapReduce | 每个条款都重要”“|
| **手册手册手册** 通常询问具体细节 *|*

### 业绩表现 实绩

|文档大小 @|地图|RAG _|注|
|---------------|-----------|-----|-------|
@| 10 @pages | @#15}{|#20} @MS K6}都快了 @|□
@| 50 页面 @MS K2 45 *| *#30 *{| RAG如果集中的话速度更快* <|}
@| 1-2 min@| 分级削减 @MS K7
@| 500+ 頁面 @MS K2 @ @10-15 min@| NSK5 分钟 @MSKO6 考虑多个RAG查询 *|

## 配置配置

### 生成默认配置

```bash
docsummarizer config --output myconfig.json
```

### 配置文件

配置为自动@ - @ discover from @ MS K1} 。

1. `--config` 选项
2. `docsummarizer.json` 在当前目录中
3. `.docsummarizer.json` (hidden 文件 @)
4. `~/.docsummarizer.json` @(@user home#) @%

示例实例 `docsummarizer.json`:

```json
{
  "embeddingBackend": "Onnx",
  "onnx": {
    "embeddingModel": "AllMiniLmL6V2"
  },
  "ollama": {
    "model": "llama3.2:3b",
    "embedModel": "mxbai-embed-large",
    "baseUrl": "http://localhost:11434",
    "temperature": 0.3,
    "timeoutSeconds": 1200
  },
  "docling": {
    "baseUrl": "http://localhost:5001",
    "timeoutSeconds": 1200,
    "pdfBackend": "pypdfium2",
    "pagesPerChunk": 10,
    "maxConcurrentChunks": 4,
    "enableSplitProcessing": true
  },
  "qdrant": {
    "host": "localhost",
    "port": 6333,
    "collectionName": "documents"
  },
  "processing": {
    "maxHeadingLevel": 2,
    "targetChunkTokens": 1500,
    "minChunkTokens": 200,
    "maxLlmParallelism": 2
  },
  "output": {
    "format": "Console",
    "verbose": false,
    "includeTrace": false
  },
  "webFetch": {
    "enabled": false,
    "mode": "Simple",
    "timeoutSeconds": 30,
    "userAgent": "Mozilla/5.0 DocSummarizer/1.0"
  },
  "batch": {
    "fileExtensions": [".pdf", ".docx", ".md", ".txt", ".html"],
    "recursive": false,
    "continueOnError": true
  }
}
```

### 处理备选方案

@ |_ 选项@ MS K1_ 默认 @ I|} 描述 @ MPK3
|--------|---------|-------------|
| `maxLlmParallelism` |{8}|}(同时LLM) 请求MS K3Ollama 队列 □, 如此高的值就只是在队列〞# @|♪
| `maxHeadingLevel` @| @ @ 2 @ @ @ | @ splission on H1/_H @ I2}只@. @set to *3# 用于细微颗粒 @MS K7 @
| `targetChunkTokens` @| @ 0 @ @ I( @ auto@ MS K3} @ O| @ 目标块大小 @ MPK5 @ @ *0# 自动=- @ acallculate @ (~25% @ 上下文窗口 @ MASK10 @ @ |_
| `minChunkTokens` @| @ 0 @ @ I @ auto@ MS K3} @ MPK4 @ 合并前的最低限 @ O. @ @ *0# @ @ _= @ @ @ 1/8_ 目标的 MSSK9 @

## 输出格式

### 简表结构

```C:\Blog\mostlylucidweb\Mostlylucid\Markdown\docsummarizer-tool.md
## Executive Summary
- Key finding 1 with specific details [chunk-0]
- Important point 2 with numbers and dates [chunk-3]
- Critical requirement 3 [chunk-5]

## Section Highlights
- Introduction: Overview of the system architecture [chunk-0]
- Requirements: Technical specifications detailed [chunk-3]
...

## Open Questions
- What is the timeline for Phase 2?
- How does the fallback mechanism work?

### Trace

- Document: document.pdf
- Chunks: 12 total, 12 processed
- Topics: 5
- Time: 21.4s
- Coverage: 100%
- Citation rate: 1.20
```

**追踪指标**“:”覆盖范围 @(%部分包括“), 引用率 @MS K3suscripations @/bullet}),Chunks produced (RAG可能跳过一些 mSSK7

## 示范建议建议书

@| 型号@| 大小□ | 速度□|}QQQ}{| 使用案例|
|-------|------|-------|---------|----------|
| `qwen2.5:1.5b` |+ @986+MB#非常快速的~3+SQK4+#|}好的|+速度优化了@|{
| `gemma3:1b` @| 815MB| Fast @MS K3ss})~#| 公平 |替代小型型号@|
| `llama3.2:3b` @| 2 GB| 中度 @MS K3s}) NSK5 非常好~|# **默认默认** 保持良好的平衡
| `ministral-3:3b` @| 2.9 GB MSSK2 中度 @MS K3s}) NSK5 非常好~|QQQ}质量□-重点#|
| `llama3.1:8b` 超棒的|高音

> **提示提示**“: 快速摘要”“(~3 与 @~15 ), 使用” `--model qwen2.5:1.5b`@. 用于质量更重要的关键文档 `--model llama3.1:8b`.

## 从源代码构建

```bash
# Clone the repository
git clone https://github.com/scottgal/mostlylucidweb.git
cd mostlylucidweb/Mostlylucid.DocSummarizer

# Build
dotnet build

# Run
dotnet run -- --help
```

### 自定义“-”

用于不需 .NET 运行时间安装=:

```bash
# Build self-contained executable (Windows x64)
dotnet publish -c Release -r win-x64 --self-contained

# Build for Linux
dotnet publish -c Release -r linux-x64 --self-contained

# Build for macOS
dotnet publish -c Release -r osx-x64 --self-contained
```

产出=: `bin/Release/net9.0/<runtime>/publish/docsummarizer`

## 排除故障

### @"_Could 无法连接到 Ollama"}

- 确保Ollama正在运行@: @% `ollama serve`
- 检查模型被拉动@: @% `ollama list`

### " 无法使用的多盘服务 @"

- 这是 **仅需要 PDF @ / DOCX 文件**
- 对于 Markdown 文件@, @% 您可以忽略此错误
- 修补@: @% `docker run -p 5001:5001 quay.io/docling-project/docling-serve`

### "drant 连接失败@"

- 这是 **只为 RAG 模式所需** (`--mode Rag`)
- 对于 MapRduce 模式 @ ( default@ MS K1} 您可以忽略此错误
- 修补@: @% `docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant`

### “"” 环曲断路器已打开“"”

- Ollama超载或坠毁
- 等待“30”秒后断路器重置“MS K1”或重新启动 Ollama
- 该工具使用 Polly 抗御政策, 并将自动@-\retry

### "wsarecv"或连接错误 @(Windows})

- 这是在Windows @(#GitHub@#13340)}上已知的Ollama议题。
- 工具自动@ - @ handles 此工具与重试逻辑和连接恢复
- 如果坚持\ , 重新启动 Ollama, 再试一次

### "LLM 一代超时

- 增加配置超时
- 拆分非常大的文件
- 检查 Ollama 没有超载其它请求

### 重覆或低@ -}质量摘要

**症状**@:_junt point 响应即时的@("}只返回圆点 *#",} "}这条规则是{...")}而不是总结内容.}

**原因原因原因**@:_BARBAR_ 与快速或内容拼凑的模型#._QAR_

**修整***: 默认 `qwen2.5:1.5b` 对于有问题的文档,请尝试\ ,} `--model llama3.2:3b`*.* 见 [示范建议建议书](#model-recommendations).

### 摘要忽略文档内容

如果摘要是通用的或 does{'} <t reference expecial conditions account* :(如果概要看起来像普通的或者不像是}MSKO}< t 引用具体内容>_MSK 1

- 该模型可能是幻觉 @ -_ check `Citation rate` 跟踪输出
- 尝试 RAG 模式@ ( @%`--mode Rag`) 以回收的块进行摘要
- 使用 `--verbose` 查看哪些块正在处理中

### 失踪或无效

如果缺少摘要 `[chunk-N]` 校对:Portnoy

- 小型模式将内容优先排在内容之上,而不是引证格式化
- 最优化的提示用于速度@, @ 不严格遵守引用
- 严格引用,使用更大的模型,例如 `llama3.2:3b`
- 检查支票 `Citation rate` 在\ - 更高值表示可追踪性更好

## 绩效提示

- **下图地图** 速率% ( @parallel块@)}
- **`qwen2.5:1.5b`** 速度@, @% **`llama3.2:3b`** 平衡的, **`llama3.1:8b`** 质量
- **ONNX 嵌入器** NAG 模式的 ( @ default@ MS K1比 Ollama 要快
- 下 **`maxLlmParallelism`** 如果发生超时

## 资源资源资源 资源和资源资源资源

- [源代码](https://github.com/scottgal/mostlylucidweb/tree/main/Mostlylucid.DocSummarizer)
- [GitHub 释放](https://github.com/scottgal/mostlylucidweb/releases?q=docsummarizer)
- [弯曲](https://github.com/docling-project/docling) / [文档服务](https://github.com/docling-project/docling-serve)
- [解冻](https://qdrant.tech/) - 本地矢量数据库
- [奥拉马](https://ollama.ai/) / [奥利亚马沙尔普](https://github.com/awaescher/OllamaSharp)
- [波利](https://github.com/App-vNext/Polly) @ - @ @ MPK1NET 复原力和瞬时性@ MS K2 @ fault_ -}处理
- [频谱@ . @ console](https://spectreconsole.net/) 美丽的终极UI

## 系列导航

- **[与 RAG 构建文档摘要](/blog/building-a-document-summarizer-with-rag)** 结构和模式
- **[使用此工具的“ 2:” 部件](/blog/docsummarizer-tool)** @( @ this article profession@)}Quick-_启动指南
- **[部分: 3:高级概念](/blog/docsummarizer-advanced-concepts)** 深入BERT,}OnNX},}嵌入中 *,}和混合搜索

### 相关

- [CSV 与本地LLMs分析](/blog/analysing-large-csv-files-with-local-llms)
- [LLMM 网络内容](/blog/fetching-and-analysing-web-content-with-llms)