deepstream-generate-pipeline
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDeepStream Pipeline Builder
DeepStream 管道构建器
Generate ready-to-run pipelines for NVIDIA DeepStream SDK by collecting pipeline requirements through an interactive questionnaire, then assembling the pipeline using a standalone BM25 retrieval backend with structural metadata boosting (similarity search over 270+ verified pipelines, zero external dependencies).
gst-launch-1.0通过交互式问卷收集管道需求,然后使用独立的BM25检索后端(结合结构化元数据增强,对270+已验证管道进行相似度搜索,无外部依赖)组装管道,为NVIDIA DeepStream SDK生成可直接运行的管道。
gst-launch-1.0Prerequisites
前提条件
- Python: 3.8+ (stdlib only — no pip packages required)
- DeepStream SDK: Installed at (for
/opt/nvidia/deepstream/deepstream/validation and element verification)gst-inspect-1.0 - GStreamer: and
gst-launch-1.0ongst-inspect-1.0(installed with DeepStream)PATH - Platform: x86 dGPU (T4, A100, L40, RTX, etc.) or aarch64 — Jetson (Orin, Xavier, Nano) / SBSA (Grace, GH200)
- Python: 3.8+(仅需标准库——无需pip包)
- DeepStream SDK: 安装在路径下(用于
/opt/nvidia/deepstream/deepstream/验证和元素校验)gst-inspect-1.0 - GStreamer: 和
gst-launch-1.0已添加到gst-inspect-1.0(随DeepStream一同安装)PATH - 平台: x86独立GPU(T4、A100、L40、RTX等)或aarch64架构——Jetson(Orin、Xavier、Nano)/ SBSA(Grace、GH200)
Usage Examples
使用示例
text
undefinedtext
undefinedFully specified — skips most questions
完全指定需求——跳过大部分问题
detect and track on 4 rtsp streams and display on jetson
detect and track on 4 rtsp streams and display on jetson
Partially specified — asks remaining questions
部分指定需求——询问剩余问题
give me a pipeline to infer on an image
give me a pipeline to infer on an image
Minimal — asks all 7 questions
最小化需求——询问全部7个问题
build a pipeline
undefinedbuild a pipeline
undefinedSupported Configurations
支持的配置
| Parameter | Options |
|---|---|
| Input | Local video (.mp4/.h264/.h265), local image (.jpg/.png), RTSP stream, USB camera, test pattern |
| Inference | None, primary (nvinfer), primary+secondary, with preprocessor, Triton (nvinferserver) |
| Tracker | None, NvDCF, IOU, NvSORT, DeepSORT |
| Sink | Display (dGPU/Jetson), save (JPG/PNG/MP4/H264), RTSP out, fakesink |
| Platform | x86 dGPU (T4, A100, L40, RTX, etc.) or aarch64 — Jetson (Orin, Xavier, Nano) / SBSA (Grace, GH200) |
| Extras | Resize, rotate/flip, crop, color format conversion |
| 参数 | 选项 |
|---|---|
| Input | 本地视频(.mp4/.h264/.h265)、本地图像(.jpg/.png)、RTSP流、USB摄像头、测试图案 |
| Inference | 无、主推理(nvinfer)、主+副推理、带预处理器、Triton(nvinferserver) |
| Tracker | 无、NvDCF、IOU、NvSORT、DeepSORT |
| Sink | 显示(独立GPU/Jetson)、保存(JPG/PNG/MP4/H264)、RTSP输出、fakesink |
| Platform | x86独立GPU(T4、A100、L40、RTX等)或aarch64架构——Jetson(Orin、Xavier、Nano)/ SBSA(Grace、GH200) |
| Extras | 缩放、旋转/翻转、裁剪、颜色格式转换 |
Scripts
脚本说明
| Script | Purpose |
|---|---|
| BM25 retrieval engine — scores and ranks pipelines from |
| 4-stage validator: syntax, elements, properties, live parse. Supports |
| Data quality linter for the pipeline CSV ( |
| 脚本 | 用途 |
|---|---|
| BM25检索引擎——对 |
| 四阶段验证器:语法校验、元素校验、属性校验、实时解析。支持 |
| 管道CSV的数据质量检查器( |
Workflow
工作流程
Step 1 — Collect Pipeline Requirements
步骤1 — 收集管道需求
You MUSTbefore doing this step. It contains the query-inference table, compound-extraction examples, the fullRead references/requirement-extraction.mdquestion bank (with the default-first ordering contract), the automatic-OSD and extras/flip-method rules, and the dynamic question-reduction examples that this step depends on. Apply them exactly.AskUserQuestion
Order of operations:
- Infer everything you can from the query using the inference table in . The goal is to identify which of the 7 parameters (input source, num sources, inference, tracker, sink, platform, extras) the user has already specified.
references/requirement-extraction.md - Ask the user about the unknowns via in a single call. Do not silently default tracker/sink/platform/extras — these are real choices the user should make explicitly (display vs save, no tracker vs NvDCF, x86 dGPU vs aarch64 Jetson/SBSA, etc.). Skip only the questions whose answer is already clear from the query.
AskUserQuestion - Quote the inferred parameters back to the user in the lead-in to the question call so they can see what you already extracted. Example: "From your query I have: 3 mp4 videos, primary inference. Just need a few more details:"
Follow the inference table, question bank, and OSD/extras rules in
to decide which questions to ask and how to
place transform elements, then proceed to Step 2.
references/requirement-extraction.md执行此步骤前必须阅读。 该文件包含查询推理表、复合提取示例、完整的references/requirement-extraction.md问题库(含默认优先顺序约定)、自动OSD和附加功能/翻转方法规则,以及此步骤依赖的动态问题简化示例。请严格遵循这些规则。AskUserQuestion
操作顺序:
- 从查询中推断所有可获取的信息,使用中的推理表。目标是识别用户已指定的7个参数(输入源、源数量、推理类型、跟踪器、输出端、平台、附加功能)。
references/requirement-extraction.md - 通过一次调用询问用户未知参数。请勿默认跟踪器/输出端/平台/附加功能的选项——这些是用户应明确选择的实际选项(显示 vs 保存、无跟踪器 vs NvDCF、x86独立GPU vs aarch64 Jetson/SBSA等)。仅跳过从查询中已明确答案的问题。
AskUserQuestion - 在提问前向用户复述已推断的参数,以便用户确认已提取的信息。示例:“从您的查询中我已获取:3个mp4视频、主推理。还需要以下几个细节:”
遵循中的推理表、问题库和OSD/附加功能规则,确定要询问的问题以及如何放置转换元素,然后进入步骤2。
references/requirement-extraction.mdStep 2 — Build the Natural Language Query
步骤2 — 构建自然语言查询
From the user's answers, construct a single descriptive query string. Follow this pattern:
text
Please provide a GStreamer pipeline that [operation] on [num_sources] [input_type] [input_detail] [tracker_detail] and [output_action] [platform_detail]Examples of constructed queries:
| User Selections | Constructed Query |
|---|---|
| Local video, 1 source, Primary detector, No tracker, Display, dGPU | "Please provide a GStreamer pipeline that performs primary inference on a single mp4 video and displays the output" |
| RTSP, 4 sources, Primary+Secondary, NvDCF, Save MP4, dGPU | "Please provide a GStreamer pipeline that performs primary and secondary inference with NvDCF tracker on 4 RTSP streams and saves output to MP4 file" |
| Local video, 2 sources, Primary with preprocessor, IOU, Display, Jetson | "Please provide a GStreamer pipeline that performs preprocessing before primary inference with IOU tracker on 2 mp4 streams and displays the output on Jetson" |
| Local image, 1 source, None, No tracker, Save file, dGPU, Rotate 90° cw | "Please provide a GStreamer pipeline that rotates a single jpg image 90° clockwise before processing and saves it to a file" |
| Local video, 3 sources, Primary detector, NvDCF, Save MP4, dGPU, Rotate 180° | "Please provide a GStreamer pipeline that rotates 3 mp4 videos 180° before primary inference with NvDCF tracker and saves output to MP4 file" |
根据用户的回答,构造一个单一的描述性查询字符串。遵循以下格式:
text
Please provide a GStreamer pipeline that [operation] on [num_sources] [input_type] [input_detail] [tracker_detail] and [output_action] [platform_detail]构造查询示例:
| 用户选择 | 构造的查询 |
|---|---|
| 本地视频、1个源、主检测器、无跟踪器、显示、独立GPU | "Please provide a GStreamer pipeline that performs primary inference on a single mp4 video and displays the output" |
| RTSP、4个源、主+副推理、NvDCF、保存为MP4、独立GPU | "Please provide a GStreamer pipeline that performs primary and secondary inference with NvDCF tracker on 4 RTSP streams and saves output to MP4 file" |
| 本地视频、2个源、带预处理器的主推理、IOU、显示、Jetson | "Please provide a GStreamer pipeline that performs preprocessing before primary inference with IOU tracker on 2 mp4 streams and displays the output on Jetson" |
| 本地图像、1个源、无推理、无跟踪器、保存文件、独立GPU、顺时针旋转90° | "Please provide a GStreamer pipeline that rotates a single jpg image 90° clockwise before processing and saves it to a file" |
| 本地视频、3个源、主检测器、NvDCF、保存为MP4、独立GPU、旋转180° | "Please provide a GStreamer pipeline that rotates 3 mp4 videos 180° before primary inference with NvDCF tracker and saves output to MP4 file" |
Step 3 — Run the Pipeline Generator Script
步骤3 — 运行管道生成脚本
Execute the backend script with the constructed query and user parameters:
bash
python3 <skill-path>/scripts/generate_pipeline.py \
--query "<constructed_query>" \
--source-type "<Local video file|Local image file|RTSP stream|USB camera|Test pattern>" \
--num-sources <N> \
--inference "<None|primary|primary+secondary|primary+preprocess|primary+secondary+preprocess|primary-triton|primary+secondary-triton>" \
--tracker "<none|NvDCF|IOU|NvSORT|DeepSORT>" \
--sink "<display|display-jetson|save-jpg|save-png|save-mp4|save-h264|rtsp-out|fakesink>" \
--platform "<dGPU|Jetson|SBSA>" \
--extras "<none|resize|rotate|crop|color-convert|osd>" \
--format compactAlways pass. The--format compactmode returns only confidence + the top retrieved pipeline (~25 lines), instead of dumping all 10 retrievals as ~150 lines of JSON in the chat. Thecompactmode (default for backward compat) is only useful when debugging the retriever directly. Ajsonmode (single human-readable line) also exists for non-Claude callers.summary
The script will (zero external dependencies — pure Python stdlib):
- Load the pipeline dataset (270+ verified DeepStream pipelines)
- Extract structural metadata from each pipeline (platform, source type, sink type, inference mode, tracker, stream count)
- Score with BM25 (document-length-normalized) + domain-specific synonym expansion on both queries and documents
- Apply structural boosting — results matching the user's platform/source/sink/inference get boosted, mismatches get penalized
- Return the top-K results as JSON with a field (
confidence/high/medium) based on the top scorelow - Claude uses these retrieved examples + the assembly rules below to construct the final pipeline
When is , rely more heavily on the assembly rules below rather than the retrieved examples.
confidencelow使用构造的查询和用户参数执行后端脚本:
bash
python3 <skill-path>/scripts/generate_pipeline.py \
--query "<constructed_query>" \
--source-type "<Local video file|Local image file|RTSP stream|USB camera|Test pattern>" \
--num-sources <N> \
--inference "<None|primary|primary+secondary|primary+preprocess|primary+secondary+preprocess|primary-triton|primary+secondary-triton>" \
--tracker "<none|NvDCF|IOU|NvSORT|DeepSORT>" \
--sink "<display|display-jetson|save-jpg|save-png|save-mp4|save-h264|rtsp-out|fakesink>" \
--platform "<dGPU|Jetson|SBSA>" \
--extras "<none|resize|rotate|crop|color-convert|osd>" \
--format compact务必传递参数。--format compact模式仅返回置信度和排名第一的检索管道(约25行),而非在聊天中输出所有10个检索结果的约150行JSON。compact模式(为向后兼容设为默认)仅在调试检索器时有用。还有一种json模式(单行人类可读格式)供非Claude调用者使用。summary
该脚本将(无外部依赖——纯Python标准库):
- 加载管道数据集(270+已验证的DeepStream管道)
- 从每个管道中提取结构化元数据(平台、源类型、输出端类型、推理模式、跟踪器、流数量)
- 使用BM25(文档长度归一化)+ 领域特定同义词扩展对查询和文档进行评分
- 应用结构化增强——匹配用户平台/源/输出端/推理的结果会被提升,不匹配的结果会被惩罚
- 返回前K个结果的JSON,基于最高得分带有字段(
confidence/high/medium)low - Claude使用这些检索示例 + 以下组装规则构建最终管道
当为时,更多依赖以下组装规则而非检索示例。
confidencelowStep 4 — Validate the Pipeline
步骤4 — 验证管道
Before presenting, run the validation script to catch syntax errors, unknown elements, and linking issues:
bash
python3 <skill-path>/scripts/validate_pipeline.py "<assembled_pipeline>" --format summaryAlways pass. Summary prints a single status line (e.g.--format summary), with errors/warnings indented underneath only if present. The defaultvalid · 11 elements · 0 warnings · live-parse skipped (multi-stream)mode emits ~40 lines of structured output and is only useful for programmatic callers.json
The validator performs 4 checks:
- Syntax check — unbalanced quotes, empty pipe segments, missing source/sink
- Element check — verifies each element exists via
gst-inspect-1.0 - Property check — validates known properties for DeepStream elements
- Live parse check — uses itself to construct the pipeline graph (with fakesrc/fakesink substituted), catching linking errors and pad mismatches. Automatically skipped for multi-stream pipelines (those with named pad refs like
gst-launch-1.0) since fakesrc cannot negotiate caps through named pads.m.sink_0
If validation fails (), fix the errors and re-validate before presenting. Limit validation retries to a maximum of 2 attempts — if the pipeline still fails after 2 fixes, present it as-is (the remaining checks already cover syntax, element, property, and structural correctness). If there are only warnings, present the pipeline but mention the warnings to the user.
"valid": false在呈现管道前,运行验证脚本以捕获语法错误、未知元素和链接问题:
bash
python3 <skill-path>/scripts/validate_pipeline.py "<assembled_pipeline>" --format summary务必传递参数。Summary模式打印单行状态信息(例如--format summary),仅在存在错误/警告时才会在下方显示缩进的错误/警告信息。默认的valid · 11 elements · 0 warnings · live-parse skipped (multi-stream)模式会输出约40行结构化输出,仅对程序调用者有用。json
验证器执行4项检查:
- 语法检查——引号不匹配、空管道段、缺少源/输出端
- 元素检查——通过验证每个元素是否存在
gst-inspect-1.0 - 属性检查——验证DeepStream元素的已知属性
- 实时解析检查——使用本身构建管道图(替换为fakesrc/fakesink),捕获链接错误和pad不匹配问题。多流管道(带有命名pad引用如
gst-launch-1.0)会自动跳过此检查,因为fakesrc无法通过命名pad协商caps。m.sink_0
如果验证失败(),修复错误后重新验证。验证重试最多限制为2次——如果经过2次修复后管道仍失败,则按原样呈现(剩余检查已覆盖语法、元素、属性和结构正确性)。如果仅存在警告,呈现管道时需向用户提及警告信息。
"valid": falseStep 5 — Present the Pipeline
步骤5 — 呈现管道
5.1 — Output format (THE ONLY ACCEPTED FORM)
5.1 — 输出格式(唯一可接受的形式)
Your response must be exactly five blocks, in this order:
- One-line status badge (validation + confidence)
- Single bash code block containing the full command with concrete absolute paths, on one line (no
gst-launch-1.0 -e …continuations, no shell variables, no shell wrapper)\ - Breakdown table grouped by stage
- Suggestions bullet list
- (only if pre-flight failed) a line above the status badge stating which default path is missing
⚠
That is the ONLY accepted output shape for this step. The Section 5.3 template in is the literal template — match it.
references/output-format.md您的回复必须严格按照以下顺序包含五个模块:
- 单行状态标识(验证结果 + 置信度)
- 单个bash代码块,包含完整的命令,使用具体的绝对路径,且仅一行(无
gst-launch-1.0 -e …换行符、无shell变量、无shell包装器)\ - 按阶段分组的分解表
- 建议项目符号列表
- (仅当预检查失败时)在状态标识上方添加一行,说明缺失的默认路径
⚠
这是此步骤唯一可接受的输出格式。中的第5.3节模板是字面模板——请严格匹配。
references/output-format.md5.2 — Pre-flight check (run before composing the response)
5.2 — 预检查(在撰写回复前运行)
Run one over the default paths the pipeline will reference (sample video, PGIE config, tracker lib/config). The result tells you whether to mark the badge with and bump the matching "Use your own …" suggestion to the top.
Bashls⚠ default path not found: <path>bash
ls /opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 \
/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_infer_primary.txt \
2>&1对管道将引用的默认路径(示例视频、PGIE配置、跟踪器库/配置)运行一次Bash命令。结果将告知您是否需要在标识上标记,并将对应的“使用您自己的……”建议移至顶部。
ls⚠ default path not found: <path>bash
ls /opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 \
/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_infer_primary.txt \
2>&15.3 / 5.4 — Worked example & forbidden anti-patterns
5.3 / 5.4 — 示例与禁用的反模式
You MUSTbefore composing this response. It contains the literal Section 5.3 template your output must match exactly, and the Section 5.4 gallery of forbidden output shapes (heredoc wrappers, shell-var indirection,Read references/output-format.mdline-continuations, stray "Run it" lines,\-to-script). Mirror Section 5.3; never emit any Section 5.4 form.Write
撰写回复前必须阅读。该文件包含您的输出必须严格匹配的第5.3节字面模板,以及第5.4节禁用的输出格式示例(heredoc包装器、shell变量间接引用、references/output-format.md换行符、多余的“Run it”行、\到脚本)。严格遵循第5.3节;绝不使用第5.4节中的任何形式。Write
5.5 — Self-check before sending the response
5.5 — 发送回复前的自检
Before you emit your reply, mentally tick each box. If any check fails, rewrite the response.
- The pipeline is on exactly one line inside a single code block.
```bash - The pipeline begins with and contains only literal absolute paths (e.g.
gst-launch-1.0 -e) — no/opt/nvidia/deepstream/..., no$VAR, no${VAR:-default}, nocat >, noEOFline continuations.\ - The response does not contain any of: ,
cat > /tmp/pipeline.sh,bash /tmp/pipeline.sh,<<'EOF'.${VAR:- - The response does not call the tool. (Save-to-file is offered as a suggestion bullet, not an action.)
Write - The breakdown table is grouped by stage (Source / Mux / Inference / Tracking / Composition / Render — adapt names to the pipeline's actual stages, e.g. add an row for file sinks).
Encode/Mux - The "Save it to a script?" line appears in the Suggestions list — never as a primary action.
在发送回复前,逐一检查以下项目。如果任何检查失败,请重写回复。
- 管道位于恰好一个代码块内,且仅一行。
```bash - 管道以开头,仅包含字面绝对路径(例如
gst-launch-1.0 -e)——无/opt/nvidia/deepstream/...、无$VAR、无${VAR:-default}、无cat >、无EOF换行符。\ - 回复不包含以下任何内容:、
cat > /tmp/pipeline.sh、bash /tmp/pipeline.sh、<<'EOF'。${VAR:- - 回复不调用工具。(保存到文件作为建议项目符号提供,而非主要操作。)
Write - 分解表按阶段分组(源 / 多路复用 / 推理 / 跟踪 / 合成 / 渲染——根据管道实际阶段调整名称,例如为文件输出端添加行)。
编码/多路复用 - “是否保存到脚本?”行出现在建议列表中——绝不作为主要操作。
5.6 — Pre-flight failure variant
5.6 — 预检查失败的变体
If the Section 5.2 reported one or more missing default paths, prepend a line above the status badge and bump the matching "Use your own …" suggestion to the top:
ls⚠markdown
⚠ default path not found: `/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4` — substitute your own video path before running
✓ Validated · 11 elements · 0 warnings · confidence: HIGH
```bash
gst-launch-1.0 -e filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 ! …
```
[breakdown + suggestions as in Section 5.3, with the "Use your own video" suggestion bumped to the top]On length: 5–8 stream pipelines run long when on a single line. That is correct and intended — chat clients render bash code blocks faithfully and copy reproduces them correctly. Long ≠ split.
如果第5.2节的命令报告一个或多个默认路径缺失,在状态标识上方添加一行,并将对应的“使用您自己的……”建议移至顶部:
ls⚠markdown
⚠ default path not found: `/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4` — 运行前请替换为您自己的视频路径
✓ Validated · 11 elements · 0 warnings · confidence: HIGH
```bash
gst-launch-1.0 -e filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 ! …
```
[分解表 + 建议与第5.3节相同,将“使用您自己的视频”建议移至顶部]关于长度: 5-8流的管道在单行中会较长。这是正确且预期的——聊天客户端会忠实地渲染bash代码块,复制时也能完整保留。长≠拆分。
Step 6 — Offer Refinement
步骤6 — 提供优化选项
After presenting the pipeline, ask the user if they want to adjust anything:
Want me to modify anything? For example:
- Change the number of streams
- Add/remove tracker or secondary inference
- Switch between display and file output
- Change the platform (x86 dGPU / aarch64 Jetson / SBSA)
If the user requests changes, go back to Step 2 with updated parameters — do NOT re-ask all 7 questions. Only ask about the specific parameter that changed, or just apply the change directly if it's clear.
呈现管道后,询问用户是否需要调整任何内容:
需要我修改任何内容吗?例如:
- 更改流数量
- 添加/移除跟踪器或副推理
- 在显示和文件输出之间切换
- 更改平台(x86独立GPU / aarch64 Jetson / SBSA)
如果用户请求更改,使用更新后的参数返回步骤2——无需重新询问所有7个问题。仅询问更改的特定参数,或如果更改明确则直接应用。
Step 6.5 — Optional: Save Pipeline to a Script
步骤6.5 — 可选:将管道保存到脚本
Only do this step when the user explicitly asks (e.g. "save it", "save to pipeline.sh", "write it to a file", "put it in ~/run.sh"). Do not create the file proactively — Step 5 always shows the concrete pipeline in chat for direct copy-paste; saving is a follow-up convenience.
-
Filename: Default toif the user just says "save it". Use the exact path the user named otherwise (e.g.
/tmp/pipeline.sh,~/run.sh).scripts/demo.sh -
File contents: Two lines — shebang + the same single-line pipeline shown in chat (concrete absolute paths, no shell vars). Keep them in sync — what the user runs from the file is bit-for-bit identical to what they could have copy-pasted.bash
#!/usr/bin/env bash gst-launch-1.0 -e filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! m.sink_0 … ! nvdsosd ! nveglglessinkUse thetool to create the file.Write -
Confirm to user with the run command:Saved to. Run it with:
<path>bashbash <path>
仅当用户明确要求时执行此步骤(例如*“保存它”、“保存到pipeline.sh”、“写入文件”、“放到~/run.sh”*)。请勿主动创建文件——步骤5始终在聊天中显示具体管道供直接复制粘贴;保存是后续的便利操作。
-
文件名: 如果用户仅说*“保存它”*,默认保存到。否则使用用户指定的精确路径(例如
/tmp/pipeline.sh、~/run.sh)。scripts/demo.sh -
文件内容: 两行——shebang + 聊天中显示的同一单行管道(具体绝对路径,无shell变量)。保持两者一致——用户从文件运行的内容与复制粘贴的内容完全相同。bash
#!/usr/bin/env bash gst-launch-1.0 -e filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! m.sink_0 … ! nvdsosd ! nveglglessink使用工具创建文件。Write -
向用户确认并提供运行命令:已保存到。运行命令:
<path>bashbash <path>
Pipeline Assembly Rules
管道组装规则
When the script is not available or fails, assemble the pipeline using the rules in references/assembly-rules.md. These rules cover source elements, multi-stream patterns, inference chains, tracker configs, sink elements, and extra operations. They also serve as validation for script output.
当脚本不可用或失败时,使用references/assembly-rules.md中的规则组装管道。这些规则涵盖源元素、多流模式、推理链、跟踪器配置、输出端元素和附加操作。它们也可作为脚本输出的验证依据。
Error Handling
错误处理
| Failure | Cause | Recovery |
|---|---|---|
| Query doesn't match any pipeline in the dataset closely | Rely on the assembly rules in this skill instead of retrieved examples |
| GStreamer/DeepStream not installed or not on | Install DeepStream SDK; confirm |
| Validation fails after 2 retries | Unusual element combination or linking issue | Present the pipeline as-is with a warning — syntax/element/property checks still passed |
Script not found at | Skill not installed correctly or path misconfigured | Verify the skill directory is symlinked into |
| 故障 | 原因 | 恢复方法 |
|---|---|---|
| 查询与数据集中的任何管道匹配度较低 | 依赖本技能中的组装规则而非检索示例 |
| GStreamer/DeepStream未安装或未添加到 | 安装DeepStream SDK;确认 |
| 经过2次重试后验证仍失败 | 不常见的元素组合或链接问题 | 按原样呈现管道并附带警告——语法/元素/属性检查已通过 |
脚本未在 | 技能安装不正确或路径配置错误 | 验证技能目录已链接到 |
Testing
测试
Run the test suite to verify retrieval quality and validator correctness:
bash
python3 -m unittest discover -s <skill-path>/tests -vThe suite includes:
- Unit tests for the BM25 retriever (tokenizer, synonym expansion, metadata extraction, scoring)
- Unit tests for the validator (syntax, structure, property, named-pad checks)
- Golden regression tests — 20+ query→expected-result pairs ensuring retrieval quality doesn't regress
- Data quality linter — checks the CSV for duplicates, syntax issues, and structural bugs:
bash
python3 <skill-path>/scripts/lint_data.py # report issues
python3 <skill-path>/scripts/lint_data.py --fix # auto-fix and overwrite运行测试套件以验证检索质量和验证器正确性:
bash
python3 -m unittest discover -s <skill-path>/tests -v测试套件包括:
- 单元测试:BM25检索器(分词器、同义词扩展、元数据提取、评分)
- 单元测试:验证器(语法、结构、属性、命名pad检查)
- 黄金回归测试——20+查询→预期结果对,确保检索质量不会退化
- 数据质量检查器——检查CSV中的重复项、语法问题和结构错误:
bash
python3 <skill-path>/scripts/lint_data.py # 报告问题
python3 <skill-path>/scripts/lint_data.py --fix # 自动修复并覆盖Security, Limitations & Notes
安全、限制与注意事项
Security posture, known limitations, and operational notes are documented in . Read that file when you need details on subprocess safety, input validation, platform/SDK requirements, the multi-stream dry-run caveat, or sample-path/config-file reminders.
references/security-and-limitations.md安全策略、已知限制和操作注意事项记录在中。当您需要了解子进程安全、输入验证、平台/SDK要求、多流试运行注意事项或示例路径/配置文件提醒的详细信息时,请阅读该文件。
references/security-and-limitations.md