AI & Content Workflows
AI workflows provide unified interfaces to text generation and embeddings with automatic provider fallback routing.
Text Generation
Section titled “Text Generation”Workflow: ai/generate
Unified text generation with automatic fallback: Fabric API, then Gemini, then OpenAI.
fabric run ai/generate \ --input prompt="Explain quantum computing in simple terms" \ --input model="gemini-2.5-flash"curl -X POST "$FABRIC_URL/v1/workflows/run?name=ai/generate" \ -H "Authorization: Bearer $FABRIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": { "prompt": "Explain quantum computing in simple terms", "model": "gemini-2.5-flash" } }'| Parameter | Type | Default | Description |
|---|---|---|---|
prompt | string | required | Input prompt |
model | string | resolved | Model identifier |
provider | string | "auto" | Force provider: auto, gemini, openai, fabric |
system_prompt | string | "" | System instruction |
temperature | float | 0.7 | Sampling temperature |
max_tokens | int | model default | Max output tokens |
Output
Section titled “Output”{ "response": "Quantum computing uses quantum bits (qubits)...", "usage": {"input_tokens": 12, "output_tokens": 150}, "provider_used": "gemini", "model_used": "gemini-2.5-flash"}Embeddings
Section titled “Embeddings”Workflow: ai/embeddings
Generate vector embeddings for text. Used internally by problem intelligence clustering, hook clustering, and search.
fabric run ai/embeddings \ --input texts='["first document", "second document"]'curl -X POST "$FABRIC_URL/v1/workflows/run?name=ai/embeddings" \ -H "Authorization: Bearer $FABRIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": { "texts": ["first document", "second document"] } }'| Parameter | Type | Default | Description |
|---|---|---|---|
texts | string or list[str] | required | Text(s) to embed |
embedding_model | string | "auto" | Model: auto, specific model ID |
Output
Section titled “Output”{ "embeddings": [[0.012, -0.034, ...], [0.045, 0.023, ...]], "model_used": "text-embedding-3-small"}Fallback chain: Fabric API, then OpenAI, then local sentence-transformers.
Vision Analysis
Section titled “Vision Analysis”Workflow: ai/vision
Analyze images using local Moondream or cloud Gemini — captioning, visual QA, object detection, and asset tagging. Uses the vision model operation, so quality=prefer-local uses Moondream (free, offline) and quality=standard uses Gemini.
# Caption + tags (default)fabric run ai/vision \ --input image_path="photo.jpg"
# Visual question answeringfabric run ai/vision \ --input image_path="photo.jpg" \ --input question="How many people are in this image?"
# Multiple operations with local modelfabric run ai/vision \ --input image_path="photo.jpg" \ --input 'vision_operations=["caption","tags","detect:person"]' \ --input quality=prefer-localcurl -X POST "$FABRIC_URL/v1/workflows/run?name=ai/vision" \ -H "Authorization: Bearer $FABRIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": { "image_path": "photo.jpg", "vision_operations": ["caption", "tags", "detect:person"] } }'| Parameter | Type | Default | Description |
|---|---|---|---|
image_path | string | required | Path to image file |
vision_operations | list[str] | ["caption", "tags"] | Operations: caption, tags, detect:<object>, query:<question> |
vision_question | string | null | Shorthand for a single visual QA question |
quality | string | "standard" | prefer-local for Moondream, standard/premium for Gemini |
Operations
Section titled “Operations”caption— Generate a scene descriptiontags— Extract searchable tags (objects, scenes, colors, emotions)detect:<object>— Object detection with bounding boxes (local Moondream only)query:<question>— Visual question answering
Output
Section titled “Output”{ "caption": "A bright living room with two people sitting on a beige sofa...", "tags": ["living room", "person", "sofa", "warm lighting", "indoor"], "detections": [ {"object": "person", "bbox": {"x_min": 0.12, "y_min": 0.3, "x_max": 0.45, "y_max": 0.9}} ], "answers": [ {"question": "How many people?", "answer": "2"} ], "model_used": "moondream-2b"}Vision models
Section titled “Vision models”| Quality | Model | Cost | Notes |
|---|---|---|---|
local / prefer-local / free | moondream-2b | Free | Local inference, ~2-5s/image on CPU |
standard / premium | gemini-2.5-flash | ~$0.001/image | Cloud API, faster, better for subjective analysis |
Install local vision: pip install -e "sdks/fabric-workflow-sdk[local-vision]"
Content Generation
Section titled “Content Generation”Workflow: content/generate
Analyzes a topic, generates structured content, and evaluates quality.
fabric run content/generate \ --input topic="The future of remote work" \ --input content_type="blog post" \ --input audience="tech professionals"curl -X POST "$FABRIC_URL/v1/workflows/run?name=content/generate" \ -H "Authorization: Bearer $FABRIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": { "topic": "The future of remote work", "content_type": "blog post", "audience": "tech professionals" } }'Pipeline
Section titled “Pipeline”analyze_topic → generate_content → evaluate_quality| Parameter | Type | Default | Description |
|---|---|---|---|
topic | string | required | Content topic |
audience | string | "" | Target audience |
content_type | string | "blog post" | Format: blog post, email, social, video script |
Output
Section titled “Output”{ "analysis": { "key_points": [...], "angles": [...] }, "generated_content": { "title": "...", "content": "Full article text...", "meta_description": "...", "tags": ["remote-work", "productivity"] }, "quality_evaluation": { "score": 8.5, "improvements": [...] }}YouTube Workflows
Section titled “YouTube Workflows”Title Generation
Section titled “Title Generation”Workflow: youtube/titles
Generates 10 viral title options with CTR estimation and style diversity.
fabric run youtube/titles \ --input topic="AI coding assistants" \ --input niche="tech"curl -X POST "$FABRIC_URL/v1/workflows/run?name=youtube/titles" \ -H "Authorization: Bearer $FABRIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": { "topic": "AI coding assistants", "niche": "tech" } }'Thumbnail Generation
Section titled “Thumbnail Generation”Workflow: image/generate
Platform-specific thumbnails with native text rendering.
fabric run image/generate \ --input selected_title="Why AI Can't Replace Developers" \ --input platform="youtube"curl -X POST "$FABRIC_URL/v1/workflows/run?name=image/generate" \ -H "Authorization: Bearer $FABRIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": { "selected_title": "Why AI Can't Replace Developers", "platform": "youtube" } }'Aspect ratios: YouTube (16:9), TikTok/Shorts (9:16), Instagram (1:1, 4:5).
Description Generation
Section titled “Description Generation”Workflow: youtube/descriptions
Auto-generates YouTube descriptions with chapter timestamps, hashtags, and CTAs from the transcript.
fabric run youtube/descriptions \ --input selected_title="Why AI Can't Replace Developers" \ --input full_text="Transcribed text..."curl -X POST "$FABRIC_URL/v1/workflows/run?name=youtube/descriptions" \ -H "Authorization: Bearer $FABRIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": { "selected_title": "Why AI Can't Replace Developers", "full_text": "Transcribed text..." } }'