Skip to content

Comments

[ViPPET] Add support for pipeline templates#1816

Draft
ktaube26 wants to merge 4 commits intomainfrom
ktaube/pipeline-templates
Draft

[ViPPET] Add support for pipeline templates#1816
ktaube26 wants to merge 4 commits intomainfrom
ktaube/pipeline-templates

Conversation

@ktaube26
Copy link
Contributor

@ktaube26 ktaube26 commented Feb 20, 2026

Description

This pull request adds pipeline template support to ViPPET, enabling users to start with pre-configured pipeline structures that include placeholders for customizable values like input sources and model paths.

Changes:

  • Added PipelineTemplateManager singleton class to load and manage read-only pipeline templates from YAML files
  • Added new API endpoints (GET /pipeline-templates and GET /pipeline-templates/{template_id}) to expose templates
  • Added TEMPLATE value to the PipelineSource enum to distinguish templates from predefined and user-created pipelines
  • Created two template YAML files: "Detect Only" and "Detect & Classify" with CPU, GPU, and NPU variants

Checklist:

  • I agree to use the APACHE-2.0 license for my code changes.
  • I have not introduced any 3rd party components incompatible with APACHE-2.0.
  • I have not included any company confidential information, trade secret, password or security token.
  • I have performed a self-review of my code.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds pipeline template support to ViPPET, enabling users to start with pre-configured pipeline structures that include placeholders for customizable values like input sources and model paths.

Changes:

  • Added PipelineTemplateManager singleton class to load and manage read-only pipeline templates from YAML files
  • Added new API endpoints (GET /pipeline-templates and GET /pipeline-templates/{template_id}) to expose templates
  • Added TEMPLATE value to the PipelineSource enum to distinguish templates from predefined and user-created pipelines
  • Created two template YAML files: "Detect Only" and "Detect & Classify" with CPU, GPU, and NPU variants

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
api/api_schemas.py Added TEMPLATE enum value to PipelineSource
api/main.py Integrated PipelineTemplateManager initialization and registered pipeline_templates router
api/routes/pipeline_templates.py Implemented GET endpoints for listing and retrieving pipeline templates
managers/pipeline_template_manager.py Implemented thread-safe singleton manager for loading and serving templates from YAML
pipelines/templates/detect-only.yaml Template with single detection model variants for CPU, GPU, and NPU
pipelines/templates/detect-and-classify.yaml Template with detection+classification variants including GPU_NPU hybrid
tests/managers_tests/pipeline_template_manager_test.py Comprehensive unit tests for PipelineTemplateManager covering singleton, loading, and validation
tests/api_tests/pipeline_templates_test.py API integration tests for template endpoints covering success and error cases
docs/user-guide/_assets/vippet.json Updated OpenAPI schema with new endpoints and modified camera schemas

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

for variant in template.variants:
self.assertIsInstance(variant.created_at, datetime)
self.assertIsInstance(variant.modified_at, datetime)
self.assertEqual(variant.created_at.tzinfo, timezone.utc)
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test checks variant.created_at.tzinfo on line 609 but doesn't verify variant.modified_at.tzinfo like it does for the template on line 604. For consistency and completeness, the test should also assert that variant.modified_at.tzinfo equals timezone.utc.

Suggested change
self.assertEqual(variant.created_at.tzinfo, timezone.utc)
self.assertEqual(variant.created_at.tzinfo, timezone.utc)
self.assertEqual(variant.modified_at.tzinfo, timezone.utc)

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +37
are stored as empty strings. Use templates as a starting point – copy the desired variant's graph,
fill in the empty properties with real values, and submit it as a new
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring incorrectly states that "Properties that require user-supplied values (e.g. input source URI, model paths) are stored as empty strings". Based on the Graph.from_pipeline_description implementation, placeholder tokens like INPUT and DETECT_MODEL are preserved in the node properties as-is, not replaced with empty strings. The documentation should be corrected to state that placeholders are preserved in the graph and must be replaced by users when creating pipelines from templates.

Suggested change
are stored as empty strings. Use templates as a starting pointcopy the desired variant's graph,
fill in the empty properties with real values, and submit it as a new
use placeholder tokens (for example, ``__INPUT__``, ``__DETECT_MODEL__``) that are
preserved in the graph. Use templates as a starting pointcopy the desired variant's
graph, replace the placeholder values with real ones, and submit it as a new

Copilot uses AI. Check for mistakes.
* source is set to TEMPLATE
* all variants are read_only=True
* placeholder tokens (__INPUT__, __DETECT_MODEL__, etc.) are
replaced with empty string values in node properties
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states that "placeholder tokens (INPUT, DETECT_MODEL, etc.) are replaced with empty string values in node properties during graph parsing", but based on the Graph.from_pipeline_description implementation, properties are stored as-is without any placeholder replacement. The placeholders will remain in the graph node properties (e.g., location=INPUT, model=DETECT_MODEL). The comment should be corrected to reflect that placeholders are preserved in the graph, not replaced with empty strings.

Suggested change
replaced with empty string values in node properties
preserved as-is in node properties; callers are responsible for
handling or replacing them if needed

Copilot uses AI. Check for mistakes.
Comment on lines +188 to +189
# Placeholder tokens (__INPUT__, __DETECT_MODEL__, etc.) are replaced
# with empty string values in node properties during graph parsing.
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the issue on lines 103-104, this comment incorrectly states that "placeholder tokens (INPUT, DETECT_MODEL, etc.) are replaced with empty string values in node properties during graph parsing". The placeholders are actually preserved in the graph node properties as-is. The comment should be corrected to accurately describe that placeholders remain in the graph.

Suggested change
# Placeholder tokens (__INPUT__, __DETECT_MODEL__, etc.) are replaced
# with empty string values in node properties during graph parsing.
# Placeholder tokens (__INPUT__, __DETECT_MODEL__, etc.) are preserved
# as-is in node properties during graph parsing.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant