Introduction¶
In the plugin workflow of DSH (DeepSeek Harness), many repetitive document tasks can be broken down into independent plugins. A common pain point in the exam generation process is that questions are scattered across .doc, .docx, .pdf, .txt, and .md files, requiring manual identification of question types, selection of questions, and formatting into printable exams. If the model is allowed to read the entire question bank directly, context and token consumption will also be relatively high. exam-paper-plugin provides basic parsing and generation for this process, as well as local intelligent indexing, clustering, retrieval, and selection. Below is an introduction to its capabilities, installation methods, and common commands.
What is this¶
exam-paper-plugin is a DeepSeek Harness plugin maintained by elegymythos, licensed under the MIT license. It parses question files into processable structures, selects questions on demand, and generates .docx and .html exam papers. The intelligent engine part performs feature extraction, clustering, vector retrieval, and diversity reranking locally.
Core Features¶
Basic Exam Generation¶
- Automatically parse
.doc/.docx/.pdf/.txt/.mdquestion files. - Identify question types such as multiple choice, fill-in-the-blank, true/false, problem-solving, and essays.
- Extract the question stem, options, and associated images; images do not process content, only retaining position association and
has_imagemarkers. - Support
WMF/EMFformula images: DOCX output fills in the content type, while HTML output automatically converts to PNG preview. - Select questions on demand and generate
.docx+.htmlexam papers. - Support exam configurations such as cover pages, writing gaps, and dual-column multiple-choice questions.
Intelligent Engine¶
- Multi-view feature extraction: text, classification, structure, statistics.
- HDBSCAN auto-clustering, supports outlier detection and clustering explanation reports.
- FAISS vector index and cosine similarity retrieval.
- Category hard filter + vector recall + MMR diversity reranking.
- Provides
index_question_bankandsmart_select_questionstools. - Provides CLI and Python API for local intelligent indexing, clustering, retrieval, and selection.
- Supports versioned evaluation tools and local Ollama token consumption evaluation.
Installation and Activation¶
The plugin depends on @deepseek-ai/dsh-tools >=0.1.0-rc.0. When installing via the DSH plugin method, you can use the bundle command provided by the repository:
dsh plugin --profile <name> add "github:<owner>/exam-paper-plugin"
<name> is the profile name and <owner> is the repository owner; replace according to your actual environment.
The intelligent engine dependencies are concentrated in requirements.txt. The installation script defaults to creating a .venv to isolate Python dependencies. If the intelligent engine dependencies are not installed, the original parse_question_file / generate_exam_paper can still be used.
Typical Usage¶
Basic Exam Generation¶
After uploading or specifying question files, you can talk to Harness:
解析 /path/to/数学试卷.docx 里的题目
Continue to specify selection and generation parameters:
要第 1、3、5 题,标题「数学单元测验(一)」,解答题留 8 行横线
This step generates a printable exam paper based on the specified questions, with output including .docx and .html.
Intelligent Question Selection¶
Intelligent selection uses the index_question_bank and smart_select_questions tools. Talk to Harness:
用智能抽题从这些文件里选 5 道数学函数题
The process will first build a local index, then execute category hard filter, vector recall, and MMR diversity reranking, returning a small number of candidate questions.
CLI¶
When running the intelligent engine independently, first initialize the workspace:
python -m smart_engine.cli --workdir ./data/engine init
Import sample questions, build index and cluster:
python -m smart_engine.cli --workdir ./data/engine import data/sample/questions.json
python -m smart_engine.cli --workdir ./data/engine build-index
python -m smart_engine.cli --workdir ./data/engine cluster
Retrieval and selection:
python -m smart_engine.cli --workdir ./data/engine search --query "二次函数" --top-k 5
python -m smart_engine.cli --workdir ./data/engine select --query "二次函数" --count 3
Versioned evaluation and local Ollama token evaluation:
python -m smart_engine.cli --workdir ./data/engine eval quick
python -m smart_engine.cli --workdir ./data/engine eval token --model deepseek-r1:1.5b --sample-questions 20 --num-ctx 16384
Applicable Scenarios and Notes¶
Suitable for DSH users who maintain question banks locally, need to convert Word/PDF questions into printable exams, and wish to reduce the full question bank entering the large model context.
Note a few points before use:
- The plugin runs with the permissions of the current
dshprocess. You should check the source code and license before installing. - Images only retain position association and
has_imagemarkers; image content is not processed. - The intelligent engine does not introduce a difficulty dimension.
- The basic parsing engine continues to have zero third-party dependencies; intelligent engine dependencies are concentrated in
requirements.txtand are isolated by default via.venv. - Real exam papers and large files are suggested to be placed under
data/, but are excluded by.gitignore; intelligent engine runtime data is located indata/engine*/or the session workspace.exam-paper/, and is also not committed.
Conclusion¶
exam-paper-plugin handles “parsing questions, selecting questions, and generating printable exams” within a local plugin, and uses the intelligent engine for indexing, clustering, retrieval, and diversity reranking. It is suitable as a foundational capability for the DSH exam generation process. You can find it in the DeepSeek Harness community directory by searching exam-paper-plugin, or visit the GitHub repository: