AI & Machine Learning Modules
AI & Machine Learning Modules
All AI modules use the component system β configure which AI provider to use at the installation level or override per flowlet via componentConfigIds.
Chat β LLM Completion
Sends a prompt to a language model and returns the response.
appId: chat
{ "appId": "chat", "ref": "summarize", "args": { "systemPrompt": "You are a document summarizer. Be concise and accurate.", "userMessage": "Summarize the following invoice:\n\n{{ $prev.extractText.text }}", "model": "gpt-4o", "temperature": 0.3, "maxTokens": 500, "history": [] }}Arguments:
| Arg | Type | Description |
|---|---|---|
systemPrompt | string | System-level instructions for the model |
userMessage | string | The userβs input message |
model | string | Model name (provider-specific, e.g., gpt-4o, claude-3-5-sonnet-20241022) |
temperature | float | Creativity: 0.0 (deterministic) to 2.0 (random). Default: 0.7 |
maxTokens | int | Maximum tokens in the response |
history | array | Prior conversation messages [{"role":"user","content":"..."}] |
Output: { "response": "This invoice from ACME Corp totals $1,250...", "tokens": 142 }
Embeddings β Vector Generation
Converts text into a numerical vector for semantic search and RAG pipelines.
appId: embeddings
{ "appId": "embeddings", "ref": "vectorize", "args": { "input": "{{ $prev.extractText.text }}", "model": "text-embedding-3-small" }}Output: { "vector": [0.012, -0.034, 0.091, ...], "dimensions": 1536 }
Structured Extract β Schema-Validated Output
Prompts the AI to return data in a specific JSON Schema structure. Useful for extracting structured fields from unstructured text.
appId: structured-extract
{ "appId": "structured-extract", "ref": "extractInvoiceData", "args": { "input": "{{ $prev.ocrText.text }}", "prompt": "Extract invoice data from the following text:", "schema": { "type": "object", "properties": { "invoiceNumber": { "type": "string" }, "totalAmount": { "type": "number" }, "dueDate": { "type": "string", "format": "date" }, "vendorName": { "type": "string" }, "lineItems": { "type": "array", "items": { "type": "object", "properties": { "description": { "type": "string" }, "amount": { "type": "number" } } } } }, "required": ["invoiceNumber", "totalAmount", "vendorName"] } }}Output: The data field contains the JSON-validated extracted object. The valid field indicates schema compliance.
AI Prompt β Template Builder
Builds a prompt string from a template with injected data β useful as a precursor step to the Chat module.
appId: ai-prompt
{ "appId": "ai-prompt", "ref": "buildPrompt", "args": { "template": "Analyze the following {{ .documentType }} and identify any issues:\n\n{{ .content }}\n\nFocus on: {{ .focusArea }}", "data": { "documentType": "contract", "content": "{{ $prev.extractText.text }}", "focusArea": "payment terms and liability clauses" } }}Output: { "prompt": "Analyze the following contract and identify..." }
MCP Agent Loop β Tool-Using AI Agent
Runs an AI agent that can use flow8βs MCP tools in a loop until it completes the task.
appId: mcp-agent-loop
{ "appId": "mcp-agent-loop", "ref": "runAgent", "args": { "task": "Find all overdue invoices from Clio and create a summary report.", "tools": ["clio-list-matters", "clio-get-contact", "kv-set"], "maxIterations": 10, "model": "claude-3-5-sonnet-20241022" }}Output: { "result": "Found 7 overdue invoices totaling...", "iterations": 4, "toolCallCount": 12 }