vipr_api.web.routers.inference package

Submodules

vipr_api.web.routers.inference.export module

CLI Configuration Export Router.

Provides endpoint to export frontend configuration as CLI-compatible YAML with semantic result_id (config_name + UUID) for traceability.

async vipr_api.web.routers.inference.export.export_cli_yaml(config: VIPRConfigWithStreaming) StreamingResponse

Export frontend configuration as CLI-compatible YAML file.

Generates semantic result_id: config_name + short_uuid for: - Human readability: “PTCDI-C3_XRR_a1b2c3d4” - Uniqueness: UUID prevents collisions - Traceability: Config name is part of the ID

Parameters:

config – VIPRInference containing VIPR configuration

Returns:

YAML file download with semantic filename

Return type:

StreamingResponse

Raises:

HTTPException – If export fails

vipr_api.web.routers.inference.tasks module

Generic Inference Task Management Router.

This router handles domain-agnostic task-related endpoints for VIPR inference: - /run - Start inference task - /progress/{task_id} - Get task progress - /cancel/{task_id} - Cancel running task - /health - Check Celery backend health

async vipr_api.web.routers.inference.tasks.cancel_task(task_id: str) dict[str, Any]

Cancel a running VIPR inference task.

Parameters:

task_id – Unique identifier of the Celery task to cancel

Returns:

Dict containing cancellation status

Raises:

HTTPException – If cancellation fails

vipr_api.web.routers.inference.tasks.check_celery_backend() tuple[bool, CeleryExecutionMode, str | None]

Check if Celery can execute tasks.

Returns:

Tuple of (can_execute, mode, error_message) - can_execute: Whether tasks can be executed - mode: CeleryExecutionMode (EAGER or ASYNC) - error_message: Error message if can_execute is False, None otherwise

async vipr_api.web.routers.inference.tasks.get_task_progress(task_id: str) TaskProgressResponse

Get progress of a running VIPR inference task.

Parameters:

task_id – Unique identifier of the Celery task

Returns:

TaskProgressResponse containing task status, progress, and results

Raises:

HTTPException – If task not found or invalid

async vipr_api.web.routers.inference.tasks.health_check() HealthCheckResponse

Health check endpoint for Celery backend status.

Returns information about: - Celery execution mode (eager/async) - Whether tasks can be executed - Redis availability (for async mode) - Helpful error messages if service is unavailable

Returns:

HealthCheckResponse containing health status information

async vipr_api.web.routers.inference.tasks.run_inference_async(config: VIPRInference) dict[str, Any]

Run VIPR inference using Celery background tasks.

This is a generic, domain-agnostic endpoint that validates configuration against the registry before starting a Celery task. Provides defense against malicious configs and ensures only registry-approved hooks/filters are used.

Parameters:

config – VIPRInference containing VIPR configuration

Returns:

Dict containing task_id for progress tracking

Raises:

HTTPException – If configuration validation fails or task creation fails

Module contents

Generic Inference Router Module.

This package contains domain-agnostic VIPR inference endpoints: - tasks.py: Task management endpoints (run, progress, cancel, health) - export.py: CLI configuration export endpoint