ai.generate
Operation: ai.generate
Category: ai
Tags: text, llm, generation
Generate text or content via an AI provider with prompt templating
Runtime
Section titled “Runtime”Type: AI Provider (routed via provider registry)
Timeout: 300s
Retries: 3 (ExponentialWithJitter)
Inputs
Section titled “Inputs”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | String | No | — | Input prompt (or use prompt_template in config) |
Outputs
Section titled “Outputs”| Name | Type | Description |
|---|---|---|
content | String | Generated content |
finish_reason | String | Why generation stopped |
Default Configuration
Section titled “Default Configuration”{ "modality": "text"}import { WorkflowBuilder } from "@fabric-platform/sdk";
const workflow = new WorkflowBuilder("my-workflow") .node("ai-generate", "ai_invoke", (n) => n.config({ operation: "ai.generate", // ... node-specific config }) ) .build();from fabric_platform import FabricClient
fabric = FabricClient(api_key="fab_xxx")
wf_id = fabric.upsert_workflow("my-workflow", nodes=[ { "key": "ai-generate", "kind": "ai_invoke", },])use fabric_sdk::FabricClient;
let client = FabricClient::new("http://localhost:3001", api_key)?;
let wf_id = client.upsert_workflow("my-workflow", serde_json::json!({ "nodes": [{ "key": "ai-generate", "kind": "ai_invoke" }]})).await?;curl -X POST http://localhost:3001/v1/workflow-definitions \ -H "Authorization: Bearer $FABRIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "my-workflow", "nodes": [{ "key": "ai-generate", "kind": "ai_invoke" }] }'Example
Section titled “Example”{ "key": "generate-script", "operation": "ai.generate", "config": { "modality": "text", "model": "gpt-4o-mini", "prompt_template": "Write a short script about {{context.topic}}" }, "outputs": [ { "name": "content", "path": "$context.script" } ]}Common Errors
Section titled “Common Errors”ai.generate requires a prompt (via prompt_template or input.prompt)
Section titled “ai.generate requires a prompt (via prompt_template or input.prompt)”Cause: Neither prompt_template in config nor a prompt input binding was provided
Fix: Add a prompt_template to your node config, or bind the prompt input from an upstream node’s output
Template error: ...
Section titled “Template error: ...”Cause: The prompt_template contains invalid Handlebars syntax or references a missing context variable
Fix: Check your template syntax — variables use {{context.key}} format. Ensure upstream nodes produce the referenced outputs