Flows
Flow resource
Access flows through client.flows in the Vi SDK.
Flows represent training workflows that define how models are trained, including dataset configuration, model architecture, hyperparameters, and training schedules. Flows can be executed to create training runs.
Prerequisites
- Vi SDK installed with authentication configured
- A training project with workflows created
- Understanding of training workflows and runs
Methods
list()
List all training workflows in your organization.
# Basic listing
flows = client.flows.list()
for flow in flows.items:
print(f"Flow: {flow.flow_id}")
print(f"Created: {flow.metadata.time_created}")# Iterate through all pages with details
for page in client.flows.list():
for flow in page.items:
print(f"Flow: {flow.flow_id}")
print(f" Name: {flow.spec.name}")
print(f" Created: {flow.metadata.time_created}")
print(f" Blocks: {len(flow.spec.blocks)}")# Find recent flows (last 7 days)
from datetime import datetime, timedelta
cutoff = (datetime.now() - timedelta(days=7)).timestamp() * 1000
recent_flows = []
for page in client.flows.list():
for flow in page.items:
if flow.metadata.time_created > cutoff:
recent_flows.append(flow)
print(f"Found {len(recent_flows)} recent flows")# Collect all flows
all_flows = list(client.flows.list().all_items())
print(f"Total flows: {len(all_flows)}")Parameters:
| Parameter | Type | Description | Default |
|---|---|---|---|
pagination | PaginationParams | Pagination settings | None |
Returns: PaginatedResponse[Flow]
get()
Get a specific training flow.
# Basic usage
flow = client.flows.get("flow_abc123")
print(f"Flow ID: {flow.flow_id}")
print(f"Name: {flow.spec.name}")
print(f"Blocks: {len(flow.spec.blocks)}")# Display detailed information
flow = client.flows.get("flow_abc123")
flow.info() # Prints formatted flow summary# Inspect flow blocks
flow = client.flows.get("flow_abc123")
print(f"Flow: {flow.spec.name}")
print(f"Blocks ({len(flow.spec.blocks)}):")
for i, block in enumerate(flow.spec.blocks, 1):
print(f" {i}. {block.block}")
if block.settings:
for key, value in list(block.settings.items())[:3]:
print(f" {key}: {value}")# Access flow settings
flow = client.flows.get("flow_abc123")
# Global settings
print("Global Settings:")
for key, value in flow.spec.settings.items():
print(f" {key}: {value}")
# Tolerations
print("\nTolerations:")
for key, values in flow.spec.tolerations.items():
print(f" {key}: {values}")# Access specific properties
flow = client.flows.get("flow_abc123")
print(f"Organization: {flow.organization_id}")
print(f"Schema: {flow.spec.schema}")
print(f"ETag: {flow.etag}")
if flow.spec.training_project:
print(f"Training Project: {flow.spec.training_project}")Parameters:
| Parameter | Type | Description |
|---|---|---|
flow_id | str | Flow identifier |
Returns: Flow
delete()
Delete a training flow.
# Delete a flow
deleted = client.flows.delete("flow_abc123")# Delete with confirmation
flow = client.flows.get("flow_abc123")
print(f"About to delete flow: {flow.spec.name}")
print(f" Blocks: {len(flow.spec.blocks)}")
confirm = input("Delete? (yes/no): ")
if confirm.lower() == "yes":
client.flows.delete("flow_abc123")
print("Deleted.")Parameters:
| Parameter | Type | Description |
|---|---|---|
flow_id | str | Flow identifier |
Returns: DeletedFlow
Response types
Flow
Main flow response object.
from vi.api.resources.flows.responses import Flow| Property | Type | Description |
|---|---|---|
organization_id | str | Organization ID |
flow_id | str | Unique identifier |
spec | FlowSpec | Flow specification |
metadata | ResourceMetadata | Metadata |
self_link | str | API link |
etag | str | Entity tag |
Methods:
| Method | Returns | Description |
|---|---|---|
info() | None | Display formatted flow information |
FlowSpec
from vi.api.resources.flows.responses import FlowSpec| Property | Type | Description |
|---|---|---|
name | str | Display name |
schema | str | Schema version identifier |
tolerations | dict[str, list[str]] | Toleration rules |
settings | dict[str, Any] | Global settings |
blocks | list[FlowBlock] | Pipeline blocks |
training_project | str | None | Training project/dataset ID |
FlowBlock
from vi.api.resources.flows.responses import FlowBlock| Property | Type | Description |
|---|---|---|
block | str | Block type identifier |
settings | dict[str, Any] | Block-specific settings |
style | dict[str, Any] | UI/display styling |
Related resources
- Create a workflow — Manual guide to creating training workflows
- Manage workflows — Rename, duplicate, and delete workflows
- Train a model — Learn about configuring training with workflows
- Runs API — Execute training runs from workflows
- Vi SDK getting started — Quick start guide for the Vi SDK
- API resources — Complete SDK reference documentation
- Datasets API — Manage datasets for training
- Models API — Download and manage trained models
- Organizations API — Access organization information
Need help?
We're here to support your VLMOps journey. Reach out through any of these channels:
Updated about 1 month ago
