diff --git a/apps/docs/content/docs/de/blocks/guardrails.mdx b/apps/docs/content/docs/de/blocks/guardrails.mdx new file mode 100644 index 0000000000..f2d6a95f8f --- /dev/null +++ b/apps/docs/content/docs/de/blocks/guardrails.mdx @@ -0,0 +1,251 @@ +--- +title: Guardrails +--- + +import { Callout } from 'fumadocs-ui/components/callout' +import { Step, Steps } from 'fumadocs-ui/components/steps' +import { Tab, Tabs } from 'fumadocs-ui/components/tabs' +import { Image } from '@/components/ui/image' +import { Video } from '@/components/ui/video' + +The Guardrails block validates and protects your AI workflows by checking content against multiple validation types. Ensure data quality, prevent hallucinations, detect PII, and enforce format requirements before content moves through your workflow. + +
+ Guardrails Block +
+ +## Overview + +The Guardrails block enables you to: + + + + Validate JSON Structure: Ensure LLM outputs are valid JSON before parsing + + + Match Regex Patterns: Verify content matches specific formats (emails, phone numbers, URLs, etc.) + + + Detect Hallucinations: Use RAG + LLM scoring to validate AI outputs against knowledge base content + + + Detect PII: Identify and optionally mask personally identifiable information across 40+ entity types + + + +## Validation Types + +### JSON Validation + +Validates that content is properly formatted JSON. Perfect for ensuring structured LLM outputs can be safely parsed. + +**Use Cases:** +- Validate JSON responses from Agent blocks before parsing +- Ensure API payloads are properly formatted +- Check structured data integrity + +**Output:** +- `passed`: `true` if valid JSON, `false` otherwise +- `error`: Error message if validation fails (e.g., "Invalid JSON: Unexpected token...") + +### Regex Validation + +Checks if content matches a specified regular expression pattern. + +**Use Cases:** +- Validate email addresses +- Check phone number formats +- Verify URLs or custom identifiers +- Enforce specific text patterns + +**Configuration:** +- **Regex Pattern**: The regular expression to match against (e.g., `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` for emails) + +**Output:** +- `passed`: `true` if content matches pattern, `false` otherwise +- `error`: Error message if validation fails + +### Hallucination Detection + +Uses Retrieval-Augmented Generation (RAG) with LLM scoring to detect when AI-generated content contradicts or isn't grounded in your knowledge base. + +**How It Works:** +1. Queries your knowledge base for relevant context +2. Sends both the AI output and retrieved context to an LLM +3. LLM assigns a confidence score (0-10 scale) + - **0** = Full hallucination (completely ungrounded) + - **10** = Fully grounded (completely supported by knowledge base) +4. Validation passes if score ≥ threshold (default: 3) + +**Configuration:** +- **Knowledge Base**: Select from your existing knowledge bases +- **Model**: Choose LLM for scoring (requires strong reasoning - GPT-4o, Claude 3.7 Sonnet recommended) +- **API Key**: Authentication for selected LLM provider (auto-hidden for hosted/Ollama models) +- **Confidence Threshold**: Minimum score to pass (0-10, default: 3) +- **Top K** (Advanced): Number of knowledge base chunks to retrieve (default: 10) + +**Output:** +- `passed`: `true` if confidence score ≥ threshold +- `score`: Confidence score (0-10) +- `reasoning`: LLM's explanation for the score +- `error`: Error message if validation fails + +**Use Cases:** +- Validate Agent responses against documentation +- Ensure customer support answers are factually accurate +- Verify generated content matches source material +- Quality control for RAG applications + +### PII Detection + +Detects personally identifiable information using Microsoft Presidio. Supports 40+ entity types across multiple countries and languages. + +
+
+ +**How It Works:** +1. Scans content for PII entities using pattern matching and NLP +2. Returns detected entities with locations and confidence scores +3. Optionally masks detected PII in the output + +**Configuration:** +- **PII Types to Detect**: Select from grouped categories via modal selector + - **Common**: Person name, Email, Phone, Credit card, IP address, etc. + - **USA**: SSN, Driver's license, Passport, etc. + - **UK**: NHS number, National insurance number + - **Spain**: NIF, NIE, CIF + - **Italy**: Fiscal code, Driver's license, VAT code + - **Poland**: PESEL, NIP, REGON + - **Singapore**: NRIC/FIN, UEN + - **Australia**: ABN, ACN, TFN, Medicare + - **India**: Aadhaar, PAN, Passport, Voter number +- **Mode**: + - **Detect**: Only identify PII (default) + - **Mask**: Replace detected PII with masked values +- **Language**: Detection language (default: English) + +**Output:** +- `passed`: `false` if any selected PII types are detected +- `detectedEntities`: Array of detected PII with type, location, and confidence +- `maskedText`: Content with PII masked (only if mode = "Mask") +- `error`: Error message if validation fails + +**Use Cases:** +- Block content containing sensitive personal information +- Mask PII before logging or storing data +- Compliance with GDPR, HIPAA, and other privacy regulations +- Sanitize user inputs before processing + +## Configuration + +### Content to Validate + +The input content to validate. This typically comes from: +- Agent block outputs: `` +- Function block results: `` +- API responses: `` +- Any other block output + +### Validation Type + +Choose from four validation types: +- **Valid JSON**: Check if content is properly formatted JSON +- **Regex Match**: Verify content matches a regex pattern +- **Hallucination Check**: Validate against knowledge base with LLM scoring +- **PII Detection**: Detect and optionally mask personally identifiable information + +## Outputs + +All validation types return: + +- **``**: Boolean indicating if validation passed +- **``**: The type of validation performed +- **``**: The original input that was validated +- **``**: Error message if validation failed (optional) + +Additional outputs by type: + +**Hallucination Check:** +- **``**: Confidence score (0-10) +- **``**: LLM's explanation + +**PII Detection:** +- **``**: Array of detected PII entities +- **``**: Content with PII masked (if mode = "Mask") + +## Example Use Cases + +### Validate JSON Before Parsing + +
+

Scenario: Ensure Agent output is valid JSON

+
    +
  1. Agent generates structured JSON response
  2. +
  3. Guardrails validates JSON format
  4. +
  5. Condition block checks ``
  6. +
  7. If passed → Parse and use data, If failed → Retry or handle error
  8. +
+
+ +### Prevent Hallucinations + +
+

Scenario: Validate customer support responses

+
    +
  1. Agent generates response to customer question
  2. +
  3. Guardrails checks against support documentation knowledge base
  4. +
  5. If confidence score ≥ 3 → Send response
  6. +
  7. If confidence score \< 3 → Flag for human review
  8. +
+
+ +### Block PII in User Inputs + +
+

Scenario: Sanitize user-submitted content

+
    +
  1. User submits form with text content
  2. +
  3. Guardrails detects PII (emails, phone numbers, SSN, etc.)
  4. +
  5. If PII detected → Reject submission or mask sensitive data
  6. +
  7. If no PII → Process normally
  8. +
+
+ +
+
+ +### Validate Email Format + +
+

Scenario: Check email address format

+
    +
  1. Agent extracts email from text
  2. +
  3. Guardrails validates with regex pattern
  4. +
  5. If valid → Use email for notification
  6. +
  7. If invalid → Request correction
  8. +
+
+ +## Best Practices + +- **Chain with Condition blocks**: Use `` to branch workflow logic based on validation results +- **Use JSON validation before parsing**: Always validate JSON structure before attempting to parse LLM outputs +- **Choose appropriate PII types**: Only select the PII entity types relevant to your use case for better performance +- **Set reasonable confidence thresholds**: For hallucination detection, adjust threshold based on your accuracy requirements (higher = stricter) +- **Use strong models for hallucination detection**: GPT-4o or Claude 3.7 Sonnet provide more accurate confidence scoring +- **Mask PII for logging**: Use "Mask" mode when you need to log or store content that may contain PII +- **Test regex patterns**: Validate your regex patterns thoroughly before deploying to production +- **Monitor validation failures**: Track `` messages to identify common validation issues + + + Guardrails validation happens synchronously in your workflow. For hallucination detection, choose faster models (like GPT-4o-mini) if latency is critical. + + diff --git a/apps/docs/content/docs/de/execution/costs.mdx b/apps/docs/content/docs/de/execution/costs.mdx index 385ebd6699..376ad8aa66 100644 --- a/apps/docs/content/docs/de/execution/costs.mdx +++ b/apps/docs/content/docs/de/execution/costs.mdx @@ -183,4 +183,39 @@ Verschiedene Abonnementpläne haben unterschiedliche Nutzungslimits: - Überprüfen Sie Ihre aktuelle Nutzung unter [Einstellungen → Abonnement](https://sim.ai/settings/subscription) - Erfahren Sie mehr über [Logging](/execution/logging), um Ausführungsdetails zu verfolgen - Erkunden Sie die [Externe API](/execution/api) für programmatische Kostenüberwachung -- Sehen Sie sich [Workflow-Optimierungstechniken](/blocks) an, um Kosten zu reduzieren \ No newline at end of file +- Sehen Sie sich [Workflow-Optimierungstechniken](/blocks) an, um Kosten zu reduzieren + +**Team-Plan (40 $/Sitz/Monat):** +- Gemeinsame Nutzung für alle Teammitglieder +- Überschreitung wird anhand der Gesamtnutzung des Teams berechnet +- Organisationsinhaber erhält eine Rechnung + +**Enterprise-Pläne:** +- Fester monatlicher Preis, keine Überschreitungen +- Benutzerdefinierte Nutzungslimits gemäß Vereinbarung + +### Schwellenwertabrechnung + +Wenn die nicht abgerechnete Überschreitung 50 $ erreicht, berechnet Sim automatisch den gesamten nicht abgerechneten Betrag. + +**Beispiel:** +- Tag 10: 70 $ Überschreitung → Sofortige Abrechnung von 70 $ +- Tag 15: Zusätzliche Nutzung von 35 $ (insgesamt 105 $) → Bereits abgerechnet, keine Aktion +- Tag 20: Weitere Nutzung von 50 $ (insgesamt 155 $, 85 $ nicht abgerechnet) → Sofortige Abrechnung von 85 $ + +Dies verteilt hohe Überschreitungsgebühren über den Monat, anstatt eine große Rechnung am Ende des Abrechnungszeitraums zu stellen. + +## Best Practices für Kostenmanagement + +1. **Regelmäßige Überwachung**: Überprüfen Sie Ihr Nutzungs-Dashboard häufig, um Überraschungen zu vermeiden +2. **Budgets festlegen**: Nutzen Sie Planlimits als Leitplanken für Ihre Ausgaben +3. **Workflows optimieren**: Überprüfen Sie kostenintensive Ausführungen und optimieren Sie Prompts oder Modellauswahl +4. **Geeignete Modelle verwenden**: Passen Sie die Modellkomplexität an die Aufgabenanforderungen an +5. **Ähnliche Aufgaben bündeln**: Kombinieren Sie wenn möglich mehrere Anfragen, um den Overhead zu reduzieren + +## Nächste Schritte + +- Überprüfen Sie Ihre aktuelle Nutzung unter [Einstellungen → Abonnement](https://sim.ai/settings/subscription) +- Erfahren Sie mehr über [Protokollierung](/execution/logging), um Ausführungsdetails zu verfolgen +- Erkunden Sie die [externe API](/execution/api) für programmatische Kostenüberwachung +- Sehen Sie sich [Workflow-Optimierungstechniken](/blocks) zur Kostenreduzierung an \ No newline at end of file diff --git a/apps/docs/content/docs/de/sdks/typescript.mdx b/apps/docs/content/docs/de/sdks/typescript.mdx index 55e36ce7e2..6cd1cafbfd 100644 --- a/apps/docs/content/docs/de/sdks/typescript.mdx +++ b/apps/docs/content/docs/de/sdks/typescript.mdx @@ -957,34 +957,6 @@ function StreamingWorkflow() { - Node.js 16+ - TypeScript 5.0+ (for TypeScript projects) -## TypeScript Support - -The SDK is written in TypeScript and provides full type safety: - -```typescript -import { - SimStudioClient, - WorkflowExecutionResult, - WorkflowStatus, - SimStudioError -} from 'simstudio-ts-sdk'; - -// Typsichere Client-Initialisierung -const client: SimStudioClient = new SimStudioClient({ - apiKey: process.env.SIM_API_KEY! -}); - -// Typsichere Workflow-Ausführung -const result: WorkflowExecutionResult = await client.executeWorkflow('workflow-id', { - input: { - message: 'Hello, TypeScript!' - } -}); - -// Typsichere Statusprüfung -const status: WorkflowStatus = await client.getWorkflowStatus('workflow-id'); -``` - ## License Apache-2.0 \ No newline at end of file diff --git a/apps/docs/content/docs/de/tools/clay.mdx b/apps/docs/content/docs/de/tools/clay.mdx new file mode 100644 index 0000000000..def872aa52 --- /dev/null +++ b/apps/docs/content/docs/de/tools/clay.mdx @@ -0,0 +1,226 @@ +--- +title: Clay +description: Populate Clay workbook +--- + +import { BlockInfoCard } from "@/components/ui/block-info-card" + + + + + + `} +/> + +{/* MANUAL-CONTENT-START:intro */} +[Clay](https://www.clay.com/) is a data enrichment and workflow automation platform that helps teams streamline lead generation, research, and data operations through powerful integrations and flexible inputs. + +Learn how to use the Clay Tool in Sim to seamlessly insert data into a Clay workbook through webhook triggers. This tutorial walks you through setting up a webhook, configuring data mapping, and automating real-time updates to your Clay workbooks. Perfect for streamlining lead generation and data enrichment directly from your workflow! + + + +With Clay, you can: + +- **Enrich agent outputs**: Automatically feed your Sim agent data into Clay tables for structured tracking and analysis +- **Trigger workflows via webhooks**: Use Clay’s webhook support to initiate Sim agent tasks from within Clay +- **Leverage data loops**: Seamlessly iterate over enriched data rows with agents that operate across dynamic datasets + +In Sim, the Clay integration allows your agents to push structured data into Clay tables via webhooks. This makes it easy to collect, enrich, and manage dynamic outputs such as leads, research summaries, or action items—all in a collaborative, spreadsheet-like interface. Your agents can populate rows in real time, enabling asynchronous workflows where AI-generated insights are captured, reviewed, and used by your team. Whether you're automating research, enriching CRM data, or tracking operational outcomes, Clay becomes a living data layer that interacts intelligently with your agents. By connecting Sim with Clay, you gain a powerful way to operationalize agent results, loop over datasets with precision, and maintain a clean, auditable record of AI-driven work. +{/* MANUAL-CONTENT-END */} + +## Usage Instructions + +Integrate Clay into the workflow. Can populate a table with data. + +## Tools + +### `clay_populate` + +Populate Clay with data from a JSON file. Enables direct communication and notifications with timestamp tracking and channel confirmation. + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `webhookURL` | string | Yes | The webhook URL to populate | +| `data` | json | Yes | The data to populate | +| `authToken` | string | Yes | Auth token for Clay webhook authentication | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `success` | boolean | Operation success status | +| `output` | json | Clay populate operation results including response data from Clay webhook | + +## Notes + +- Category: `tools` +- Type: `clay` diff --git a/apps/docs/content/docs/de/tools/huggingface.mdx b/apps/docs/content/docs/de/tools/huggingface.mdx new file mode 100644 index 0000000000..ec1558de05 --- /dev/null +++ b/apps/docs/content/docs/de/tools/huggingface.mdx @@ -0,0 +1,98 @@ +--- +title: Hugging Face +description: Use Hugging Face Inference API +--- + +import { BlockInfoCard } from "@/components/ui/block-info-card" + + + + + + + + + `} +/> + +{/* MANUAL-CONTENT-START:intro */} +[HuggingFace](https://huggingface.co/) is a leading AI platform that provides access to thousands of pre-trained machine learning models and powerful inference capabilities. With its extensive model hub and robust API, HuggingFace offers comprehensive tools for both research and production AI applications. +With HuggingFace, you can: + +Access pre-trained models: Utilize models for text generation, translation, image processing, and more +Generate AI completions: Create content using state-of-the-art language models through the Inference API +Natural language processing: Process and analyze text with specialized NLP models +Deploy at scale: Host and serve models for production applications +Customize models: Fine-tune existing models for specific use cases + +In Sim, the HuggingFace integration enables your agents to programmatically generate completions using the HuggingFace Inference API. This allows for powerful automation scenarios such as content generation, text analysis, code completion, and creative writing. Your agents can generate completions with natural language prompts, access specialized models for different tasks, and integrate AI-generated content into workflows. This integration bridges the gap between your AI workflows and machine learning capabilities, enabling seamless AI-powered automation with one of the world's most comprehensive ML platforms. +{/* MANUAL-CONTENT-END */} + +## Usage Instructions + +Integrate Hugging Face into the workflow. Can generate completions using the Hugging Face Inference API. + +## Tools + +### `huggingface_chat` + +Generate completions using Hugging Face Inference API + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `systemPrompt` | string | No | System prompt to guide the model behavior | +| `content` | string | Yes | The user message content to send to the model | +| `provider` | string | Yes | The provider to use for the API request \(e.g., novita, cerebras, etc.\) | +| `model` | string | Yes | Model to use for chat completions \(e.g., deepseek/deepseek-v3-0324\) | +| `maxTokens` | number | No | Maximum number of tokens to generate | +| `temperature` | number | No | Sampling temperature \(0-2\). Higher values make output more random | +| `apiKey` | string | Yes | Hugging Face API token | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `success` | boolean | Operation success status | +| `output` | object | Chat completion results | + +## Notes + +- Category: `tools` +- Type: `huggingface` diff --git a/apps/docs/content/docs/de/tools/knowledge.mdx b/apps/docs/content/docs/de/tools/knowledge.mdx index 3a9e9b0dd5..2a882953d4 100644 --- a/apps/docs/content/docs/de/tools/knowledge.mdx +++ b/apps/docs/content/docs/de/tools/knowledge.mdx @@ -60,10 +60,10 @@ Suche nach ähnlichen Inhalten in einer Wissensdatenbank mittels Vektorähnlichk | Parameter | Typ | Erforderlich | Beschreibung | | --------- | ---- | -------- | ----------- | -| `knowledgeBaseId` | string | Ja | ID der zu durchsuchenden Wissensdatenbank | +| `knowledgeBaseId` | string | Ja | ID der Wissensdatenbank, in der gesucht werden soll | | `query` | string | Nein | Suchanfragentext \(optional bei Verwendung von Tag-Filtern\) | | `topK` | number | Nein | Anzahl der ähnlichsten Ergebnisse, die zurückgegeben werden sollen \(1-100\) | -| `tagFilters` | any | Nein | Array von Tag-Filtern mit tagName- und tagValue-Eigenschaften | +| `tagFilters` | array | Nein | Array von Tag-Filtern mit tagName- und tagValue-Eigenschaften | #### Ausgabe diff --git a/apps/docs/content/docs/de/tools/stagehand.mdx b/apps/docs/content/docs/de/tools/stagehand.mdx new file mode 100644 index 0000000000..07684b3069 --- /dev/null +++ b/apps/docs/content/docs/de/tools/stagehand.mdx @@ -0,0 +1,219 @@ +--- +title: Stagehand Extract +description: Extract data from websites +--- + +import { BlockInfoCard } from "@/components/ui/block-info-card" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `} +/> + +{/* MANUAL-CONTENT-START:intro */} +[Stagehand](https://stagehand.com) is a tool that allows you to extract structured data from webpages using Browserbase and OpenAI. + +With Stagehand, you can: + +- **Extract structured data**: Extract structured data from webpages using Browserbase and OpenAI +- **Save data to a database**: Save the extracted data to a database +- **Automate workflows**: Automate workflows to extract data from webpages + +In Sim, the Stagehand integration enables your agents to extract structured data from webpages using Browserbase and OpenAI. This allows for powerful automation scenarios such as data extraction, data analysis, and data integration. Your agents can extract structured data from webpages, save the extracted data to a database, and automate workflows to extract data from webpages. This integration bridges the gap between your AI workflows and your data management system, enabling seamless data extraction and integration. By connecting Sim with Stagehand, you can automate data extraction processes, maintain up-to-date information repositories, generate reports, and organize information intelligently - all through your intelligent agents. +{/* MANUAL-CONTENT-END */} + +## Usage Instructions + +Integrate Stagehand into the workflow. Can extract structured data from webpages. + +## Tools + +### `stagehand_extract` + +Extract structured data from a webpage using Stagehand + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `url` | string | Yes | URL of the webpage to extract data from | +| `instruction` | string | Yes | Instructions for extraction | +| `apiKey` | string | Yes | OpenAI API key for extraction \(required by Stagehand\) | +| `schema` | json | Yes | JSON schema defining the structure of the data to extract | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `data` | object | Extracted structured data matching the provided schema | + +## Notes + +- Category: `tools` +- Type: `stagehand` diff --git a/apps/docs/content/docs/de/tools/stagehand_agent.mdx b/apps/docs/content/docs/de/tools/stagehand_agent.mdx new file mode 100644 index 0000000000..e5f659f819 --- /dev/null +++ b/apps/docs/content/docs/de/tools/stagehand_agent.mdx @@ -0,0 +1,225 @@ +--- +title: Stagehand Agent +description: Autonomous web browsing agent +--- + +import { BlockInfoCard } from "@/components/ui/block-info-card" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `} +/> + +{/* MANUAL-CONTENT-START:intro */} +[Stagehand](https://www.stagehand.dev/) is an autonomous web agent platform that enables AI systems to navigate and interact with websites just like a human would. It provides a powerful solution for automating complex web tasks without requiring custom code or browser automation scripts. + +With Stagehand, you can: + +- **Automate web navigation**: Enable AI to browse websites, click links, fill forms, and interact with web elements +- **Extract structured data**: Collect specific information from websites in a structured, usable format +- **Complete complex workflows**: Perform multi-step tasks across different websites and web applications +- **Handle authentication**: Navigate login processes and maintain sessions across websites +- **Process dynamic content**: Interact with JavaScript-heavy sites and single-page applications +- **Maintain context awareness**: Keep track of the current state and history while navigating +- **Generate detailed reports**: Receive comprehensive logs of actions taken and data collected + +In Sim, the Stagehand integration enables your agents to seamlessly interact with web-based systems as part of their workflows. This allows for sophisticated automation scenarios that bridge the gap between your AI agents and the vast information and functionality available on the web. Your agents can search for information, interact with web applications, extract data from websites, and incorporate these capabilities into their decision-making processes. By connecting Sim with Stagehand, you can create agents that extend beyond API-based integrations to navigate the web just as a human would - filling forms, clicking buttons, reading content, and extracting valuable information to complete their tasks more effectively. +{/* MANUAL-CONTENT-END */} + +## Usage Instructions + +Integrate Stagehand Agent into the workflow. Can navigate the web and perform tasks. + +## Tools + +### `stagehand_agent` + +Run an autonomous web agent to complete tasks and extract structured data + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `startUrl` | string | Yes | URL of the webpage to start the agent on | +| `task` | string | Yes | The task to complete or goal to achieve on the website | +| `variables` | json | No | Optional variables to substitute in the task \(format: \{key: value\}\). Reference in task using %key% | +| `format` | string | No | No description | +| `apiKey` | string | Yes | OpenAI API key for agent execution \(required by Stagehand\) | +| `outputSchema` | json | No | Optional JSON schema defining the structure of data the agent should return | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `agentResult` | object | Result from the Stagehand agent execution | + +## Notes + +- Category: `tools` +- Type: `stagehand_agent` diff --git a/apps/docs/content/docs/de/tools/supabase.mdx b/apps/docs/content/docs/de/tools/supabase.mdx index a736a8db62..2ff081e036 100644 --- a/apps/docs/content/docs/de/tools/supabase.mdx +++ b/apps/docs/content/docs/de/tools/supabase.mdx @@ -109,10 +109,10 @@ Daten in eine Supabase-Tabelle einfügen | Parameter | Typ | Erforderlich | Beschreibung | | --------- | ---- | -------- | ----------- | -| `projectId` | string | Ja | Ihre Supabase-Projekt-ID (z.B. jdrkgepadsdopsntdlom) | +| `projectId` | string | Ja | Ihre Supabase-Projekt-ID \(z.B. jdrkgepadsdopsntdlom\) | | `table` | string | Ja | Der Name der Supabase-Tabelle, in die Daten eingefügt werden sollen | -| `data` | any | Ja | Die einzufügenden Daten | -| `apiKey` | string | Ja | Ihr Supabase Service-Role-Secret-Key | +| `data` | array | Ja | Die einzufügenden Daten \(Array von Objekten oder ein einzelnes Objekt\) | +| `apiKey` | string | Ja | Ihr Supabase Service Role Secret Key | #### Ausgabe @@ -191,8 +191,8 @@ Daten in eine Supabase-Tabelle einfügen oder aktualisieren (Upsert-Operation) | Parameter | Typ | Erforderlich | Beschreibung | | --------- | ---- | -------- | ----------- | | `projectId` | string | Ja | Ihre Supabase-Projekt-ID \(z.B. jdrkgepadsdopsntdlom\) | -| `table` | string | Ja | Der Name der Supabase-Tabelle, in die Daten eingefügt werden sollen | -| `data` | any | Ja | Die Daten, die eingefügt oder aktualisiert werden sollen \(Upsert\) | +| `table` | string | Ja | Der Name der Supabase-Tabelle, in die Daten upsertet werden sollen | +| `data` | array | Ja | Die zu upsertenden Daten \(einfügen oder aktualisieren\) - Array von Objekten oder ein einzelnes Objekt | | `apiKey` | string | Ja | Ihr Supabase Service Role Secret Key | #### Ausgabe diff --git a/apps/docs/content/docs/de/tools/telegram.mdx b/apps/docs/content/docs/de/tools/telegram.mdx index 4a3e7020a2..e57f4c2cc3 100644 --- a/apps/docs/content/docs/de/tools/telegram.mdx +++ b/apps/docs/content/docs/de/tools/telegram.mdx @@ -87,12 +87,108 @@ Sendet Nachrichten an Telegram-Kanäle oder Benutzer über die Telegram Bot API. | Parameter | Typ | Beschreibung | | --------- | ---- | ----------- | -| `success` | boolean | Erfolgsstatus der Telegram-Nachrichtensendung | -| `messageId` | number | Eindeutige Telegram-Nachrichtenkennung | -| `chatId` | string | Ziel-Chat-ID, wohin die Nachricht gesendet wurde | -| `text` | string | Textinhalt der gesendeten Nachricht | -| `timestamp` | number | Unix-Zeitstempel, wann die Nachricht gesendet wurde | -| `from` | object | Informationen über den Bot, der die Nachricht gesendet hat | +| `message` | string | Erfolgs- oder Fehlermeldung | +| `data` | object | Telegram-Nachrichtendaten | + +## Hinweise + +- Kategorie: `tools` +- Typ: `telegram` + +#### Eingabe + +| Parameter | Typ | Erforderlich | Beschreibung | +| --------- | ---- | -------- | ----------- | +| `botToken` | string | Ja | Ihr Telegram Bot API-Token | +| `chatId` | string | Ja | Ziel-Telegram-Chat-ID | +| `messageId` | string | Ja | Nachrichten-ID zum Löschen | + +#### Ausgabe + +| Parameter | Typ | Beschreibung | +| --------- | ---- | ----------- | +| `message` | string | Erfolgs- oder Fehlermeldung | +| `data` | object | Ergebnis des Löschvorgangs | + +### `telegram_send_photo` + +Senden Sie Fotos an Telegram-Kanäle oder Benutzer über die Telegram Bot API. + +#### Eingabe + +| Parameter | Typ | Erforderlich | Beschreibung | +| --------- | ---- | -------- | ----------- | +| `botToken` | string | Ja | Ihr Telegram Bot API-Token | +| `chatId` | string | Ja | Ziel-Telegram-Chat-ID | +| `photo` | string | Ja | Zu sendendes Foto. Übergeben Sie eine file_id oder HTTP-URL | +| `caption` | string | Nein | Fotobeschreibung (optional) | + +#### Ausgabe + +| Parameter | Typ | Beschreibung | +| --------- | ---- | ----------- | +| `message` | string | Erfolgs- oder Fehlermeldung | +| `data` | object | Telegram-Nachrichtendaten einschließlich optionaler Foto(s) | + +### `telegram_send_video` + +Senden Sie Videos an Telegram-Kanäle oder Benutzer über die Telegram Bot API. + +#### Eingabe + +| Parameter | Typ | Erforderlich | Beschreibung | +| --------- | ---- | -------- | ----------- | +| `botToken` | string | Ja | Ihr Telegram Bot API-Token | +| `chatId` | string | Ja | Ziel-Telegram-Chat-ID | +| `video` | string | Ja | Zu sendendes Video. Übergeben Sie eine file_id oder HTTP-URL | +| `caption` | string | Nein | Videobeschreibung (optional) | + +#### Ausgabe + +| Parameter | Typ | Beschreibung | +| --------- | ---- | ----------- | +| `message` | string | Erfolgs- oder Fehlermeldung | +| `data` | object | Telegram-Nachrichtendaten einschließlich optionaler Medien | + +### `telegram_send_audio` + +Senden Sie Audiodateien an Telegram-Kanäle oder Benutzer über die Telegram Bot API. + +#### Eingabe + +| Parameter | Typ | Erforderlich | Beschreibung | +| --------- | ---- | -------- | ----------- | +| `botToken` | string | Ja | Ihr Telegram Bot API-Token | +| `chatId` | string | Ja | Ziel-Telegram-Chat-ID | +| `audio` | string | Ja | Zu sendende Audiodatei. Übergeben Sie eine file_id oder HTTP-URL | +| `caption` | string | Nein | Audio-Beschriftung \(optional\) | + +#### Ausgabe + +| Parameter | Typ | Beschreibung | +| --------- | ---- | ----------- | +| `message` | string | Erfolgs- oder Fehlermeldung | +| `data` | object | Telegram-Nachrichtendaten einschließlich Sprach-/Audioinformationen | + +### `telegram_send_animation` + +Senden Sie Animationen (GIFs) an Telegram-Kanäle oder Benutzer über die Telegram Bot API. + +#### Eingabe + +| Parameter | Typ | Erforderlich | Beschreibung | +| --------- | ---- | -------- | ----------- | +| `botToken` | string | Ja | Ihr Telegram Bot API-Token | +| `chatId` | string | Ja | Ziel-Telegram-Chat-ID | +| `animation` | string | Ja | Zu sendende Animation. Übergeben Sie eine file_id oder HTTP-URL | +| `caption` | string | Nein | Animations-Beschriftung \(optional\) | + +#### Ausgabe + +| Parameter | Typ | Beschreibung | +| --------- | ---- | ----------- | +| `message` | string | Erfolgs- oder Fehlermeldung | +| `data` | object | Telegram-Nachrichtendaten einschließlich optionaler Medien | ## Hinweise diff --git a/apps/docs/content/docs/de/tools/youtube.mdx b/apps/docs/content/docs/de/tools/youtube.mdx index 9ee05ca3d1..cf7268fe84 100644 --- a/apps/docs/content/docs/de/tools/youtube.mdx +++ b/apps/docs/content/docs/de/tools/youtube.mdx @@ -1,6 +1,6 @@ --- title: YouTube -description: Suche nach Videos auf YouTube +description: Interagiere mit YouTube-Videos, Kanälen und Playlists --- import { BlockInfoCard } from "@/components/ui/block-info-card" @@ -39,7 +39,7 @@ In Sim ermöglicht die YouTube-Integration Ihren Agenten, YouTube-Inhalte progra ## Gebrauchsanweisung -Integriert YouTube in den Workflow. Kann nach Videos suchen. Benötigt API-Schlüssel. +Integriere YouTube in den Workflow. Kann nach Videos suchen, Videodetails abrufen, Kanalinformationen abrufen, Playlist-Elemente abrufen und Videokommentare abrufen. ## Tools @@ -61,6 +61,99 @@ Suche nach Videos auf YouTube mit der YouTube Data API. | --------- | ---- | ----------- | | `items` | array | Array von YouTube-Videos, die der Suchanfrage entsprechen | +### `youtube_video_details` + +Erhalte detaillierte Informationen über ein bestimmtes YouTube-Video. + +#### Eingabe + +| Parameter | Typ | Erforderlich | Beschreibung | +| --------- | ---- | -------- | ----------- | +| `videoId` | string | Ja | YouTube-Video-ID | +| `apiKey` | string | Ja | YouTube API-Schlüssel | + +#### Ausgabe + +| Parameter | Typ | Beschreibung | +| --------- | ---- | ----------- | +| `videoId` | string | YouTube-Video-ID | +| `title` | string | Videotitel | +| `description` | string | Videobeschreibung | +| `channelId` | string | Kanal-ID | +| `channelTitle` | string | Kanalname | +| `publishedAt` | string | Veröffentlichungsdatum und -uhrzeit | +| `duration` | string | Videodauer im ISO 8601-Format | +| `viewCount` | number | Anzahl der Aufrufe | +| `likeCount` | number | Anzahl der Likes | +| `commentCount` | number | Anzahl der Kommentare | +| `thumbnail` | string | Video-Thumbnail-URL | +| `tags` | array | Video-Tags | + +### `youtube_channel_info` + +Erhalte detaillierte Informationen über einen YouTube-Kanal. + +#### Eingabe + +| Parameter | Typ | Erforderlich | Beschreibung | +| --------- | ---- | -------- | ----------- | +| `channelId` | string | Nein | YouTube-Kanal-ID \(verwende entweder channelId oder username\) | +| `username` | string | Nein | YouTube-Kanalbenutzername \(verwende entweder channelId oder username\) | +| `apiKey` | string | Ja | YouTube API-Schlüssel | + +#### Ausgabe + +| Parameter | Typ | Beschreibung | +| --------- | ---- | ----------- | +| `channelId` | string | YouTube-Kanal-ID | +| `title` | string | Kanalname | +| `description` | string | Kanalbeschreibung | +| `subscriberCount` | number | Anzahl der Abonnenten | +| `videoCount` | number | Anzahl der Videos | +| `viewCount` | number | Gesamtaufrufe des Kanals | +| `publishedAt` | string | Erstellungsdatum des Kanals | +| `thumbnail` | string | URL des Kanal-Thumbnails | +| `customUrl` | string | Benutzerdefinierte Kanal-URL | + +### `youtube_playlist_items` + +Videos aus einer YouTube-Playlist abrufen. + +#### Eingabe + +| Parameter | Typ | Erforderlich | Beschreibung | +| --------- | ---- | -------- | ----------- | +| `playlistId` | string | Ja | YouTube-Playlist-ID | +| `maxResults` | number | Nein | Maximale Anzahl der zurückzugebenden Videos | +| `pageToken` | string | Nein | Page-Token für Paginierung | +| `apiKey` | string | Ja | YouTube API-Schlüssel | + +#### Ausgabe + +| Parameter | Typ | Beschreibung | +| --------- | ---- | ----------- | +| `items` | array | Array von Videos in der Playlist | + +### `youtube_comments` + +Kommentare von einem YouTube-Video abrufen. + +#### Eingabe + +| Parameter | Typ | Erforderlich | Beschreibung | +| --------- | ---- | -------- | ----------- | +| `videoId` | string | Ja | YouTube-Video-ID | +| `maxResults` | number | Nein | Maximale Anzahl der zurückzugebenden Kommentare | +| `order` | string | Nein | Reihenfolge der Kommentare: time oder relevance | +| `pageToken` | string | Nein | Page-Token für Paginierung | +| `apiKey` | string | Ja | YouTube API-Schlüssel | + +#### Ausgabe + +| Parameter | Typ | Beschreibung | +| --------- | ---- | ----------- | +| `items` | array | Array von Kommentaren zum Video | + ## Hinweise - Kategorie: `tools` diff --git a/apps/docs/content/docs/de/triggers/api.mdx b/apps/docs/content/docs/de/triggers/api.mdx index 8dab4cfb38..a8dbb4f486 100644 --- a/apps/docs/content/docs/de/triggers/api.mdx +++ b/apps/docs/content/docs/de/triggers/api.mdx @@ -128,3 +128,60 @@ Wenn kein Eingabeformat definiert ist, stellt der Executor das rohe JSON nur unt Ein Workflow kann nur einen API-Trigger enthalten. Veröffentlichen Sie nach Änderungen eine neue Bereitstellung, damit der Endpunkt aktuell bleibt. + +### Datei-Upload-Format + +Die API akzeptiert Dateien in zwei Formaten: + +**1. Base64-kodierte Dateien** (empfohlen für SDKs): + +```json +{ + "documents": [{ + "type": "file", + "data": "data:application/pdf;base64,JVBERi0xLjQK...", + "name": "document.pdf", + "mime": "application/pdf" + }] +} +``` + +- Maximale Dateigröße: 20MB pro Datei +- Dateien werden in den Cloud-Speicher hochgeladen und in UserFile-Objekte mit allen Eigenschaften umgewandelt + +**2. Direkte URL-Referenzen**: + +```json +{ + "documents": [{ + "type": "url", + "data": "https://example.com/document.pdf", + "name": "document.pdf", + "mime": "application/pdf" + }] +} +``` + +- Die Datei wird nicht hochgeladen, die URL wird direkt weitergegeben +- Nützlich für die Referenzierung bestehender Dateien + +### Dateieigenschaften + +Für Dateien können alle Eigenschaften abgerufen werden: + +| Eigenschaft | Beschreibung | Typ | +|----------|-------------|------| +| `` | Signierte Download-URL | string | +| `` | Ursprünglicher Dateiname | string | +| `` | Dateigröße in Bytes | number | +| `` | MIME-Typ | string | +| `` | Upload-Zeitstempel (ISO 8601) | string | +| `` | URL-Ablaufzeitstempel (ISO 8601) | string | + +Für URL-referenzierte Dateien sind dieselben Eigenschaften verfügbar, außer `uploadedAt` und `expiresAt`, da die Datei nicht in unseren Speicher hochgeladen wird. + +Wenn kein Eingabeformat definiert ist, stellt der Executor das rohe JSON nur unter `` zur Verfügung. + + +Ein Workflow kann nur einen API-Trigger enthalten. Veröffentlichen Sie nach Änderungen eine neue Bereitstellung, damit der Endpunkt aktuell bleibt. + diff --git a/apps/docs/content/docs/de/triggers/chat.mdx b/apps/docs/content/docs/de/triggers/chat.mdx index 129054a819..34ddd0c94a 100644 --- a/apps/docs/content/docs/de/triggers/chat.mdx +++ b/apps/docs/content/docs/de/triggers/chat.mdx @@ -41,3 +41,11 @@ Dateien enthalten `name`, `mimeType` und einen signierten Download `url`. Der Builder blockiert mehrere Chat-Auslöser-Blöcke im selben Workflow. + +1. Fügen Sie einen Chat-Trigger-Block pro Workflow hinzu. +2. Stellen Sie den Workflow im Chat-Modus bereit. +3. Teilen Sie den Bereitstellungslink – jede Antwort verwendet die Konversations-ID wieder, damit der Workflow den Kontext beibehalten kann. + + +Der Builder blockiert mehrere Chat-Trigger-Blöcke im selben Workflow. + diff --git a/apps/docs/content/docs/de/yaml/block-reference.mdx b/apps/docs/content/docs/de/yaml/block-reference.mdx deleted file mode 100644 index 6d0381c91e..0000000000 --- a/apps/docs/content/docs/de/yaml/block-reference.mdx +++ /dev/null @@ -1,242 +0,0 @@ ---- -title: Block-Referenz-Syntax -description: Wie man Daten zwischen Blöcken in YAML-Workflows referenziert ---- - -import { Callout } from 'fumadocs-ui/components/callout' -import { Tab, Tabs } from 'fumadocs-ui/components/tabs' - -Block-Referenzen sind die Grundlage des Datenflusses in Sim-Workflows. Das Verständnis, wie man Ausgaben von einem Block korrekt als Eingaben für einen anderen referenziert, ist essenziell für den Aufbau funktionaler Workflows. - -## Grundlegende Referenzregeln - -### 1. Verwende Blocknamen, nicht Block-IDs - - - - - ```yaml - # Block definition - email-sender: - type: agent - name: "Email Generator" - # ... configuration - - # Reference the block - next-block: - inputs: - userPrompt: "Process this: " - ``` - - - - - ```yaml - # Block definition - email-sender: - type: agent - name: "Email Generator" - # ... configuration - - # ❌ Don't reference by block ID - next-block: - inputs: - userPrompt: "Process this: " - ``` - - - - -### 2. Namen in Referenzformat umwandeln - -Um eine Block-Referenz zu erstellen: - -1. **Nimm den Blocknamen**: "Email Generator" -2. **Konvertiere zu Kleinbuchstaben**: "email generator" -3. **Entferne Leerzeichen und Sonderzeichen**: "emailgenerator" -4. **Füge Eigenschaft hinzu**: `` - -### 3. Verwende die richtigen Eigenschaften - -Verschiedene Blocktypen stellen unterschiedliche Eigenschaften bereit: - -- **Agent-Blöcke**: `.content` (die KI-Antwort) -- **Funktionsblöcke**: `.output` (der Rückgabewert) -- **API-Blöcke**: `.output` (die Antwortdaten) -- **Tool-Blöcke**: `.output` (das Tool-Ergebnis) - -## Referenzbeispiele - -### Häufige Block-Referenzen - -```yaml -# Agent block outputs - # Primary AI response - # Token usage information - # Estimated cost - # Tool execution details - -# Function block outputs - # Function return value - # Error information (if any) - -# API block outputs - # Response data - # HTTP status code - # Response headers - -# Tool block outputs - # Tool execution result -``` - -### Blocknamen mit mehreren Wörtern - -```yaml -# Block name: "Data Processor 2" - - -# Block name: "Email Validation Service" - - -# Block name: "Customer Info Agent" - -``` - -## Spezielle Referenzfälle - -### Starter-Block - - - Der Starter-Block wird immer als `` referenziert, unabhängig von seinem tatsächlichen Namen. - - -```yaml -# Starter block definition -my-custom-start: - type: starter - name: "Custom Workflow Start" - # ... configuration - -# Always reference as 'start' -agent-1: - inputs: - userPrompt: # ✅ Correct - # userPrompt: # ❌ Wrong -``` - -### Schleifenvariablen - -Innerhalb von Schleifenblöcken sind spezielle Variablen verfügbar: - -```yaml -# Available in loop child blocks - # Current iteration (0-based) - # Current item being processed (forEach loops) - # Full collection (forEach loops) -``` - -### Parallele Variablen - -Innerhalb von parallelen Blöcken sind spezielle Variablen verfügbar: - -```yaml -# Available in parallel child blocks - # Instance number (0-based) - # Item for this instance - # Full collection -``` - -## Komplexe Referenzbeispiele - -### Zugriff auf verschachtelte Daten - -Bei der Referenzierung komplexer Objekte wird die Punktnotation verwendet: - -```yaml -# If an agent returns structured data -data-analyzer: - type: agent - name: "Data Analyzer" - inputs: - responseFormat: | - { - "schema": { - "type": "object", - "properties": { - "analysis": {"type": "object"}, - "summary": {"type": "string"}, - "metrics": {"type": "object"} - } - } - } - -# Reference nested properties -next-step: - inputs: - userPrompt: | - Summary: - Score: - Full data: -``` - -### Mehrere Referenzen im Text - -```yaml -email-composer: - type: agent - inputs: - userPrompt: | - Create an email with the following information: - - Customer: - Order Details: - Support Ticket: - - Original request: -``` - -### Referenzen in Codeblöcken - -Bei der Verwendung von Referenzen in Funktionsblöcken werden diese als JavaScript-Werte ersetzt: - -```yaml -data-processor: - type: function - inputs: - code: | - // References are replaced with actual values - const customerData = ; - const orderInfo = ; - const originalInput = ; - - // Process the data - return { - customer: customerData.name, - orderId: orderInfo.id, - processed: true - }; -``` - -## Referenzvalidierung - -Sim validiert alle Referenzen beim Importieren von YAML: - -### Gültige Referenzen -- Block existiert im Workflow -- Eigenschaft ist für den Blocktyp geeignet -- Keine zirkulären Abhängigkeiten -- Korrekte Syntaxformatierung - -### Häufige Fehler -- **Block nicht gefunden**: Referenzierter Block existiert nicht -- **Falsche Eigenschaft**: Verwendung von `.content` in einem Funktionsblock -- **Tippfehler**: Falsch geschriebene Blocknamen oder Eigenschaften -- **Zirkuläre Referenzen**: Block referenziert sich direkt oder indirekt selbst - -## Best Practices - -1. **Verwende beschreibende Blocknamen**: Macht Referenzen lesbarer -2. **Sei konsistent**: Verwende die gleiche Namenskonvention durchgängig -3. **Überprüfe Referenzen**: Stelle sicher, dass alle referenzierten Blöcke existieren -4. **Vermeide tiefe Verschachtelungen**: Halte Referenzketten überschaubar -5. **Dokumentiere komplexe Abläufe**: Füge Kommentare hinzu, um Referenzbeziehungen zu erklären \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/blocks/agent.mdx b/apps/docs/content/docs/de/yaml/blocks/agent.mdx deleted file mode 100644 index 2c5030d91d..0000000000 --- a/apps/docs/content/docs/de/yaml/blocks/agent.mdx +++ /dev/null @@ -1,218 +0,0 @@ ---- -title: Agent Block YAML Schema -description: YAML-Konfigurationsreferenz für Agent-Blöcke ---- - -## Schema-Definition - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [agent] - description: Block type identifier - name: - type: string - description: Display name for this agent block - inputs: - type: object - properties: - systemPrompt: - type: string - description: Instructions that define the agent's role and behavior - userPrompt: - type: string - description: Input content to process (can reference other blocks) - model: - type: string - description: AI model identifier (e.g., gpt-4o, gemini-2.5-pro, deepseek-chat) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Response creativity level (varies by model) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - memories: - type: string - description: Memory context from memory blocks - tools: - type: array - description: List of external tools the agent can use - items: - type: object - required: [type, title, toolId, operation, usageControl] - properties: - type: - type: string - description: Tool type identifier - title: - type: string - description: Human-readable display name - toolId: - type: string - description: Internal tool identifier - operation: - type: string - description: Tool operation/method name - usageControl: - type: string - enum: [auto, required, none] - description: When AI can use the tool - params: - type: object - description: Tool-specific configuration parameters - isExpanded: - type: boolean - description: UI state - default: false - responseFormat: - type: object - description: JSON Schema to enforce structured output - required: - - model - - apiKey - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful execution - error: - type: string - description: Target block ID for error handling -``` - -## Tool-Konfiguration - -Tools werden als Array definiert, wobei jedes Tool diese Struktur hat: - -```yaml -tools: - - type: # Tool type identifier (exa, gmail, slack, etc.) - title: # Human-readable display name - toolId: # Internal tool identifier - operation: # Tool operation/method name - usageControl: # When AI can use it (auto | required | none) - params: # Tool-specific configuration parameters - isExpanded: # UI state (optional, default: false) -``` - -## Verbindungskonfiguration - -Verbindungen definieren, wohin der Workflow basierend auf Ausführungsergebnissen geht: - -```yaml -connections: - success: # Target block ID for successful execution - error: # Target block ID for error handling (optional) -``` - -## Beispiele - -### Einfacher Agent - -```yaml -content-agent: - type: agent - name: "Content Analyzer 1" - inputs: - systemPrompt: "You are a helpful content analyzer. Be concise and clear." - userPrompt: - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: summary-block - -summary-block: - type: agent - name: "Summary Generator" - inputs: - systemPrompt: "Create a brief summary of the analysis." - userPrompt: "Analyze this: " - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: final-step -``` - -### Agent mit Tools - -```yaml -research-agent: - type: agent - name: "Research Assistant" - inputs: - systemPrompt: "Research the topic and provide detailed information." - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - tools: - - type: exa - title: "Web Search" - toolId: exa_search - operation: exa_search - usageControl: auto - params: - apiKey: '{{EXA_API_KEY}}' - connections: - success: summary-block -``` - -### Strukturierte Ausgabe - -```yaml -data-extractor: - type: agent - name: "Extract Contact Info" - inputs: - systemPrompt: "Extract contact information from the text." - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - responseFormat: | - { - "name": "contact_extraction", - "schema": { - "type": "object", - "properties": { - "name": {"type": "string"}, - "email": {"type": "string"}, - "phone": {"type": "string"} - }, - "required": ["name"] - }, - "strict": true - } - connections: - success: save-contact -``` - -### Azure OpenAI - -```yaml -azure-agent: - type: agent - name: "Azure AI Assistant" - inputs: - systemPrompt: "You are a helpful assistant." - userPrompt: - model: gpt-4o - apiKey: '{{AZURE_OPENAI_API_KEY}}' - azureEndpoint: '{{AZURE_OPENAI_ENDPOINT}}' - azureApiVersion: "2024-07-01-preview" - connections: - success: response-block -``` \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/blocks/api.mdx b/apps/docs/content/docs/de/yaml/blocks/api.mdx deleted file mode 100644 index 1b4be05b00..0000000000 --- a/apps/docs/content/docs/de/yaml/blocks/api.mdx +++ /dev/null @@ -1,429 +0,0 @@ ---- -title: API Block YAML Schema -description: YAML-Konfigurationsreferenz für API-Blöcke ---- - -## Schema-Definition - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [api] - description: Block type identifier - name: - type: string - description: Display name for this API block - inputs: - type: object - required: - - url - - method - properties: - url: - type: string - description: The endpoint URL to send the request to - method: - type: string - enum: [GET, POST, PUT, DELETE, PATCH] - description: HTTP method for the request - default: GET - params: - type: array - description: Query parameters as table entries - items: - type: object - required: - - id - - cells - properties: - id: - type: string - description: Unique identifier for the parameter entry - cells: - type: object - required: - - Key - - Value - properties: - Key: - type: string - description: Parameter name - Value: - type: string - description: Parameter value - headers: - type: array - description: HTTP headers as table entries - items: - type: object - required: - - id - - cells - properties: - id: - type: string - description: Unique identifier for the header entry - cells: - type: object - required: - - Key - - Value - properties: - Key: - type: string - description: Header name - Value: - type: string - description: Header value - body: - type: string - description: Request body for POST/PUT/PATCH methods - timeout: - type: number - description: Request timeout in milliseconds - default: 30000 - minimum: 1000 - maximum: 300000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful requests - error: - type: string - description: Target block ID for error handling -``` - -## Verbindungskonfiguration - -Verbindungen definieren, wohin der Workflow basierend auf Anfrageergebnissen geht: - -```yaml -connections: - success: # Target block ID for successful requests - error: # Target block ID for error handling (optional) -``` - -## Beispiele - -### Einfache GET-Anfrage - -```yaml -user-api: - type: api - name: "Fetch User Data" - inputs: - url: "https://api.example.com/users/123" - method: GET - headers: - - id: header-1-uuid-here - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" - - id: header-2-uuid-here - cells: - Key: "Content-Type" - Value: "application/json" - connections: - success: process-user-data - error: handle-api-error -``` - -### POST-Anfrage mit Body - -```yaml -create-ticket: - type: api - name: "Create Support Ticket" - inputs: - url: "https://api.support.com/tickets" - method: POST - headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{SUPPORT_API_KEY}}" - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" - body: | - { - "title": "", - "description": "", - "priority": "high" - } - connections: - success: ticket-created - error: ticket-error -``` - -### Dynamische URL mit Abfrageparametern - -```yaml -search-api: - type: api - name: "Search Products" - inputs: - url: "https://api.store.com/products" - method: GET - params: - - id: search-param-uuid - cells: - Key: "q" - Value: - - id: limit-param-uuid - cells: - Key: "limit" - Value: "10" - - id: category-param-uuid - cells: - Key: "category" - Value: - headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{STORE_API_KEY}}" - connections: - success: display-results -``` - -## Parameterformat - -Header und Parameter (Abfrageparameter) verwenden das Tabellenformat mit folgender Struktur: - -```yaml -headers: - - id: unique-identifier-here - cells: - Key: "Content-Type" - Value: "application/json" - - id: another-unique-identifier - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" - -params: - - id: param-identifier-here - cells: - Key: "limit" - Value: "10" -``` - -**Strukturdetails:** -- `id`: Eindeutige Kennung zur Verfolgung der Tabellenzeile -- `cells.Key`: Der Parameter-/Header-Name -- `cells.Value`: Der Parameter-/Header-Wert -- Dieses Format ermöglicht eine ordnungsgemäße Tabellenverwaltung und Beibehaltung des UI-Status - -## Ausgabereferenzen - -Nach der Ausführung eines API-Blocks können Sie auf seine Ausgaben in nachfolgenden Blöcken verweisen. Der API-Block bietet drei Hauptausgaben: - -### Verfügbare Ausgaben - -| Ausgabe | Typ | Beschreibung | -|--------|------|-------------| -| `data` | any | Der Antworttext/die Nutzlast von der API | -| `status` | number | HTTP-Statuscode (200, 404, 500, usw.) | -| `headers` | object | Vom Server zurückgegebene Antwort-Header | - -### Verwendungsbeispiele - -```yaml -# Reference API response data -process-data: - type: function - name: "Process API Data" - inputs: - code: | - const responseData = ; - const statusCode = ; - const responseHeaders = ; - - if (statusCode === 200) { - return { - success: true, - user: responseData, - contentType: responseHeaders['content-type'] - }; - } else { - return { - success: false, - error: `API call failed with status ${statusCode}` - }; - } - -# Use API data in an agent block -analyze-response: - type: agent - name: "Analyze Response" - inputs: - userPrompt: | - Analyze this API response: - - Status: - Data: - - Provide insights about the response. - -# Conditional logic based on status -check-status: - type: condition - name: "Check API Status" - inputs: - condition: === 200 - connections: - true: success-handler - false: error-handler -``` - -### Praktisches Beispiel - -```yaml -user-api: - type: api - name: "Fetch User Data" - inputs: - url: "https://api.example.com/users/123" - method: GET - connections: - success: process-response - -process-response: - type: function - name: "Process Response" - inputs: - code: | - const user = ; - const status = ; - - console.log(`API returned status: ${status}`); - console.log(`User data:`, user); - - return { - userId: user.id, - email: user.email, - isActive: status === 200 - }; -``` - -### Fehlerbehandlung - -```yaml -api-with-error-handling: - type: api - name: "API Call" - inputs: - url: "https://api.example.com/data" - method: GET - connections: - success: check-response - error: handle-error - -check-response: - type: condition - name: "Check Response Status" - inputs: - condition: >= 200 && < 300 - connections: - true: process-success - false: handle-api-error - -process-success: - type: function - name: "Process Success" - inputs: - code: | - return { - success: true, - data: , - message: "API call successful" - }; - -handle-api-error: - type: function - name: "Handle API Error" - inputs: - code: | - return { - success: false, - status: , - error: "API call failed", - data: - }; -``` - -## YAML-String-Escaping - -Beim Schreiben von YAML müssen bestimmte Strings in Anführungszeichen gesetzt werden, um korrekt geparst zu werden: - -### Strings, die in Anführungszeichen gesetzt werden müssen - -```yaml -# URLs with hyphens, colons, special characters -url: "https://api.example.com/users/123" -url: "https://my-api.example.com/data" - -# Header values with hyphens or special characters -headers: - - id: header-uuid - cells: - Key: "User-Agent" - Value: "My-Application/1.0" - - id: auth-uuid - cells: - Key: "Authorization" - Value: "Bearer my-token-123" - -# Parameter values with hyphens -params: - - id: param-uuid - cells: - Key: "sort-by" - Value: "created-at" -``` - -### Wann Anführungszeichen verwendet werden sollten - -- ✅ **Immer in Anführungszeichen setzen**: URLs, Tokens, Werte mit Bindestrichen, Doppelpunkten oder Sonderzeichen -- ✅ **Immer in Anführungszeichen setzen**: Werte, die mit Zahlen beginnen, aber Strings sein sollen -- ✅ **Immer in Anführungszeichen setzen**: Boolean-ähnliche Strings, die als Strings erhalten bleiben sollen -- ❌ **Nicht in Anführungszeichen setzen**: Einfache alphanumerische Strings ohne Sonderzeichen - -### Beispiele - -```yaml -# ✅ Correct -url: "https://api.stripe.com/v1/charges" -headers: - - id: auth-header - cells: - Key: "Authorization" - Value: "Bearer sk-test-123456789" - -# ❌ Incorrect (may cause parsing errors) -url: https://api.stripe.com/v1/charges -headers: - - id: auth-header - cells: - Key: Authorization - Value: Bearer sk-test-123456789 -``` - -## Best Practices - -- Umgebungsvariablen für API-Schlüssel verwenden: `{{API_KEY_NAME}}` -- Fehlerbehandlung mit Fehlerverbindungen einbeziehen -- Angemessene Timeouts für deinen Anwendungsfall festlegen -- Statuscode der Antwort in nachfolgenden Blöcken validieren -- Aussagekräftige Blocknamen für einfachere Referenzierung verwenden -- **Strings mit Sonderzeichen, URLs und Tokens immer in Anführungszeichen setzen** \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/blocks/condition.mdx b/apps/docs/content/docs/de/yaml/blocks/condition.mdx deleted file mode 100644 index d855d93e26..0000000000 --- a/apps/docs/content/docs/de/yaml/blocks/condition.mdx +++ /dev/null @@ -1,165 +0,0 @@ ---- -title: Bedingungsblock YAML-Schema -description: YAML-Konfigurationsreferenz für Bedingungsblöcke ---- - -## Schema-Definition - -```yaml -type: object -required: - - type - - name - - inputs - - connections -properties: - type: - type: string - enum: [condition] - description: Block type identifier - name: - type: string - description: Display name for this condition block - inputs: - type: object - required: - - conditions - properties: - conditions: - type: object - description: Conditional expressions and their logic - properties: - if: - type: string - description: Primary condition expression (boolean) - else-if: - type: string - description: Secondary condition expression (optional) - else-if-2: - type: string - description: Third condition expression (optional) - else-if-3: - type: string - description: Fourth condition expression (optional) - # Additional else-if-N conditions can be added as needed - else: - type: boolean - description: Default fallback condition (optional) - default: true - connections: - type: object - required: - - conditions - properties: - conditions: - type: object - description: Target blocks for each condition outcome - properties: - if: - type: string - description: Target block ID when 'if' condition is true - else-if: - type: string - description: Target block ID when 'else-if' condition is true - else-if-2: - type: string - description: Target block ID when 'else-if-2' condition is true - else-if-3: - type: string - description: Target block ID when 'else-if-3' condition is true - # Additional else-if-N connections can be added as needed - else: - type: string - description: Target block ID when no conditions match -``` - -## Verbindungskonfiguration - -Im Gegensatz zu anderen Blöcken verwenden Bedingungen verzweigte Verbindungen basierend auf Bedingungsergebnissen: - -```yaml -connections: - conditions: - if: # Target block ID when primary condition is true - else-if: # Target block ID when secondary condition is true (optional) - else-if-2: # Target block ID when third condition is true (optional) - else-if-3: # Target block ID when fourth condition is true (optional) - # Additional else-if-N connections can be added as needed - else: # Target block ID when no conditions match (optional) -``` - -## Beispiele - -### Einfaches If-Else - -```yaml -status-check: - type: condition - name: "Status Check" - inputs: - conditions: - if: === "approved" - else: true - connections: - conditions: - if: send-approval-email - else: send-rejection-email -``` - -### Mehrere Bedingungen - -```yaml -user-routing: - type: condition - name: "User Type Router" - inputs: - conditions: - if: === "admin" - else-if: === "premium" - else-if-2: === "basic" - else: true - connections: - conditions: - if: admin-dashboard - else-if: premium-features - else-if-2: basic-features - else: registration-flow -``` - -### Numerische Vergleiche - -```yaml -score-evaluation: - type: condition - name: "Score Evaluation" - inputs: - conditions: - if: >= 90 - else-if: >= 70 - else-if-2: >= 50 - else: true - connections: - conditions: - if: excellent-response - else-if: good-response - else-if-2: average-response - else: poor-response -``` - -### Komplexe Logik - -```yaml -eligibility-check: - type: condition - name: "Eligibility Check" - inputs: - conditions: - if: >= 18 && === true - else-if: >= 16 && === true - else: true - connections: - conditions: - if: full-access - else-if: limited-access - else: access-denied -``` \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/blocks/evaluator.mdx b/apps/docs/content/docs/de/yaml/blocks/evaluator.mdx deleted file mode 100644 index 882ba84f34..0000000000 --- a/apps/docs/content/docs/de/yaml/blocks/evaluator.mdx +++ /dev/null @@ -1,255 +0,0 @@ ---- -title: Evaluator Block YAML Schema -description: YAML-Konfigurationsreferenz für Evaluator-Blöcke ---- - -## Schema-Definition - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [evaluator] - description: Block type identifier - name: - type: string - description: Display name for this evaluator block - inputs: - type: object - required: - - content - - metrics - - model - - apiKey - properties: - content: - type: string - description: Content to evaluate (can reference other blocks) - metrics: - type: array - description: Evaluation criteria and scoring ranges - items: - type: object - properties: - name: - type: string - description: Metric identifier - description: - type: string - description: Detailed explanation of what the metric measures - range: - type: object - properties: - min: - type: number - description: Minimum score value - max: - type: number - description: Maximum score value - required: [min, max] - description: Scoring range with numeric bounds - model: - type: string - description: AI model identifier (e.g., gpt-4o, claude-3-5-sonnet-20241022) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Model temperature for evaluation - default: 0.3 - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful evaluation - error: - type: string - description: Target block ID for error handling -``` - -## Verbindungskonfiguration - -Verbindungen definieren, wohin der Workflow basierend auf den Evaluierungsergebnissen geht: - -```yaml -connections: - success: # Target block ID for successful evaluation - error: # Target block ID for error handling (optional) -``` - -## Beispiele - -### Bewertung der Inhaltsqualität - -```yaml -content-evaluator: - type: evaluator - name: "Content Quality Evaluator" - inputs: - content: - metrics: - - name: "accuracy" - description: "How factually accurate is the content?" - range: - min: 1 - max: 5 - - name: "clarity" - description: "How clear and understandable is the content?" - range: - min: 1 - max: 5 - - name: "relevance" - description: "How relevant is the content to the original query?" - range: - min: 1 - max: 5 - - name: "completeness" - description: "How complete and comprehensive is the content?" - range: - min: 1 - max: 5 - model: gpt-4o - temperature: 0.2 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: quality-report - error: evaluation-error -``` - -### Bewertung der Kundenantwort - -```yaml -response-evaluator: - type: evaluator - name: "Customer Response Evaluator" - inputs: - content: - metrics: - - name: "helpfulness" - description: "How helpful is the response in addressing the customer's needs?" - range: - min: 1 - max: 10 - - name: "tone" - description: "How appropriate and professional is the tone?" - range: - min: 1 - max: 10 - - name: "completeness" - description: "Does the response fully address all aspects of the inquiry?" - range: - min: 1 - max: 10 - model: claude-3-5-sonnet-20241022 - apiKey: '{{ANTHROPIC_API_KEY}}' - connections: - success: response-processor -``` - -### A/B-Test-Evaluierung - -```yaml -ab-test-evaluator: - type: evaluator - name: "A/B Test Evaluator" - inputs: - content: | - Version A: - Version B: - - Compare these two versions for the following criteria. - metrics: - - name: "engagement" - description: "Which version is more likely to engage users?" - range: "A, B, or Tie" - - name: "clarity" - description: "Which version communicates more clearly?" - range: "A, B, or Tie" - - name: "persuasiveness" - description: "Which version is more persuasive?" - range: "A, B, or Tie" - model: gpt-4o - temperature: 0.1 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: test-results -``` - -### Mehrdimensionale Inhaltsbewertung - -```yaml -comprehensive-evaluator: - type: evaluator - name: "Comprehensive Content Evaluator" - inputs: - content: - metrics: - - name: "technical_accuracy" - description: "How technically accurate and correct is the information?" - range: - min: 0 - max: 100 - - name: "readability" - description: "How easy is the content to read and understand?" - range: - min: 0 - max: 100 - - name: "seo_optimization" - description: "How well optimized is the content for search engines?" - range: - min: 0 - max: 100 - - name: "user_engagement" - description: "How likely is this content to engage and retain readers?" - range: - min: 0 - max: 100 - - name: "brand_alignment" - description: "How well does the content align with brand voice and values?" - range: - min: 0 - max: 100 - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: content-optimization -``` - -## Output-Referenzen - -Nach der Ausführung eines Evaluator-Blocks können Sie auf seine Ausgaben verweisen: - -```yaml -# In subsequent blocks -next-block: - inputs: - evaluation: # Evaluation summary - scores: # Individual metric scores - overall: # Overall assessment -``` - -## Best Practices - -- Definieren Sie klare, spezifische Bewertungskriterien -- Verwenden Sie angemessene Bewertungsbereiche für Ihren Anwendungsfall -- Wählen Sie Modelle mit starken Argumentationsfähigkeiten -- Verwenden Sie niedrigere Temperaturwerte für konsistente Bewertungen -- Fügen Sie detaillierte Metrikbeschreibungen hinzu -- Testen Sie mit verschiedenen Inhaltstypen -- Erwägen Sie mehrere Evaluatoren für komplexe Bewertungen \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/blocks/function.mdx b/apps/docs/content/docs/de/yaml/blocks/function.mdx deleted file mode 100644 index 496d32f5bf..0000000000 --- a/apps/docs/content/docs/de/yaml/blocks/function.mdx +++ /dev/null @@ -1,162 +0,0 @@ ---- -title: Funktionsblock YAML-Schema -description: YAML-Konfigurationsreferenz für Funktionsblöcke ---- - -## Schema-Definition - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [function] - description: Block type identifier - name: - type: string - description: Display name for this function block - inputs: - type: object - required: - - code - properties: - code: - type: string - description: JavaScript/TypeScript code to execute (multiline string) - timeout: - type: number - description: Maximum execution time in milliseconds - default: 30000 - minimum: 1000 - maximum: 300000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful execution - error: - type: string - description: Target block ID for error handling -``` - -## Verbindungskonfiguration - -Verbindungen definieren, wohin der Workflow basierend auf den Ausführungsergebnissen geht: - -```yaml -connections: - success: # Target block ID for successful execution - error: # Target block ID for error handling (optional) -``` - -## Beispiele - -### Einfache Validierung - -```yaml -input-validator: - type: function - name: "Input Validator" - inputs: - code: |- - // Check if input number is greater than 5 - const inputValue = parseInt(, 10); - - if (inputValue > 5) { - return { - valid: true, - value: inputValue, - message: "Input is valid" - }; - } else { - return { - valid: false, - value: inputValue, - message: "Input must be greater than 5" - }; - } - connections: - success: next-step - error: handle-error -``` - -### Datenverarbeitung - -```yaml -data-processor: - type: function - name: "Data Transformer" - inputs: - code: | - // Transform the input data - const rawData = ; - - // Process and clean the data - const processed = rawData - .filter(item => item.status === 'active') - .map(item => ({ - id: item.id, - name: item.name.trim(), - date: new Date(item.created).toISOString() - })); - - return processed; - connections: - success: api-save - error: error-handler -``` - -### API-Integration - -```yaml -api-formatter: - type: function - name: "Format API Request" - inputs: - code: | - // Prepare data for API submission - const userData = ; - - const apiPayload = { - timestamp: new Date().toISOString(), - data: userData, - source: "workflow-automation", - version: "1.0" - }; - - return apiPayload; - connections: - success: api-call -``` - -### Berechnungen - -```yaml -calculator: - type: function - name: "Calculate Results" - inputs: - code: | - // Perform calculations on input data - const numbers = ; - - const sum = numbers.reduce((a, b) => a + b, 0); - const average = sum / numbers.length; - const max = Math.max(...numbers); - const min = Math.min(...numbers); - - return { - sum, - average, - max, - min, - count: numbers.length - }; - connections: - success: results-display -``` \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/blocks/index.mdx b/apps/docs/content/docs/de/yaml/blocks/index.mdx deleted file mode 100644 index 7f7eb85d99..0000000000 --- a/apps/docs/content/docs/de/yaml/blocks/index.mdx +++ /dev/null @@ -1,151 +0,0 @@ ---- -title: Block-Schemas -description: Vollständige YAML-Schema-Referenz für alle Sim-Blöcke ---- - -import { Card, Cards } from "fumadocs-ui/components/card"; - -Dieser Abschnitt enthält die vollständigen YAML-Schema-Definitionen für alle verfügbaren Blocktypen in Sim. Jeder Blocktyp hat spezifische Konfigurationsanforderungen und Ausgabeformate. - -## Kernblöcke - -Dies sind die wesentlichen Bausteine für die Erstellung von Workflows: - - - - Workflow-Einstiegspunkt mit Unterstützung für manuelle Auslöser, Webhooks und Zeitpläne - - - KI-gestützte Verarbeitung mit LLM-Integration und Tool-Unterstützung - - - Ausführungsumgebung für benutzerdefinierten JavaScript/TypeScript-Code - - - Formatierung und Rückgabe der endgültigen Workflow-Ergebnisse - - - -## Logik & Kontrollfluss - -Blöcke zur Implementierung von bedingter Logik und Kontrollfluss: - - - - Bedingte Verzweigung basierend auf booleschen Ausdrücken - - - KI-gestützte intelligente Weiterleitung zu mehreren Pfaden - - - Iterative Verarbeitung mit for- und forEach-Schleifen - - - Gleichzeitige Ausführung über mehrere Instanzen - - - -## Integrationsblöcke - -Blöcke zur Verbindung mit externen Diensten und Systemen: - - - - HTTP-Anfragen an externe REST-APIs - - - Webhook-Auslöser für externe Integrationen - - - -## Erweiterte Blöcke - -Spezialisierte Blöcke für komplexe Workflow-Muster: - - - - Validierung von Ausgaben anhand definierter Kriterien und Metriken - - - Ausführung anderer Workflows als wiederverwendbare Komponenten - - - -## Gemeinsame Schema-Elemente - -Alle Blöcke teilen diese gemeinsamen Elemente: - -### Grundstruktur - -```yaml -block-id: - type: - name: - inputs: - # Block-specific configuration - connections: - # Connection definitions -``` - -### Verbindungstypen - -- **success**: Zielblock für erfolgreiche Ausführung -- **error**: Zielblock für Fehlerbehandlung (optional) -- **conditions**: Mehrere Pfade für bedingte Blöcke - -### Umgebungsvariablen - -Verwende doppelte geschweifte Klammern für Umgebungsvariablen: - -```yaml -inputs: - apiKey: '{{API_KEY_NAME}}' - endpoint: '{{SERVICE_ENDPOINT}}' -``` - -### Blockreferenzen - -Referenziere andere Blockausgaben mit dem Blocknamen in Kleinbuchstaben: - -```yaml -inputs: - userPrompt: - data: - originalInput: -``` - -## Validierungsregeln - -Alle YAML-Blöcke werden anhand ihrer Schemas validiert: - -1. **Pflichtfelder**: Müssen vorhanden sein -2. **Typvalidierung**: Werte müssen den erwarteten Typen entsprechen -3. **Enum-Validierung**: Zeichenkettenwerte müssen aus erlaubten Listen stammen -4. **Bereichsvalidierung**: Zahlen müssen innerhalb festgelegter Bereiche liegen -5. **Mustervalidierung**: Zeichenketten müssen Regex-Mustern entsprechen (wo anwendbar) - -## Kurzreferenz - -### Blocktypen und Eigenschaften - -| Blocktyp | Primäre Ausgabe | Häufige Anwendungsfälle | -|------------|----------------|------------------| -| starter | `.input` | Workflow-Einstiegspunkt | -| agent | `.content` | KI-Verarbeitung, Texterstellung | -| function | `.output` | Datentransformation, Berechnungen | -| api | `.output` | Integration externer Dienste | -| condition | N/A (Verzweigung) | Bedingte Logik | -| router | N/A (Verzweigung) | Intelligentes Routing | -| response | N/A (Terminal) | Formatierung der Endausgabe | -| loop | `.results` | Iterative Verarbeitung | -| parallel | `.results` | Gleichzeitige Verarbeitung | -| webhook | `.payload` | Externe Auslöser | -| evaluator | `.score` | Ausgabevalidierung, Qualitätsbewertung | -| workflow | `.output` | Ausführung von Unterworkflows, Modularität | - -### Erforderlich vs. Optional - -- **Immer erforderlich**: `type`, `name` -- **Normalerweise erforderlich**: `inputs`, `connections` -- **Kontextabhängig**: Spezifische Eingabefelder variieren je nach Blocktyp -- **Immer optional**: `error`Verbindungen, UI-spezifische Felder \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/blocks/parallel.mdx b/apps/docs/content/docs/de/yaml/blocks/parallel.mdx deleted file mode 100644 index c13c9b4192..0000000000 --- a/apps/docs/content/docs/de/yaml/blocks/parallel.mdx +++ /dev/null @@ -1,312 +0,0 @@ ---- -title: Parallel Block YAML Schema -description: YAML-Konfigurationsreferenz für Parallel-Blöcke ---- - -## Schema-Definition - -```yaml -type: object -required: - - type - - name - - inputs - - connections -properties: - type: - type: string - enum: [parallel] - description: Block type identifier - name: - type: string - description: Display name for this parallel block - inputs: - type: object - required: - - parallelType - properties: - parallelType: - type: string - enum: [count, collection] - description: Type of parallel execution - count: - type: number - description: Number of parallel instances (for 'count' type) - minimum: 1 - maximum: 100 - collection: - type: string - description: Collection to distribute across instances (for 'collection' type) - maxConcurrency: - type: number - description: Maximum concurrent executions - default: 10 - minimum: 1 - maximum: 50 - connections: - type: object - required: - - parallel - properties: - parallel: - type: object - required: - - start - properties: - start: - type: string - description: Target block ID to execute inside each parallel instance - end: - type: string - description: Target block ID after all parallel instances complete (optional) - error: - type: string - description: Target block ID for error handling -``` - -## Verbindungskonfiguration - -Parallel-Blöcke verwenden ein spezielles Verbindungsformat mit einem `parallel` Abschnitt: - -```yaml -connections: - parallel: - start: # Target block ID to execute inside each parallel instance - end: # Target block ID after all instances complete (optional) - error: # Target block ID for error handling (optional) -``` - -## Konfiguration von untergeordneten Blöcken - -Blöcke innerhalb eines Parallel-Blocks müssen ihre `parentId` auf die Parallel-Block-ID setzen: - -```yaml -parallel-1: - type: parallel - name: "Process Items" - inputs: - parallelType: collection - collection: - connections: - parallel: - start: process-item - end: aggregate-results - -# Child block inside the parallel -process-item: - type: agent - name: "Process Item" - parentId: parallel-1 # References the parallel block - inputs: - systemPrompt: "Process this item" - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## Beispiele - -### Anzahlbasierte Parallelverarbeitung - -```yaml -worker-parallel: - type: parallel - name: "Worker Parallel" - inputs: - parallelType: count - count: 5 - maxConcurrency: 3 - connections: - parallel: - start: worker-task - end: collect-worker-results - -worker-task: - type: api - name: "Worker Task" - parentId: worker-parallel - inputs: - url: "https://api.worker.com/process" - method: POST - headers: - - key: "Authorization" - value: "Bearer {{WORKER_API_KEY}}" - body: | - { - "instanceId": , - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: worker-complete -``` - -### Sammlungsbasierte Parallelverarbeitung - -```yaml -api-parallel: - type: parallel - name: "API Parallel" - inputs: - parallelType: collection - collection: - maxConcurrency: 10 - connections: - parallel: - start: call-api - end: merge-api-results - -call-api: - type: api - name: "Call API" - parentId: api-parallel - inputs: - url: - method: - headers: - - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - connections: - success: api-complete -``` - -### Komplexe parallele Verarbeitungspipeline - -```yaml -data-processing-parallel: - type: parallel - name: "Data Processing Parallel" - inputs: - parallelType: collection - collection: - maxConcurrency: 8 - connections: - parallel: - start: validate-data - end: final-aggregation - error: parallel-error-handler - -validate-data: - type: function - name: "Validate Data" - parentId: data-processing-parallel - inputs: - code: | - const record = ; - const index = ; - - // Validate record structure - if (!record.id || !record.content) { - throw new Error(`Invalid record at index ${index}`); - } - - return { - valid: true, - recordId: record.id, - validatedAt: new Date().toISOString() - }; - connections: - success: process-data - error: validation-error - -process-data: - type: agent - name: "Process Data" - parentId: data-processing-parallel - inputs: - systemPrompt: "Process and analyze this data record" - userPrompt: | - Record ID: - Content: - Instance: - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: store-result - -store-result: - type: function - name: "Store Result" - parentId: data-processing-parallel - inputs: - code: | - const processed = ; - const recordId = ; - - return { - recordId, - processed, - completedAt: new Date().toISOString(), - instanceIndex: - }; -``` - -### Gleichzeitige KI-Analyse - -```yaml -multi-model-parallel: - type: parallel - name: "Multi-Model Analysis" - inputs: - parallelType: collection - collection: | - [ - {"model": "gpt-4o", "focus": "technical accuracy"}, - {"model": "claude-3-5-sonnet-20241022", "focus": "creative quality"}, - {"model": "gemini-2.0-flash-exp", "focus": "factual verification"} - ] - maxConcurrency: 3 - connections: - parallel: - start: analyze-content - end: combine-analyses - -analyze-content: - type: agent - name: "Analyze Content" - parentId: multi-model-parallel - inputs: - systemPrompt: | - You are analyzing content with a focus on . - Provide detailed analysis from this perspective. - userPrompt: | - Content to analyze: - Analysis focus: - model: - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: analysis-complete -``` - -## Parallele Variablen - -Innerhalb von untergeordneten Parallel-Blöcken sind diese speziellen Variablen verfügbar: - -```yaml -# Available in all child blocks of the parallel - # Instance number (0-based) - # Item for this instance (collection type) - # Full collection (collection type) -``` - -## Ausgabereferenzen - -Nach Abschluss eines Parallel-Blocks können Sie auf seine aggregierten Ergebnisse verweisen: - -```yaml -# In blocks after the parallel -final-processor: - inputs: - all-results: # Array of all instance results - total-count: # Number of instances completed -``` - -## Bewährte Praktiken - -- Verwenden Sie angemessene maxConcurrency, um APIs nicht zu überlasten -- Stellen Sie sicher, dass Operationen unabhängig sind und nicht voneinander abhängen -- Implementieren Sie Fehlerbehandlung für robuste parallele Ausführung -- Testen Sie zuerst mit kleinen Sammlungen -- Überwachen Sie Ratenbegrenzungen für externe APIs -- Verwenden Sie den Collection-Typ zur Verteilung von Arbeit, den Count-Typ für feste Instanzen -- Berücksichtigen Sie den Speicherverbrauch bei großen Sammlungen \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/blocks/response.mdx b/apps/docs/content/docs/de/yaml/blocks/response.mdx deleted file mode 100644 index 647260caae..0000000000 --- a/apps/docs/content/docs/de/yaml/blocks/response.mdx +++ /dev/null @@ -1,239 +0,0 @@ ---- -title: Response Block YAML Schema -description: YAML-Konfigurationsreferenz für Response-Blöcke ---- - -## Schema-Definition - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [response] - description: Block type identifier - name: - type: string - description: Display name for this response block - inputs: - type: object - properties: - dataMode: - type: string - enum: [structured, json] - description: Mode for defining response data structure - default: structured - builderData: - type: object - description: Structured response data (when dataMode is 'structured') - data: - type: object - description: JSON response data (when dataMode is 'json') - status: - type: number - description: HTTP status code - default: 200 - minimum: 100 - maximum: 599 - headers: - type: array - description: Response headers as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column -``` - -## Verbindungskonfiguration - -Response-Blöcke sind Endblöcke (keine ausgehenden Verbindungen) und definieren die endgültige Ausgabe: - -```yaml -# No connections object needed - Response blocks are always terminal -``` - -## Beispiele - -### Einfache Antwort - -```yaml -simple-response: - type: response - name: "Simple Response" - inputs: - data: - message: "Hello World" - timestamp: - status: 200 -``` - -### Erfolgreiche Antwort - -```yaml -success-response: - type: response - name: "Success Response" - inputs: - data: - success: true - user: - id: - name: - email: - created_at: - status: 201 - headers: - - key: "Location" - value: "/api/users/" - - key: "X-Created-By" - value: "workflow-engine" -``` - -### Antwort mit vollständigem Tabellenkopfformat - -Wenn Header über die UI-Tabellenschnittstelle erstellt werden, enthält das YAML zusätzliche Metadaten: - -```yaml -api-response: - type: response - name: "API Response" - inputs: - data: - message: "Request processed successfully" - id: - status: 200 - headers: - - id: header-1-uuid-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - - id: header-2-uuid-here - key: "Cache-Control" - value: "no-cache" - cells: - Key: "Cache-Control" - Value: "no-cache" - - id: header-3-uuid-here - key: "X-API-Version" - value: "2.1" - cells: - Key: "X-API-Version" - Value: "2.1" -``` - -### Fehlerantwort - -```yaml -error-response: - type: response - name: "Error Response" - inputs: - data: - error: true - message: - code: "VALIDATION_FAILED" - details: - status: 400 - headers: - - key: "X-Error-Code" - value: "VALIDATION_FAILED" -``` - -### Paginierte Antwort - -```yaml -paginated-response: - type: response - name: "Paginated Response" - inputs: - data: - data: - pagination: - page: - per_page: - total: - total_pages: - status: 200 - headers: - - key: "X-Total-Count" - value: - - key: "Cache-Control" - value: "public, max-age=300" - - key: "Content-Type" - value: "application/json" -``` - -## Tabellenparameterformate - -Der Response-Block unterstützt zwei Formate für Header: - -### Vereinfachtes Format (manuelles YAML) - -Beim manuellen Schreiben von YAML können Sie das vereinfachte Format verwenden: - -```yaml -headers: - - key: "Content-Type" - value: "application/json" - - key: "Cache-Control" - value: "no-cache" -``` - -### Vollständiges Tabellenformat (UI-generiert) - -Wenn Header über die UI-Tabellenschnittstelle erstellt werden, enthält das YAML zusätzliche Metadaten: - -```yaml -headers: - - id: unique-identifier-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" -``` - -**Wesentliche Unterschiede:** -- `id`: Eindeutiger Identifikator zur Verfolgung der Tabellenzeile -- `cells`: Anzeigewerte, die von der UI-Tabellenschnittstelle verwendet werden -- Beide Formate sind für die Workflow-Ausführung funktional gleichwertig -- Das vollständige Format bewahrt den UI-Status beim Importieren/Exportieren von Workflows - -**Wichtig:** Setzen Sie Header-Namen und Werte, die Sonderzeichen enthalten, immer in Anführungszeichen: - -```yaml -headers: - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" - - id: cache-control-uuid - cells: - Key: "Cache-Control" - Value: "no-cache" -``` - -``` \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/blocks/router.mdx b/apps/docs/content/docs/de/yaml/blocks/router.mdx deleted file mode 100644 index a808a5fb6f..0000000000 --- a/apps/docs/content/docs/de/yaml/blocks/router.mdx +++ /dev/null @@ -1,200 +0,0 @@ ---- -title: Router Block YAML Schema -description: YAML-Konfigurationsreferenz für Router-Blöcke ---- - -## Schema-Definition - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [router] - description: Block type identifier - name: - type: string - description: Display name for this router block - inputs: - type: object - required: - - prompt - - model - - apiKey - properties: - prompt: - type: string - description: Instructions for routing decisions and criteria - model: - type: string - description: AI model identifier (e.g., gpt-4o, gemini-2.5-pro, deepseek-chat) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Model temperature for routing decisions - default: 0.3 - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - connections: - type: object - description: Multiple connection paths for different routing outcomes - properties: - success: - type: array - items: - type: string - description: Array of target block IDs for routing destinations -``` - -## Verbindungskonfiguration - -Router-Blöcke verwenden ein success-Array, das alle möglichen Routing-Ziele enthält: - -```yaml -connections: - success: - - # Target block ID option 1 - - # Target block ID option 2 - - # Target block ID option 3 - # Additional target block IDs as needed -``` - -## Beispiele - -### Content-Type-Router - -```yaml -content-router: - type: router - name: "Content Type Router" - inputs: - prompt: | - Route this content based on its type: - - If it's a question, route to question-handler - - If it's a complaint, route to complaint-handler - - If it's feedback, route to feedback-handler - - If it's a request, route to request-handler - - Content: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - question-handler - - complaint-handler - - feedback-handler - - request-handler -``` - -### Prioritäts-Router - -```yaml -priority-router: - type: router - name: "Priority Router" - inputs: - prompt: | - Analyze the urgency and route accordingly: - - urgent-queue: High priority, needs immediate attention - - standard-queue: Normal priority, standard processing - - low-queue: Low priority, can be delayed - - Email content: - - Route based on urgency indicators, deadlines, and tone. - model: gpt-4o - temperature: 0.2 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - urgent-queue - - standard-queue - - low-queue -``` - -### Abteilungs-Router - -```yaml -department-router: - type: router - name: "Department Router" - inputs: - prompt: | - Route this customer inquiry to the appropriate department: - - - sales-team: Sales questions, pricing, demos - - support-team: Technical issues, bug reports, how-to questions - - billing-team: Payment issues, subscription changes, invoices - - general-team: General inquiries, feedback, other topics - - Customer message: - Customer type: - model: claude-3-5-sonnet-20241022 - apiKey: '{{ANTHROPIC_API_KEY}}' - connections: - success: - - sales-team - - support-team - - billing-team - - general-team -``` - -## Erweiterte Konfiguration - -### Multi-Modell-Router - -```yaml -model-selector-router: - type: router - name: "Model Selection Router" - inputs: - prompt: | - Based on the task complexity, route to the appropriate model: - - simple-gpt35: Simple questions, basic tasks - - advanced-gpt4: Complex analysis, detailed reasoning - - specialized-claude: Creative writing, nuanced analysis - - Task: - Complexity indicators: - model: gpt-4o-mini - temperature: 0.1 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - simple-gpt35 - - advanced-gpt4 - - specialized-claude -``` - -## Output-Referenzen - -Router-Blöcke erzeugen keine direkten Outputs, sondern steuern den Workflow-Pfad: - -```yaml -# Router decisions affect which subsequent blocks execute -# Access the routed block's outputs normally: -final-step: - inputs: - routed-result: -``` - -## Best Practices - -- Klare Routing-Kriterien im Prompt angeben -- Spezifische, beschreibende Namen für Zielblöcke verwenden -- Beispiele für Inhalte für jeden Routing-Pfad einschließen -- Niedrigere Temperaturwerte für konsistentes Routing verwenden -- Mit verschiedenen Eingabetypen testen, um genaues Routing sicherzustellen -- Fallback-Pfade für Sonderfälle berücksichtigen \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/blocks/starter.mdx b/apps/docs/content/docs/de/yaml/blocks/starter.mdx deleted file mode 100644 index c44aa25528..0000000000 --- a/apps/docs/content/docs/de/yaml/blocks/starter.mdx +++ /dev/null @@ -1,183 +0,0 @@ ---- -title: YAML-Schema für Starter-Block -description: YAML-Konfigurationsreferenz für Starter-Blöcke ---- - -## Schema-Definition - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [starter] - description: Block type identifier - name: - type: string - description: Display name for this starter block - inputs: - type: object - properties: - startWorkflow: - type: string - enum: [manual, webhook, schedule] - description: How the workflow should be triggered - default: manual - inputFormat: - type: array - description: Expected input structure for API calls (manual workflows) - items: - type: object - properties: - name: - type: string - description: Field name - type: - type: string - enum: [string, number, boolean, object, array] - description: Field type - scheduleType: - type: string - enum: [hourly, daily, weekly, monthly] - description: Schedule frequency (schedule workflows only) - hourlyMinute: - type: number - minimum: 0 - maximum: 59 - description: Minute of the hour to run (hourly schedules) - dailyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (daily schedules) - weeklyDay: - type: string - enum: [MON, TUE, WED, THU, FRI, SAT, SUN] - description: Day of week to run (weekly schedules) - weeklyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (weekly schedules) - monthlyDay: - type: number - minimum: 1 - maximum: 28 - description: Day of month to run (monthly schedules) - monthlyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (monthly schedules) - timezone: - type: string - description: Timezone for scheduled workflows - default: UTC - webhookProvider: - type: string - enum: [slack, gmail, airtable, telegram, generic, whatsapp, github, discord, stripe] - description: Provider for webhook integration (webhook workflows only) - webhookConfig: - type: object - description: Provider-specific webhook configuration - connections: - type: object - properties: - success: - type: string - description: Target block ID to execute when workflow starts -``` - -## Verbindungskonfiguration - -Der Starter-Block hat nur eine Erfolgsverbindung, da er der Einstiegspunkt ist: - -```yaml -connections: - success: # Target block ID to execute when workflow starts -``` - -## Beispiele - -### Manueller Start - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: next-block -``` - -### Manueller Start mit Eingabeformat - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: manual - inputFormat: - - name: query - type: string - - name: email - type: string - - name: age - type: number - - name: isActive - type: boolean - - name: preferences - type: object - - name: tags - type: array - connections: - success: agent-1 -``` - -### Täglicher Zeitplan - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: schedule - scheduleType: daily - dailyTime: "09:00" - timezone: "America/New_York" - connections: - success: daily-task -``` - -### Wöchentlicher Zeitplan - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: schedule - scheduleType: weekly - weeklyDay: MON - weeklyTime: "08:30" - timezone: UTC - connections: - success: weekly-report -``` - -### Webhook-Auslöser - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: webhook - webhookProvider: slack - webhookConfig: - # Provider-specific configuration - connections: - success: process-webhook -``` \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/blocks/webhook.mdx b/apps/docs/content/docs/de/yaml/blocks/webhook.mdx deleted file mode 100644 index 02523d200f..0000000000 --- a/apps/docs/content/docs/de/yaml/blocks/webhook.mdx +++ /dev/null @@ -1,403 +0,0 @@ ---- -title: Webhook-Block YAML-Schema -description: YAML-Konfigurationsreferenz für Webhook-Blöcke ---- - -## Schema-Definition - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [webhook] - description: Block type identifier - name: - type: string - description: Display name for this webhook block - inputs: - type: object - properties: - webhookConfig: - type: object - description: Webhook configuration settings - properties: - enabled: - type: boolean - description: Whether the webhook is active - default: true - secret: - type: string - description: Secret key for webhook verification - headers: - type: array - description: Expected headers for validation as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Expected header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column - methods: - type: array - description: Allowed HTTP methods - items: - type: string - enum: [GET, POST, PUT, DELETE, PATCH] - default: [POST] - responseConfig: - type: object - description: Response configuration for the webhook - properties: - status: - type: number - description: HTTP status code to return - default: 200 - minimum: 100 - maximum: 599 - headers: - type: array - description: Response headers as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column - body: - type: string - description: Response body content - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful webhook processing - error: - type: string - description: Target block ID for error handling -``` - -## Verbindungskonfiguration - -Verbindungen definieren, wohin der Workflow basierend auf der Webhook-Verarbeitung geht: - -```yaml -connections: - success: # Target block ID for successful processing - error: # Target block ID for error handling (optional) -``` - -## Beispiele - -### Einfacher Webhook-Auslöser - -```yaml -github-webhook: - type: webhook - name: "GitHub Webhook" - inputs: - webhookConfig: - enabled: true - secret: "{{GITHUB_WEBHOOK_SECRET}}" - methods: [POST] - headers: - - key: "X-GitHub-Event" - value: "push" - responseConfig: - status: 200 - body: | - { - "message": "Webhook received successfully", - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: process-github-event - error: webhook-error-handler -``` - -### Slack-Event-Webhook - -```yaml -slack-events: - type: webhook - name: "Slack Events" - inputs: - webhookConfig: - enabled: true - secret: "{{SLACK_SIGNING_SECRET}}" - methods: [POST] - headers: - - key: "Content-Type" - value: "application/json" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "challenge": "" - } - connections: - success: handle-slack-event -``` - -### Zahlungs-Webhook (Stripe) - -```yaml -stripe-webhook: - type: webhook - name: "Stripe Payment Webhook" - inputs: - webhookConfig: - enabled: true - secret: "{{STRIPE_WEBHOOK_SECRET}}" - methods: [POST] - headers: - - key: "Stripe-Signature" - value: "*" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "received": true - } - connections: - success: process-payment-event - error: payment-webhook-error -``` - -### Webhook mit vollständigem Tabellenkopfformat - -Wenn Header über die UI-Tabellenschnittstelle erstellt werden, enthält das YAML zusätzliche Metadaten: - -```yaml -api-webhook-complete: - type: webhook - name: "API Webhook with Table Headers" - inputs: - webhookConfig: - enabled: true - methods: [POST] - headers: - - id: header-1-uuid-here - key: "Authorization" - value: "Bearer {{WEBHOOK_API_KEY}}" - cells: - Key: "Authorization" - Value: "Bearer {{WEBHOOK_API_KEY}}" - - id: header-2-uuid-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - responseConfig: - status: 200 - headers: - - id: response-header-1-uuid - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - - id: response-header-2-uuid - key: "X-Webhook-Response" - value: "processed" - cells: - Key: "X-Webhook-Response" - Value: "processed" - body: | - { - "status": "received", - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: process-webhook-complete -``` - -### Generischer API-Webhook - -```yaml -api-webhook: - type: webhook - name: "API Webhook" - inputs: - webhookConfig: - enabled: true - methods: [POST, PUT] - headers: - - key: "Authorization" - value: "Bearer {{WEBHOOK_API_KEY}}" - - key: "Content-Type" - value: "application/json" - responseConfig: - status: 202 - headers: - - key: "Content-Type" - value: "application/json" - - key: "X-Processed-By" - value: "Sim" - body: | - { - "status": "accepted", - "id": "{{Math.random().toString(36).substr(2, 9)}}", - "received_at": "{{new Date().toISOString()}}" - } - connections: - success: process-webhook-data -``` - -### Multi-Methoden-Webhook - -```yaml -crud-webhook: - type: webhook - name: "CRUD Webhook" - inputs: - webhookConfig: - enabled: true - methods: [GET, POST, PUT, DELETE] - headers: - - key: "X-API-Key" - value: "{{CRUD_API_KEY}}" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "method": "", - "processed": true, - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: route-by-method -``` - -## Tabellenparameterformate - -Der Webhook-Block unterstützt zwei Formate für Header (sowohl Validierungs-Header als auch Antwort-Header): - -### Vereinfachtes Format (manuelles YAML) - -Beim manuellen Schreiben von YAML können Sie das vereinfachte Format verwenden: - -```yaml -headers: - - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - - key: "Content-Type" - value: "application/json" -``` - -### Vollständiges Tabellenformat (UI-generiert) - -Wenn Header über die UI-Tabellenschnittstelle erstellt werden, enthält das YAML zusätzliche Metadaten: - -```yaml -headers: - - id: unique-identifier-here - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" -``` - -**Wesentliche Unterschiede:** -- `id`: Eindeutige Kennung zur Verfolgung der Tabellenzeile -- `cells`: Anzeigewerte, die von der UI-Tabellenschnittstelle verwendet werden -- Beide Formate sind für die Webhook-Verarbeitung funktional gleichwertig -- Das vollständige Format bewahrt den UI-Status beim Importieren/Exportieren von Workflows - -**Wichtig:** Setzen Sie Headernamen und Werte, die Sonderzeichen enthalten, immer in Anführungszeichen: - -```yaml -headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{WEBHOOK_API_KEY}}" - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" -``` - -## Webhook-Variablen - -In Webhook-ausgelösten Workflows sind diese speziellen Variablen verfügbar: - -```yaml -# Available in blocks after the webhook - # Full request payload/body - # Request headers - # HTTP method used - # Query parameters - # Request path - # Challenge parameter (for verification) -``` - -## Ausgabereferenzen - -Nachdem ein Webhook eine Anfrage verarbeitet hat, können Sie auf seine Daten verweisen: - -```yaml -# In subsequent blocks -process-webhook: - inputs: - payload: # Request payload - headers: # Request headers - method: # HTTP method -``` - -## Sicherheits-Best-Practices - -- Verwenden Sie immer Webhook-Geheimnisse zur Verifizierung -- Validieren Sie erwartete Header und Methoden -- Implementieren Sie angemessene Fehlerbehandlung -- Verwenden Sie HTTPS-Endpunkte in der Produktion -- Überwachen Sie Webhook-Aktivitäten und -Fehler -- Setzen Sie angemessene Antwort-Timeouts -- Validieren Sie die Payload-Struktur vor der Verarbeitung \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/blocks/workflow.mdx b/apps/docs/content/docs/de/yaml/blocks/workflow.mdx deleted file mode 100644 index aeed591a4e..0000000000 --- a/apps/docs/content/docs/de/yaml/blocks/workflow.mdx +++ /dev/null @@ -1,299 +0,0 @@ ---- -title: YAML-Schema für Workflow-Blöcke -description: YAML-Konfigurationsreferenz für Workflow-Blöcke ---- - -## Schema-Definition - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [workflow] - description: Block type identifier - name: - type: string - description: Display name for this workflow block - inputs: - type: object - required: - - workflowId - properties: - workflowId: - type: string - description: ID of the workflow to execute - inputMapping: - type: object - description: Map current workflow data to sub-workflow inputs - additionalProperties: - type: string - description: Input value or reference to parent workflow data - environmentVariables: - type: object - description: Environment variables to pass to sub-workflow - additionalProperties: - type: string - description: Environment variable value - timeout: - type: number - description: Maximum execution time in milliseconds - default: 300000 - minimum: 1000 - maximum: 1800000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful workflow completion - error: - type: string - description: Target block ID for error handling -``` - -## Verbindungskonfiguration - -Verbindungen definieren, wohin der Workflow basierend auf den Ergebnissen des Unter-Workflows geht: - -```yaml -connections: - success: # Target block ID for successful completion - error: # Target block ID for error handling (optional) -``` - -## Beispiele - -### Einfache Workflow-Ausführung - -```yaml -data-processor: - type: workflow - name: "Data Processing Workflow" - inputs: - workflowId: "data-processing-v2" - inputMapping: - rawData: - userId: - environmentVariables: - PROCESSING_MODE: "production" - LOG_LEVEL: "info" - connections: - success: process-results - error: workflow-error-handler -``` - -### Content-Generierungs-Pipeline - -```yaml -content-generator: - type: workflow - name: "Content Generation Pipeline" - inputs: - workflowId: "content-generation-v3" - inputMapping: - topic: - style: - targetAudience: - brandGuidelines: - environmentVariables: - CONTENT_API_KEY: "{{CONTENT_API_KEY}}" - QUALITY_THRESHOLD: "high" - timeout: 120000 - connections: - success: review-content - error: content-generation-failed -``` - -### Mehrstufiger Analyse-Workflow - -```yaml -analysis-workflow: - type: workflow - name: "Analysis Workflow" - inputs: - workflowId: "comprehensive-analysis" - inputMapping: - document: - analysisType: "comprehensive" - includeMetrics: true - outputFormat: "structured" - environmentVariables: - ANALYSIS_MODEL: "gpt-4o" - OPENAI_API_KEY: "{{OPENAI_API_KEY}}" - CLAUDE_API_KEY: "{{CLAUDE_API_KEY}}" - connections: - success: compile-analysis-report - error: analysis-workflow-error -``` - -### Bedingte Workflow-Ausführung - -```yaml -customer-workflow-router: - type: condition - name: "Customer Workflow Router" - inputs: - conditions: - if: === "enterprise" - else-if: === "premium" - else: true - connections: - conditions: - if: enterprise-workflow - else-if: premium-workflow - else: standard-workflow - -enterprise-workflow: - type: workflow - name: "Enterprise Customer Workflow" - inputs: - workflowId: "enterprise-customer-processing" - inputMapping: - customerData: - accountManager: - tier: "enterprise" - environmentVariables: - PRIORITY_LEVEL: "high" - SLA_REQUIREMENTS: "strict" - connections: - success: enterprise-complete - -premium-workflow: - type: workflow - name: "Premium Customer Workflow" - inputs: - workflowId: "premium-customer-processing" - inputMapping: - customerData: - supportLevel: "premium" - environmentVariables: - PRIORITY_LEVEL: "medium" - connections: - success: premium-complete - -standard-workflow: - type: workflow - name: "Standard Customer Workflow" - inputs: - workflowId: "standard-customer-processing" - inputMapping: - customerData: - environmentVariables: - PRIORITY_LEVEL: "standard" - connections: - success: standard-complete -``` - -### Parallele Workflow-Ausführung - -```yaml -parallel-workflows: - type: parallel - name: "Parallel Workflow Processing" - inputs: - parallelType: collection - collection: | - [ - {"workflowId": "sentiment-analysis", "focus": "sentiment"}, - {"workflowId": "topic-extraction", "focus": "topics"}, - {"workflowId": "entity-recognition", "focus": "entities"} - ] - connections: - success: merge-workflow-results - -execute-analysis-workflow: - type: workflow - name: "Execute Analysis Workflow" - parentId: parallel-workflows - inputs: - workflowId: - inputMapping: - content: - analysisType: - environmentVariables: - ANALYSIS_API_KEY: "{{ANALYSIS_API_KEY}}" - connections: - success: workflow-complete -``` - -### Workflow zur Fehlerbehandlung - -```yaml -main-workflow: - type: workflow - name: "Main Processing Workflow" - inputs: - workflowId: "main-processing-v1" - inputMapping: - data: - timeout: 180000 - connections: - success: main-complete - error: error-recovery-workflow - -error-recovery-workflow: - type: workflow - name: "Error Recovery Workflow" - inputs: - workflowId: "error-recovery-v1" - inputMapping: - originalInput: - errorDetails: - failureTimestamp: "{{new Date().toISOString()}}" - environmentVariables: - RECOVERY_MODE: "automatic" - FALLBACK_ENABLED: "true" - connections: - success: recovery-complete - error: manual-intervention-required -``` - -## Input-Mapping - -Daten vom übergeordneten Workflow zum Unter-Workflow zuordnen: - -```yaml -inputMapping: - # Static values - mode: "production" - version: "1.0" - - # References to parent workflow data - userData: - settings: - - # Complex object mapping - requestData: - id: - timestamp: "{{new Date().toISOString()}}" - source: "parent-workflow" -``` - -## Output-Referenzen - -Nach Abschluss eines Workflow-Blocks können Sie auf dessen Ausgaben verweisen: - -```yaml -# In subsequent blocks -next-block: - inputs: - workflowResult: # Sub-workflow output - executionTime: # Execution duration - status: # Execution status -``` - -## Bewährte Praktiken - -- Verwenden Sie aussagekräftige Workflow-IDs für mehr Klarheit -- Übertragen Sie nur notwendige Daten an Sub-Workflows -- Setzen Sie angemessene Timeouts entsprechend der Workflow-Komplexität -- Integrieren Sie Fehlerbehandlung für robuste Ausführung -- Übergeben Sie Umgebungsvariablen sicher -- Testen Sie Sub-Workflows zuerst unabhängig voneinander -- Überwachen Sie die Leistung verschachtelter Workflows -- Verwenden Sie versionierte Workflow-IDs für Stabilität \ No newline at end of file diff --git a/apps/docs/content/docs/de/yaml/examples.mdx b/apps/docs/content/docs/de/yaml/examples.mdx deleted file mode 100644 index 588691aa84..0000000000 --- a/apps/docs/content/docs/de/yaml/examples.mdx +++ /dev/null @@ -1,273 +0,0 @@ ---- -title: YAML Workflow Beispiele -description: Beispiele vollständiger YAML-Workflows ---- - -import { Tab, Tabs } from 'fumadocs-ui/components/tabs' - -## Multi-Agent-Ketten-Workflow - -Ein Workflow, bei dem mehrere KI-Agenten Informationen sequentiell verarbeiten: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: agent-1-initiator - - agent-1-initiator: - type: agent - name: Agent 1 Initiator - inputs: - systemPrompt: You are the first agent in a chain. Your role is to analyze the input and create an initial response that will be passed to the next agent. - userPrompt: |- - Welcome! I'm the first agent in our chain. - - Input to process: - - Please create an initial analysis or greeting that the next agent can build upon. Be creative and set a positive tone for the chain! - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-2-enhancer - - agent-2-enhancer: - type: agent - name: Agent 2 Enhancer - inputs: - systemPrompt: You are the second agent in a chain. Take the output from Agent 1 and enhance it with additional insights or improvements. - userPrompt: |- - I'm the second agent! Here's what Agent 1 provided: - - - - Now I'll enhance this with additional details, insights, or improvements. Let me build upon their work! - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-3-refiner - - agent-3-refiner: - type: agent - name: Agent 3 Refiner - inputs: - systemPrompt: You are the third agent in a chain. Take the enhanced output from Agent 2 and refine it further, adding structure or organization. - userPrompt: |- - I'm the third agent in our chain! Here's the enhanced work from Agent 2: - - - - My job is to refine and organize this content. I'll add structure, clarity, and polish to make it even better! - model: gpt-4o - temperature: 0.6 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-4-finalizer - - agent-4-finalizer: - type: agent - name: Agent 4 Finalizer - inputs: - systemPrompt: You are the final agent in a chain of 4. Create a comprehensive summary and conclusion based on all the previous agents' work. - userPrompt: |- - I'm the final agent! Here's the refined work from Agent 3: - - - - As the last agent in our chain, I'll create a final, polished summary that brings together all the work from our team of 4 agents. Let me conclude this beautifully! - model: gpt-4o - temperature: 0.5 - apiKey: '{{OPENAI_API_KEY}}' -``` - -## Router-basierter bedingter Workflow - -Ein Workflow, der Routing-Logik verwendet, um Daten basierend auf Bedingungen an verschiedene Agenten zu senden: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: router-1 - - router-1: - type: router - name: Router 1 - inputs: - prompt: go to agent 1 if is greater than 5. else agent 2 if greater than 10. else agent 3 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - agent-1 - - agent-2 - - agent-3 - - agent-1: - type: agent - name: Agent 1 - inputs: - systemPrompt: say 1 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - - agent-2: - type: agent - name: Agent 2 - inputs: - systemPrompt: say 2 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - - agent-3: - type: agent - name: Agent 3 - inputs: - systemPrompt: say 3 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## Websuche mit strukturierter Ausgabe - -Ein Workflow, der das Web mit Tools durchsucht und strukturierte Daten zurückgibt: - -```yaml -version: '1.0' -blocks: - 59eb07c1-1411-4b28-a274-fa78f55daf72: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: d77c2c98-56c4-432d-9338-9bac54a2d42f - d77c2c98-56c4-432d-9338-9bac54a2d42f: - type: agent - name: Agent 1 - inputs: - systemPrompt: look up the user input. use structured output - userPrompt: - model: claude-sonnet-4-0 - apiKey: '{{ANTHROPIC_API_KEY}}' - tools: - - type: exa - title: Exa - params: - type: auto - apiKey: '{{EXA_API_KEY}}' - numResults: '' - toolId: exa_search - operation: exa_search - isExpanded: true - usageControl: auto - responseFormat: |- - { - "name": "output_schema", - "description": "Defines the structure for an output object.", - "strict": true, - "schema": { - "type": "object", - "properties": { - "output": { - "type": "string", - "description": "The output value" - } - }, - "additionalProperties": false, - "required": ["output"] - } - } -``` - -## Schleifenverarbeitung mit Sammlung - -Ein Workflow, der jedes Element in einer Sammlung mithilfe einer Schleife verarbeitet: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: food-analysis-loop - food-analysis-loop: - type: loop - name: Food Analysis Loop - inputs: - count: 5 - loopType: forEach - collection: '["apple", "banana", "carrot"]' - connections: - loop: - start: calorie-agent - calorie-agent: - type: agent - name: Calorie Analyzer - inputs: - systemPrompt: Return the number of calories in the food - userPrompt: - model: claude-sonnet-4-0 - apiKey: '{{ANTHROPIC_API_KEY}}' - parentId: food-analysis-loop -``` - -## E-Mail-Klassifizierung und -Antwort - -Ein Workflow, der E-Mails klassifiziert und passende Antworten generiert: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: email-classifier - - email-classifier: - type: agent - name: Email Classifier - inputs: - systemPrompt: Classify emails into categories and extract key information. - userPrompt: | - Classify this email: - - Categories: support, billing, sales, feedback - Extract: urgency level, customer sentiment, main request - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: response-generator - - response-generator: - type: agent - name: Response Generator - inputs: - systemPrompt: Generate appropriate responses based on email classification. - userPrompt: | - Email classification: - Original email: - - Generate a professional, helpful response addressing the customer's needs. - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' -``` diff --git a/apps/docs/content/docs/de/yaml/index.mdx b/apps/docs/content/docs/de/yaml/index.mdx deleted file mode 100644 index d27e6fc871..0000000000 --- a/apps/docs/content/docs/de/yaml/index.mdx +++ /dev/null @@ -1,159 +0,0 @@ ---- -title: YAML Workflow Referenz -description: Vollständiger Leitfaden zum Schreiben von YAML-Workflows in Sim ---- - -import { Card, Cards } from "fumadocs-ui/components/card"; -import { Step, Steps } from "fumadocs-ui/components/steps"; -import { Tab, Tabs } from "fumadocs-ui/components/tabs"; - -YAML-Workflows bieten eine leistungsstarke Möglichkeit, Workflow-Konfigurationen in Sim zu definieren, zu versionieren und zu teilen. Dieser Referenzleitfaden behandelt die vollständige YAML-Syntax, Block-Schemas und Best Practices für die Erstellung robuster Workflows. - -## Schnellstart - -Jeder Sim-Workflow folgt dieser grundlegenden Struktur: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: agent-1 - - agent-1: - type: agent - name: "AI Assistant" - inputs: - systemPrompt: "You are a helpful assistant." - userPrompt: 'Hi' - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## Kernkonzepte - - - - Versionsdeklaration: Muss genau `version: '1.0'` (mit Anführungszeichen) sein - - - Blockstruktur: Alle Workflow-Blöcke werden unter dem Schlüssel `blocks` definiert - - - Block-Referenzen: Verwenden Sie Blocknamen in Kleinbuchstaben ohne Leerzeichen (z.B. ``) - - - Umgebungsvariablen: Referenzierung mit doppelten geschweiften Klammern `{{VARIABLE_NAME}}` - - - -## Blocktypen - -Sim unterstützt mehrere Kern-Blocktypen, jeder mit spezifischen YAML-Schemas: - - - - Workflow-Einstiegspunkt mit Unterstützung für manuelle, Webhook- und geplante Trigger - - - KI-gestützte Verarbeitung mit Unterstützung für Tools und strukturierte Ausgabe - - - Ausführung von benutzerdefiniertem JavaScript/TypeScript-Code - - - HTTP-Anfragen an externe Dienste - - - Bedingte Verzweigung basierend auf booleschen Ausdrücken - - - KI-gestützte intelligente Weiterleitung zu mehreren Pfaden - - - Iterative Verarbeitung mit for- und forEach-Schleifen - - - Gleichzeitige Ausführung über mehrere Instanzen - - - Webhook-Trigger für externe Integrationen - - - Validierung von Ausgaben anhand definierter Kriterien und Metriken - - - Ausführung anderer Workflows als wiederverwendbare Komponenten - - - Formatierung der endgültigen Workflow-Ausgabe - - - -## Block-Referenz-Syntax - -Der wichtigste Aspekt von YAML-Workflows ist das Verständnis, wie man Daten zwischen Blöcken referenziert: - -### Grundregeln - -1. **Verwende den Blocknamen** (nicht die Block-ID), umgewandelt in Kleinbuchstaben ohne Leerzeichen -2. **Füge die entsprechende Eigenschaft hinzu** (.content für Agenten, .output für Tools) -3. **Bei Verwendung von Chat, referenziere den Starter-Block** als `` - -### Beispiele - -```yaml -# Block definitions -email-processor: - type: agent - name: "Email Agent" - # ... configuration - -data-formatter: - type: function - name: "Data Agent" - # ... configuration - -# Referencing their outputs -next-block: - type: agent - name: "Next Step" - inputs: - userPrompt: | - Process this email: - Use this formatted data: - Original input: -``` - -### Sonderfälle - -- **Schleifenvariablen**: ``, ``, `` -- **Parallele Variablen**: ``, `` - -## Umgebungsvariablen - -Verwende Umgebungsvariablen für sensible Daten wie API-Schlüssel: - -```yaml -inputs: - apiKey: '{{OPENAI_API_KEY}}' - database: '{{DATABASE_URL}}' - token: '{{SLACK_BOT_TOKEN}}' -``` - -## Best Practices - -- **Halte Blocknamen benutzerfreundlich**: "Email Processor" für die UI-Anzeige -- **Referenziere Umgebungsvariablen**: Niemals API-Schlüssel fest codieren -- **Strukturiere für Lesbarkeit**: Gruppiere zusammengehörige Blöcke logisch -- **Teste schrittweise**: Baue Workflows Schritt für Schritt auf - -## Nächste Schritte - -- [Block-Referenz-Syntax](/yaml/block-reference) - Detaillierte Referenzregeln -- [Vollständige Block-Schemas](/yaml/blocks) - Alle verfügbaren Blocktypen -- [Workflow-Beispiele](/yaml/examples) - Praxisnahe Workflow-Muster \ No newline at end of file diff --git a/apps/docs/content/docs/en/sdks/typescript.mdx b/apps/docs/content/docs/en/sdks/typescript.mdx index 974e15442d..ad12f06751 100644 --- a/apps/docs/content/docs/en/sdks/typescript.mdx +++ b/apps/docs/content/docs/en/sdks/typescript.mdx @@ -1039,34 +1039,6 @@ function StreamingWorkflow() { - Node.js 16+ - TypeScript 5.0+ (for TypeScript projects) -## TypeScript Support - -The SDK is written in TypeScript and provides full type safety: - -```typescript -import { - SimStudioClient, - WorkflowExecutionResult, - WorkflowStatus, - SimStudioError -} from 'simstudio-ts-sdk'; - -// Type-safe client initialization -const client: SimStudioClient = new SimStudioClient({ - apiKey: process.env.SIM_API_KEY! -}); - -// Type-safe workflow execution -const result: WorkflowExecutionResult = await client.executeWorkflow('workflow-id', { - input: { - message: 'Hello, TypeScript!' - } -}); - -// Type-safe status checking -const status: WorkflowStatus = await client.getWorkflowStatus('workflow-id'); -``` - ## License Apache-2.0 diff --git a/apps/docs/content/docs/en/tools/knowledge.mdx b/apps/docs/content/docs/en/tools/knowledge.mdx index 40e96aef13..bcc1dccf58 100644 --- a/apps/docs/content/docs/en/tools/knowledge.mdx +++ b/apps/docs/content/docs/en/tools/knowledge.mdx @@ -66,7 +66,7 @@ Search for similar content in a knowledge base using vector similarity | `knowledgeBaseId` | string | Yes | ID of the knowledge base to search in | | `query` | string | No | Search query text \(optional when using tag filters\) | | `topK` | number | No | Number of most similar results to return \(1-100\) | -| `tagFilters` | any | No | Array of tag filters with tagName and tagValue properties | +| `tagFilters` | array | No | Array of tag filters with tagName and tagValue properties | #### Output diff --git a/apps/docs/content/docs/en/tools/supabase.mdx b/apps/docs/content/docs/en/tools/supabase.mdx index 7f0cbe4dbd..9289526743 100644 --- a/apps/docs/content/docs/en/tools/supabase.mdx +++ b/apps/docs/content/docs/en/tools/supabase.mdx @@ -114,7 +114,7 @@ Insert data into a Supabase table | --------- | ---- | -------- | ----------- | | `projectId` | string | Yes | Your Supabase project ID \(e.g., jdrkgepadsdopsntdlom\) | | `table` | string | Yes | The name of the Supabase table to insert data into | -| `data` | any | Yes | The data to insert | +| `data` | array | Yes | The data to insert \(array of objects or a single object\) | | `apiKey` | string | Yes | Your Supabase service role secret key | #### Output @@ -195,7 +195,7 @@ Insert or update data in a Supabase table (upsert operation) | --------- | ---- | -------- | ----------- | | `projectId` | string | Yes | Your Supabase project ID \(e.g., jdrkgepadsdopsntdlom\) | | `table` | string | Yes | The name of the Supabase table to upsert data into | -| `data` | any | Yes | The data to upsert \(insert or update\) | +| `data` | array | Yes | The data to upsert \(insert or update\) - array of objects or a single object | | `apiKey` | string | Yes | Your Supabase service role secret key | #### Output diff --git a/apps/docs/content/docs/en/tools/telegram.mdx b/apps/docs/content/docs/en/tools/telegram.mdx index 22e9c74349..97628a0b45 100644 --- a/apps/docs/content/docs/en/tools/telegram.mdx +++ b/apps/docs/content/docs/en/tools/telegram.mdx @@ -89,12 +89,8 @@ Send messages to Telegram channels or users through the Telegram Bot API. Enable | Parameter | Type | Description | | --------- | ---- | ----------- | -| `success` | boolean | Telegram message send success status | -| `messageId` | number | Unique Telegram message identifier | -| `chatId` | string | Target chat ID where message was sent | -| `text` | string | Text content of the sent message | -| `timestamp` | number | Unix timestamp when message was sent | -| `from` | object | Information about the bot that sent the message | +| `message` | string | Success or error message | +| `data` | object | Telegram message data | ### `telegram_delete_message` diff --git a/apps/docs/content/docs/en/tools/youtube.mdx b/apps/docs/content/docs/en/tools/youtube.mdx index fbeeb0cc54..d2fb678187 100644 --- a/apps/docs/content/docs/en/tools/youtube.mdx +++ b/apps/docs/content/docs/en/tools/youtube.mdx @@ -1,6 +1,6 @@ --- title: YouTube -description: Search for videos on YouTube +description: Interact with YouTube videos, channels, and playlists --- import { BlockInfoCard } from "@/components/ui/block-info-card" @@ -40,7 +40,7 @@ In Sim, the YouTube integration enables your agents to programmatically search a ## Usage Instructions -Integrate YouTube into the workflow. Can search for videos. +Integrate YouTube into the workflow. Can search for videos, get video details, get channel information, get playlist items, and get video comments. @@ -64,6 +64,99 @@ Search for videos on YouTube using the YouTube Data API. | --------- | ---- | ----------- | | `items` | array | Array of YouTube videos matching the search query | +### `youtube_video_details` + +Get detailed information about a specific YouTube video. + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `videoId` | string | Yes | YouTube video ID | +| `apiKey` | string | Yes | YouTube API Key | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `videoId` | string | YouTube video ID | +| `title` | string | Video title | +| `description` | string | Video description | +| `channelId` | string | Channel ID | +| `channelTitle` | string | Channel name | +| `publishedAt` | string | Published date and time | +| `duration` | string | Video duration in ISO 8601 format | +| `viewCount` | number | Number of views | +| `likeCount` | number | Number of likes | +| `commentCount` | number | Number of comments | +| `thumbnail` | string | Video thumbnail URL | +| `tags` | array | Video tags | + +### `youtube_channel_info` + +Get detailed information about a YouTube channel. + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `channelId` | string | No | YouTube channel ID \(use either channelId or username\) | +| `username` | string | No | YouTube channel username \(use either channelId or username\) | +| `apiKey` | string | Yes | YouTube API Key | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `channelId` | string | YouTube channel ID | +| `title` | string | Channel name | +| `description` | string | Channel description | +| `subscriberCount` | number | Number of subscribers | +| `videoCount` | number | Number of videos | +| `viewCount` | number | Total channel views | +| `publishedAt` | string | Channel creation date | +| `thumbnail` | string | Channel thumbnail URL | +| `customUrl` | string | Channel custom URL | + +### `youtube_playlist_items` + +Get videos from a YouTube playlist. + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `playlistId` | string | Yes | YouTube playlist ID | +| `maxResults` | number | No | Maximum number of videos to return | +| `pageToken` | string | No | Page token for pagination | +| `apiKey` | string | Yes | YouTube API Key | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `items` | array | Array of videos in the playlist | + +### `youtube_comments` + +Get comments from a YouTube video. + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `videoId` | string | Yes | YouTube video ID | +| `maxResults` | number | No | Maximum number of comments to return | +| `order` | string | No | Order of comments: time or relevance | +| `pageToken` | string | No | Page token for pagination | +| `apiKey` | string | Yes | YouTube API Key | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `items` | array | Array of comments from the video | + ## Notes diff --git a/apps/docs/content/docs/es/blocks/guardrails.mdx b/apps/docs/content/docs/es/blocks/guardrails.mdx new file mode 100644 index 0000000000..f2d6a95f8f --- /dev/null +++ b/apps/docs/content/docs/es/blocks/guardrails.mdx @@ -0,0 +1,251 @@ +--- +title: Guardrails +--- + +import { Callout } from 'fumadocs-ui/components/callout' +import { Step, Steps } from 'fumadocs-ui/components/steps' +import { Tab, Tabs } from 'fumadocs-ui/components/tabs' +import { Image } from '@/components/ui/image' +import { Video } from '@/components/ui/video' + +The Guardrails block validates and protects your AI workflows by checking content against multiple validation types. Ensure data quality, prevent hallucinations, detect PII, and enforce format requirements before content moves through your workflow. + +
+ Guardrails Block +
+ +## Overview + +The Guardrails block enables you to: + + + + Validate JSON Structure: Ensure LLM outputs are valid JSON before parsing + + + Match Regex Patterns: Verify content matches specific formats (emails, phone numbers, URLs, etc.) + + + Detect Hallucinations: Use RAG + LLM scoring to validate AI outputs against knowledge base content + + + Detect PII: Identify and optionally mask personally identifiable information across 40+ entity types + + + +## Validation Types + +### JSON Validation + +Validates that content is properly formatted JSON. Perfect for ensuring structured LLM outputs can be safely parsed. + +**Use Cases:** +- Validate JSON responses from Agent blocks before parsing +- Ensure API payloads are properly formatted +- Check structured data integrity + +**Output:** +- `passed`: `true` if valid JSON, `false` otherwise +- `error`: Error message if validation fails (e.g., "Invalid JSON: Unexpected token...") + +### Regex Validation + +Checks if content matches a specified regular expression pattern. + +**Use Cases:** +- Validate email addresses +- Check phone number formats +- Verify URLs or custom identifiers +- Enforce specific text patterns + +**Configuration:** +- **Regex Pattern**: The regular expression to match against (e.g., `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` for emails) + +**Output:** +- `passed`: `true` if content matches pattern, `false` otherwise +- `error`: Error message if validation fails + +### Hallucination Detection + +Uses Retrieval-Augmented Generation (RAG) with LLM scoring to detect when AI-generated content contradicts or isn't grounded in your knowledge base. + +**How It Works:** +1. Queries your knowledge base for relevant context +2. Sends both the AI output and retrieved context to an LLM +3. LLM assigns a confidence score (0-10 scale) + - **0** = Full hallucination (completely ungrounded) + - **10** = Fully grounded (completely supported by knowledge base) +4. Validation passes if score ≥ threshold (default: 3) + +**Configuration:** +- **Knowledge Base**: Select from your existing knowledge bases +- **Model**: Choose LLM for scoring (requires strong reasoning - GPT-4o, Claude 3.7 Sonnet recommended) +- **API Key**: Authentication for selected LLM provider (auto-hidden for hosted/Ollama models) +- **Confidence Threshold**: Minimum score to pass (0-10, default: 3) +- **Top K** (Advanced): Number of knowledge base chunks to retrieve (default: 10) + +**Output:** +- `passed`: `true` if confidence score ≥ threshold +- `score`: Confidence score (0-10) +- `reasoning`: LLM's explanation for the score +- `error`: Error message if validation fails + +**Use Cases:** +- Validate Agent responses against documentation +- Ensure customer support answers are factually accurate +- Verify generated content matches source material +- Quality control for RAG applications + +### PII Detection + +Detects personally identifiable information using Microsoft Presidio. Supports 40+ entity types across multiple countries and languages. + +
+
+ +**How It Works:** +1. Scans content for PII entities using pattern matching and NLP +2. Returns detected entities with locations and confidence scores +3. Optionally masks detected PII in the output + +**Configuration:** +- **PII Types to Detect**: Select from grouped categories via modal selector + - **Common**: Person name, Email, Phone, Credit card, IP address, etc. + - **USA**: SSN, Driver's license, Passport, etc. + - **UK**: NHS number, National insurance number + - **Spain**: NIF, NIE, CIF + - **Italy**: Fiscal code, Driver's license, VAT code + - **Poland**: PESEL, NIP, REGON + - **Singapore**: NRIC/FIN, UEN + - **Australia**: ABN, ACN, TFN, Medicare + - **India**: Aadhaar, PAN, Passport, Voter number +- **Mode**: + - **Detect**: Only identify PII (default) + - **Mask**: Replace detected PII with masked values +- **Language**: Detection language (default: English) + +**Output:** +- `passed`: `false` if any selected PII types are detected +- `detectedEntities`: Array of detected PII with type, location, and confidence +- `maskedText`: Content with PII masked (only if mode = "Mask") +- `error`: Error message if validation fails + +**Use Cases:** +- Block content containing sensitive personal information +- Mask PII before logging or storing data +- Compliance with GDPR, HIPAA, and other privacy regulations +- Sanitize user inputs before processing + +## Configuration + +### Content to Validate + +The input content to validate. This typically comes from: +- Agent block outputs: `` +- Function block results: `` +- API responses: `` +- Any other block output + +### Validation Type + +Choose from four validation types: +- **Valid JSON**: Check if content is properly formatted JSON +- **Regex Match**: Verify content matches a regex pattern +- **Hallucination Check**: Validate against knowledge base with LLM scoring +- **PII Detection**: Detect and optionally mask personally identifiable information + +## Outputs + +All validation types return: + +- **``**: Boolean indicating if validation passed +- **``**: The type of validation performed +- **``**: The original input that was validated +- **``**: Error message if validation failed (optional) + +Additional outputs by type: + +**Hallucination Check:** +- **``**: Confidence score (0-10) +- **``**: LLM's explanation + +**PII Detection:** +- **``**: Array of detected PII entities +- **``**: Content with PII masked (if mode = "Mask") + +## Example Use Cases + +### Validate JSON Before Parsing + +
+

Scenario: Ensure Agent output is valid JSON

+
    +
  1. Agent generates structured JSON response
  2. +
  3. Guardrails validates JSON format
  4. +
  5. Condition block checks ``
  6. +
  7. If passed → Parse and use data, If failed → Retry or handle error
  8. +
+
+ +### Prevent Hallucinations + +
+

Scenario: Validate customer support responses

+
    +
  1. Agent generates response to customer question
  2. +
  3. Guardrails checks against support documentation knowledge base
  4. +
  5. If confidence score ≥ 3 → Send response
  6. +
  7. If confidence score \< 3 → Flag for human review
  8. +
+
+ +### Block PII in User Inputs + +
+

Scenario: Sanitize user-submitted content

+
    +
  1. User submits form with text content
  2. +
  3. Guardrails detects PII (emails, phone numbers, SSN, etc.)
  4. +
  5. If PII detected → Reject submission or mask sensitive data
  6. +
  7. If no PII → Process normally
  8. +
+
+ +
+
+ +### Validate Email Format + +
+

Scenario: Check email address format

+
    +
  1. Agent extracts email from text
  2. +
  3. Guardrails validates with regex pattern
  4. +
  5. If valid → Use email for notification
  6. +
  7. If invalid → Request correction
  8. +
+
+ +## Best Practices + +- **Chain with Condition blocks**: Use `` to branch workflow logic based on validation results +- **Use JSON validation before parsing**: Always validate JSON structure before attempting to parse LLM outputs +- **Choose appropriate PII types**: Only select the PII entity types relevant to your use case for better performance +- **Set reasonable confidence thresholds**: For hallucination detection, adjust threshold based on your accuracy requirements (higher = stricter) +- **Use strong models for hallucination detection**: GPT-4o or Claude 3.7 Sonnet provide more accurate confidence scoring +- **Mask PII for logging**: Use "Mask" mode when you need to log or store content that may contain PII +- **Test regex patterns**: Validate your regex patterns thoroughly before deploying to production +- **Monitor validation failures**: Track `` messages to identify common validation issues + + + Guardrails validation happens synchronously in your workflow. For hallucination detection, choose faster models (like GPT-4o-mini) if latency is critical. + + diff --git a/apps/docs/content/docs/es/execution/costs.mdx b/apps/docs/content/docs/es/execution/costs.mdx index 78daf6600b..1facabc1a1 100644 --- a/apps/docs/content/docs/es/execution/costs.mdx +++ b/apps/docs/content/docs/es/execution/costs.mdx @@ -180,6 +180,41 @@ Los diferentes planes de suscripción tienen diferentes límites de uso: ## Próximos pasos +- Revisa tu uso actual en [Configuración → Suscripción](https://sim.ai/settings/subscription) +- Aprende sobre [Registro](/execution/logging) para seguir los detalles de ejecución +- Explora la [API externa](/execution/api) para monitoreo programático de costos +- Consulta las [técnicas de optimización de flujo de trabajo](/blocks) para reducir costos + +**Plan de equipo (40$/asiento/mes):** +- Uso compartido entre todos los miembros del equipo +- Exceso calculado del uso total del equipo +- El propietario de la organización recibe una sola factura + +**Planes empresariales:** +- Precio mensual fijo, sin excesos +- Límites de uso personalizados según acuerdo + +### Facturación por umbral + +Cuando el exceso no facturado alcanza los 50$, Sim factura automáticamente el monto total no facturado. + +**Ejemplo:** +- Día 10: 70$ de exceso → Facturar 70$ inmediatamente +- Día 15: 35$ adicionales de uso (105$ en total) → Ya facturado, sin acción +- Día 20: Otros 50$ de uso (155$ en total, 85$ sin facturar) → Facturar 85$ inmediatamente + +Esto distribuye los cargos grandes por exceso a lo largo del mes en lugar de una factura grande al final del período. + +## Mejores prácticas de gestión de costos + +1. **Monitorear regularmente**: Revisa tu panel de uso con frecuencia para evitar sorpresas +2. **Establecer presupuestos**: Usa los límites del plan como guía para tus gastos +3. **Optimizar flujos de trabajo**: Revisa las ejecuciones de alto costo y optimiza los prompts o la selección de modelos +4. **Usar modelos apropiados**: Ajusta la complejidad del modelo a los requisitos de la tarea +5. **Agrupar tareas similares**: Combina múltiples solicitudes cuando sea posible para reducir la sobrecarga + +## Próximos pasos + - Revisa tu uso actual en [Configuración → Suscripción](https://sim.ai/settings/subscription) - Aprende sobre [Registro](/execution/logging) para seguir los detalles de ejecución - Explora la [API externa](/execution/api) para monitoreo programático de costos diff --git a/apps/docs/content/docs/es/sdks/typescript.mdx b/apps/docs/content/docs/es/sdks/typescript.mdx index fca8a9805f..ae1d7ea53b 100644 --- a/apps/docs/content/docs/es/sdks/typescript.mdx +++ b/apps/docs/content/docs/es/sdks/typescript.mdx @@ -814,12 +814,28 @@ async function checkUsage() { console.log(' Resets at:', limits.rateLimit.async.resetAt); console.log(' Is limited:', limits.rateLimit.async.isLimited); - console.log('\n=== Usage ==='); - console.log('Current period cost: + console.log('\n=== Uso ==='); + console.log('Costo del período actual: $' + limits.usage.currentPeriodCost.toFixed(2)); + console.log('Límite: $' + limits.usage.limit.toFixed(2)); + console.log('Plan:', limits.usage.plan); -### Streaming Workflow Execution + const percentUsed = (limits.usage.currentPeriodCost / limits.usage.limit) * 100; + console.log('Uso: ' + percentUsed.toFixed(1) + '%'); -Execute workflows with real-time streaming responses: + if (percentUsed > 80) { + console.warn('⚠️ Advertencia: ¡Estás acercándote a tu límite de uso!'); + } + } catch (error) { + console.error('Error al verificar el uso:', error); + } +} + +checkUsage(); +``` + +### Ejecución de flujo de trabajo con streaming + +Ejecuta flujos de trabajo con respuestas en streaming en tiempo real: ```typescript import { SimStudioClient } from 'simstudio-ts-sdk'; @@ -842,11 +858,13 @@ async function executeWithStreaming() { console.error('Error:', error); } } + ``` The streaming response follows the Server-Sent Events (SSE) format: ``` + data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":"One"} data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":", dos"} @@ -854,11 +872,14 @@ data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":", dos"} data: {"event":"done","success":true,"output":{},"metadata":{"duration":610}} data: [DONE] + ``` **React Streaming Example:** -```typescript +``` + +typescript import { useState, useEffect } from 'react'; function StreamingWorkflow() { @@ -926,6 +947,7 @@ function StreamingWorkflow() { ); } + ``` ## Getting Your API Key @@ -957,35 +979,6 @@ function StreamingWorkflow() { - Node.js 16+ - TypeScript 5.0+ (for TypeScript projects) -## TypeScript Support - -The SDK is written in TypeScript and provides full type safety: - -```typescript -import { - SimStudioClient, - WorkflowExecutionResult, - WorkflowStatus, - SimStudioError -} from 'simstudio-ts-sdk'; - -// Type-safe client initialization -const client: SimStudioClient = new SimStudioClient({ - apiKey: process.env.SIM_API_KEY! -}); - -// Type-safe workflow execution -const result: WorkflowExecutionResult = await client.executeWorkflow('workflow-id', { - input: { - message: '¡Hola, TypeScript!' - } -}); - -// Type-safe status checking -const status: WorkflowStatus = await client.getWorkflowStatus('workflow-id'); -``` - ## License - -Apache-2.0 +Apache-2.0 \ No newline at end of file diff --git a/apps/docs/content/docs/es/tools/knowledge.mdx b/apps/docs/content/docs/es/tools/knowledge.mdx index 5310b37a8e..fdc82d47b1 100644 --- a/apps/docs/content/docs/es/tools/knowledge.mdx +++ b/apps/docs/content/docs/es/tools/knowledge.mdx @@ -59,11 +59,11 @@ Busca contenido similar en una base de conocimiento utilizando similitud vectori #### Entrada | Parámetro | Tipo | Obligatorio | Descripción | -| --------- | ---- | ----------- | ----------- | +| --------- | ---- | -------- | ----------- | | `knowledgeBaseId` | string | Sí | ID de la base de conocimiento en la que buscar | -| `query` | string | No | Texto de consulta de búsqueda \(opcional cuando se usan filtros de etiquetas\) | +| `query` | string | No | Texto de consulta de búsqueda \(opcional cuando se utilizan filtros de etiquetas\) | | `topK` | number | No | Número de resultados más similares a devolver \(1-100\) | -| `tagFilters` | any | No | Array de filtros de etiquetas con propiedades tagName y tagValue | +| `tagFilters` | array | No | Array de filtros de etiquetas con propiedades tagName y tagValue | #### Salida diff --git a/apps/docs/content/docs/es/tools/supabase.mdx b/apps/docs/content/docs/es/tools/supabase.mdx index a7a1cddb66..61406eb7db 100644 --- a/apps/docs/content/docs/es/tools/supabase.mdx +++ b/apps/docs/content/docs/es/tools/supabase.mdx @@ -109,9 +109,9 @@ Insertar datos en una tabla de Supabase | Parámetro | Tipo | Obligatorio | Descripción | | --------- | ---- | -------- | ----------- | -| `projectId` | string | Sí | ID de tu proyecto de Supabase \(p. ej., jdrkgepadsdopsntdlom\) | -| `table` | string | Sí | Nombre de la tabla de Supabase donde insertar los datos | -| `data` | any | Sí | Los datos a insertar | +| `projectId` | string | Sí | ID de tu proyecto Supabase \(p. ej., jdrkgepadsdopsntdlom\) | +| `table` | string | Sí | Nombre de la tabla Supabase donde insertar datos | +| `data` | array | Sí | Los datos a insertar \(array de objetos o un solo objeto\) | | `apiKey` | string | Sí | Tu clave secreta de rol de servicio de Supabase | #### Salida @@ -189,10 +189,10 @@ Insertar o actualizar datos en una tabla de Supabase (operación upsert) #### Entrada | Parámetro | Tipo | Obligatorio | Descripción | -| --------- | ---- | ----------- | ----------- | -| `projectId` | string | Sí | El ID de tu proyecto Supabase \(p. ej., jdrkgepadsdopsntdlom\) | -| `table` | string | Sí | El nombre de la tabla de Supabase donde insertar o actualizar datos | -| `data` | any | Sí | Los datos a insertar o actualizar \(upsert\) | +| --------- | ---- | -------- | ----------- | +| `projectId` | string | Sí | ID de tu proyecto Supabase \(p. ej., jdrkgepadsdopsntdlom\) | +| `table` | string | Sí | Nombre de la tabla Supabase donde hacer upsert de datos | +| `data` | array | Sí | Los datos para upsert \(insertar o actualizar\) - array de objetos o un solo objeto | | `apiKey` | string | Sí | Tu clave secreta de rol de servicio de Supabase | #### Salida diff --git a/apps/docs/content/docs/es/tools/telegram.mdx b/apps/docs/content/docs/es/tools/telegram.mdx index 1f8a42d621..4d65a8308c 100644 --- a/apps/docs/content/docs/es/tools/telegram.mdx +++ b/apps/docs/content/docs/es/tools/telegram.mdx @@ -87,12 +87,108 @@ Envía mensajes a canales o usuarios de Telegram a través de la API de Bot de T | Parámetro | Tipo | Descripción | | --------- | ---- | ----------- | -| `success` | boolean | Estado de éxito del envío del mensaje de Telegram | -| `messageId` | number | Identificador único del mensaje de Telegram | -| `chatId` | string | ID del chat de destino donde se envió el mensaje | -| `text` | string | Contenido de texto del mensaje enviado | -| `timestamp` | number | Marca de tiempo Unix cuando se envió el mensaje | -| `from` | object | Información sobre el bot que envió el mensaje | +| `message` | string | Mensaje de éxito o error | +| `data` | object | Datos del mensaje de Telegram | + +## Notas + +- Categoría: `tools` +- Tipo: `telegram` + +#### Entrada + +| Parámetro | Tipo | Obligatorio | Descripción | +| --------- | ---- | ----------- | ----------- | +| `botToken` | string | Sí | Tu token de API de Bot de Telegram | +| `chatId` | string | Sí | ID del chat de Telegram objetivo | +| `messageId` | string | Sí | ID del mensaje a eliminar | + +#### Salida + +| Parámetro | Tipo | Descripción | +| --------- | ---- | ----------- | +| `message` | string | Mensaje de éxito o error | +| `data` | object | Resultado de la operación de eliminación | + +### `telegram_send_photo` + +Envía fotos a canales o usuarios de Telegram a través de la API de Bot de Telegram. + +#### Entrada + +| Parámetro | Tipo | Obligatorio | Descripción | +| --------- | ---- | ----------- | ----------- | +| `botToken` | string | Sí | Tu token de API de Bot de Telegram | +| `chatId` | string | Sí | ID del chat de Telegram objetivo | +| `photo` | string | Sí | Foto a enviar. Proporciona un file_id o URL HTTP | +| `caption` | string | No | Pie de foto (opcional) | + +#### Salida + +| Parámetro | Tipo | Descripción | +| --------- | ---- | ----------- | +| `message` | string | Mensaje de éxito o error | +| `data` | object | Datos del mensaje de Telegram incluyendo foto(s) opcional(es) | + +### `telegram_send_video` + +Envía videos a canales o usuarios de Telegram a través de la API de Bot de Telegram. + +#### Entrada + +| Parámetro | Tipo | Obligatorio | Descripción | +| --------- | ---- | ----------- | ----------- | +| `botToken` | string | Sí | Tu token de API de Bot de Telegram | +| `chatId` | string | Sí | ID del chat de Telegram objetivo | +| `video` | string | Sí | Video a enviar. Proporciona un file_id o URL HTTP | +| `caption` | string | No | Pie de video (opcional) | + +#### Salida + +| Parámetro | Tipo | Descripción | +| --------- | ---- | ----------- | +| `message` | string | Mensaje de éxito o error | +| `data` | object | Datos del mensaje de Telegram incluyendo medios opcionales | + +### `telegram_send_audio` + +Envía archivos de audio a canales o usuarios de Telegram a través de la API de Bot de Telegram. + +#### Entrada + +| Parámetro | Tipo | Obligatorio | Descripción | +| --------- | ---- | ----------- | ----------- | +| `botToken` | string | Sí | Tu token de API de Bot de Telegram | +| `chatId` | string | Sí | ID del chat de Telegram objetivo | +| `audio` | string | Sí | Archivo de audio para enviar. Proporciona un file_id o URL HTTP | +| `caption` | string | No | Leyenda del audio \(opcional\) | + +#### Salida + +| Parámetro | Tipo | Descripción | +| --------- | ---- | ----------- | +| `message` | string | Mensaje de éxito o error | +| `data` | object | Datos del mensaje de Telegram incluyendo información de voz/audio | + +### `telegram_send_animation` + +Envía animaciones (GIFs) a canales o usuarios de Telegram a través de la API de Bot de Telegram. + +#### Entrada + +| Parámetro | Tipo | Obligatorio | Descripción | +| --------- | ---- | ----------- | ----------- | +| `botToken` | string | Sí | Tu token de API de Bot de Telegram | +| `chatId` | string | Sí | ID del chat de Telegram objetivo | +| `animation` | string | Sí | Animación para enviar. Proporciona un file_id o URL HTTP | +| `caption` | string | No | Leyenda de la animación \(opcional\) | + +#### Salida + +| Parámetro | Tipo | Descripción | +| --------- | ---- | ----------- | +| `message` | string | Mensaje de éxito o error | +| `data` | object | Datos del mensaje de Telegram incluyendo medios opcionales | ## Notas diff --git a/apps/docs/content/docs/es/tools/youtube.mdx b/apps/docs/content/docs/es/tools/youtube.mdx index 18d8808881..185de80891 100644 --- a/apps/docs/content/docs/es/tools/youtube.mdx +++ b/apps/docs/content/docs/es/tools/youtube.mdx @@ -1,6 +1,6 @@ --- title: YouTube -description: Buscar videos en YouTube +description: Interactúa con videos, canales y listas de reproducción de YouTube --- import { BlockInfoCard } from "@/components/ui/block-info-card" @@ -39,7 +39,7 @@ En Sim, la integración con YouTube permite a tus agentes buscar y analizar prog ## Instrucciones de uso -Integra YouTube en el flujo de trabajo. Puede buscar videos. Requiere clave API. +Integra YouTube en el flujo de trabajo. Puede buscar videos, obtener detalles de videos, obtener información de canales, obtener elementos de listas de reproducción y obtener comentarios de videos. ## Herramientas @@ -61,6 +61,99 @@ Busca videos en YouTube utilizando la API de datos de YouTube. | --------- | ---- | ----------- | | `items` | array | Array de videos de YouTube que coinciden con la consulta de búsqueda | +### `youtube_video_details` + +Obtén información detallada sobre un video específico de YouTube. + +#### Entrada + +| Parámetro | Tipo | Obligatorio | Descripción | +| --------- | ---- | ----------- | ----------- | +| `videoId` | string | Sí | ID del video de YouTube | +| `apiKey` | string | Sí | Clave API de YouTube | + +#### Salida + +| Parámetro | Tipo | Descripción | +| --------- | ---- | ----------- | +| `videoId` | string | ID del video de YouTube | +| `title` | string | Título del video | +| `description` | string | Descripción del video | +| `channelId` | string | ID del canal | +| `channelTitle` | string | Nombre del canal | +| `publishedAt` | string | Fecha y hora de publicación | +| `duration` | string | Duración del video en formato ISO 8601 | +| `viewCount` | number | Número de visualizaciones | +| `likeCount` | number | Número de me gusta | +| `commentCount` | number | Número de comentarios | +| `thumbnail` | string | URL de la miniatura del video | +| `tags` | array | Etiquetas del video | + +### `youtube_channel_info` + +Obtén información detallada sobre un canal de YouTube. + +#### Entrada + +| Parámetro | Tipo | Obligatorio | Descripción | +| --------- | ---- | ----------- | ----------- | +| `channelId` | string | No | ID del canal de YouTube \(usa channelId o username\) | +| `username` | string | No | Nombre de usuario del canal de YouTube \(usa channelId o username\) | +| `apiKey` | string | Sí | Clave API de YouTube | + +#### Salida + +| Parámetro | Tipo | Descripción | +| --------- | ---- | ----------- | +| `channelId` | string | ID del canal de YouTube | +| `title` | string | Nombre del canal | +| `description` | string | Descripción del canal | +| `subscriberCount` | number | Número de suscriptores | +| `videoCount` | number | Número de videos | +| `viewCount` | number | Vistas totales del canal | +| `publishedAt` | string | Fecha de creación del canal | +| `thumbnail` | string | URL de la miniatura del canal | +| `customUrl` | string | URL personalizada del canal | + +### `youtube_playlist_items` + +Obtener videos de una lista de reproducción de YouTube. + +#### Entrada + +| Parámetro | Tipo | Obligatorio | Descripción | +| --------- | ---- | ----------- | ----------- | +| `playlistId` | string | Sí | ID de la lista de reproducción de YouTube | +| `maxResults` | number | No | Número máximo de videos a devolver | +| `pageToken` | string | No | Token de página para paginación | +| `apiKey` | string | Sí | Clave API de YouTube | + +#### Salida + +| Parámetro | Tipo | Descripción | +| --------- | ---- | ----------- | +| `items` | array | Array de videos en la lista de reproducción | + +### `youtube_comments` + +Obtener comentarios de un video de YouTube. + +#### Entrada + +| Parámetro | Tipo | Obligatorio | Descripción | +| --------- | ---- | ----------- | ----------- | +| `videoId` | string | Sí | ID del video de YouTube | +| `maxResults` | number | No | Número máximo de comentarios a devolver | +| `order` | string | No | Orden de los comentarios: time (tiempo) o relevance (relevancia) | +| `pageToken` | string | No | Token de página para paginación | +| `apiKey` | string | Sí | Clave API de YouTube | + +#### Salida + +| Parámetro | Tipo | Descripción | +| --------- | ---- | ----------- | +| `items` | array | Array de comentarios del video | + ## Notas - Categoría: `tools` diff --git a/apps/docs/content/docs/es/triggers/api.mdx b/apps/docs/content/docs/es/triggers/api.mdx index 09ecda8971..8644964045 100644 --- a/apps/docs/content/docs/es/triggers/api.mdx +++ b/apps/docs/content/docs/es/triggers/api.mdx @@ -128,3 +128,60 @@ Si no se define un formato de entrada, el ejecutor expone el JSON sin procesar s Un flujo de trabajo puede contener solo un disparador de API. Publica una nueva implementación después de los cambios para que el endpoint se mantenga actualizado. + +### Formato de carga de archivos + +La API acepta archivos en dos formatos: + +**1. Archivos codificados en Base64** (recomendado para SDKs): + +```json +{ + "documents": [{ + "type": "file", + "data": "data:application/pdf;base64,JVBERi0xLjQK...", + "name": "document.pdf", + "mime": "application/pdf" + }] +} +``` + +- Tamaño máximo de archivo: 20MB por archivo +- Los archivos se suben al almacenamiento en la nube y se convierten en objetos UserFile con todas las propiedades + +**2. Referencias directas de URL**: + +```json +{ + "documents": [{ + "type": "url", + "data": "https://example.com/document.pdf", + "name": "document.pdf", + "mime": "application/pdf" + }] +} +``` + +- El archivo no se sube, la URL se pasa directamente +- Útil para referenciar archivos existentes + +### Propiedades de archivos + +Para archivos, accede a todas las propiedades: + +| Propiedad | Descripción | Tipo | +|----------|-------------|------| +| `` | URL de descarga firmada | string | +| `` | Nombre original del archivo | string | +| `` | Tamaño del archivo en bytes | number | +| `` | Tipo MIME | string | +| `` | Marca de tiempo de subida (ISO 8601) | string | +| `` | Marca de tiempo de caducidad de URL (ISO 8601) | string | + +Para archivos referenciados por URL, las mismas propiedades están disponibles excepto `uploadedAt` y `expiresAt` ya que el archivo no se sube a nuestro almacenamiento. + +Si no se define un formato de entrada, el ejecutor expone solo el JSON sin procesar en ``. + + +Un flujo de trabajo puede contener solo un disparador de API. Publica una nueva implementación después de los cambios para que el punto de conexión se mantenga actualizado. + diff --git a/apps/docs/content/docs/es/triggers/chat.mdx b/apps/docs/content/docs/es/triggers/chat.mdx index bfe4da9a7f..6b6f9548b7 100644 --- a/apps/docs/content/docs/es/triggers/chat.mdx +++ b/apps/docs/content/docs/es/triggers/chat.mdx @@ -41,3 +41,11 @@ Los archivos incluyen `name`, `mimeType`, y una descarga firmada `url`. El constructor bloquea múltiples bloques de Disparador de Chat en el mismo flujo de trabajo. + +1. Añade un bloque de Disparador de Chat por flujo de trabajo. +2. Despliega el flujo de trabajo en modo chat. +3. Comparte el enlace de despliegue—cada respuesta reutiliza el ID de conversación para que el flujo de trabajo pueda mantener el contexto. + + +El constructor bloquea múltiples bloques de Disparador de Chat en el mismo flujo de trabajo. + diff --git a/apps/docs/content/docs/es/yaml/block-reference.mdx b/apps/docs/content/docs/es/yaml/block-reference.mdx deleted file mode 100644 index 293dd60334..0000000000 --- a/apps/docs/content/docs/es/yaml/block-reference.mdx +++ /dev/null @@ -1,242 +0,0 @@ ---- -title: Sintaxis de referencia de bloques -description: Cómo referenciar datos entre bloques en flujos de trabajo YAML ---- - -import { Callout } from 'fumadocs-ui/components/callout' -import { Tab, Tabs } from 'fumadocs-ui/components/tabs' - -Las referencias de bloques son la base del flujo de datos en los flujos de trabajo de Sim. Entender cómo referenciar correctamente las salidas de un bloque como entradas para otro es esencial para construir flujos de trabajo funcionales. - -## Reglas básicas de referencia - -### 1. Usa nombres de bloques, no IDs de bloques - - - - - ```yaml - # Block definition - email-sender: - type: agent - name: "Email Generator" - # ... configuration - - # Reference the block - next-block: - inputs: - userPrompt: "Process this: " - ``` - - - - - ```yaml - # Block definition - email-sender: - type: agent - name: "Email Generator" - # ... configuration - - # ❌ Don't reference by block ID - next-block: - inputs: - userPrompt: "Process this: " - ``` - - - - -### 2. Convierte nombres al formato de referencia - -Para crear una referencia de bloque: - -1. **Toma el nombre del bloque**: "Email Generator" -2. **Conviértelo a minúsculas**: "email generator" -3. **Elimina espacios y caracteres especiales**: "emailgenerator" -4. **Añade la propiedad**: `` - -### 3. Usa las propiedades correctas - -Diferentes tipos de bloques exponen diferentes propiedades: - -- **Bloques de agente**: `.content` (la respuesta de la IA) -- **Bloques de función**: `.output` (el valor de retorno) -- **Bloques de API**: `.output` (los datos de respuesta) -- **Bloques de herramientas**: `.output` (el resultado de la herramienta) - -## Ejemplos de referencias - -### Referencias de bloques comunes - -```yaml -# Agent block outputs - # Primary AI response - # Token usage information - # Estimated cost - # Tool execution details - -# Function block outputs - # Function return value - # Error information (if any) - -# API block outputs - # Response data - # HTTP status code - # Response headers - -# Tool block outputs - # Tool execution result -``` - -### Nombres de bloques con múltiples palabras - -```yaml -# Block name: "Data Processor 2" - - -# Block name: "Email Validation Service" - - -# Block name: "Customer Info Agent" - -``` - -## Casos especiales de referencia - -### Bloque inicial - - - El bloque inicial siempre se referencia como `` independientemente de su nombre real. - - -```yaml -# Starter block definition -my-custom-start: - type: starter - name: "Custom Workflow Start" - # ... configuration - -# Always reference as 'start' -agent-1: - inputs: - userPrompt: # ✅ Correct - # userPrompt: # ❌ Wrong -``` - -### Variables de bucle - -Dentro de los bloques de bucle, hay variables especiales disponibles: - -```yaml -# Available in loop child blocks - # Current iteration (0-based) - # Current item being processed (forEach loops) - # Full collection (forEach loops) -``` - -### Variables paralelas - -Dentro de los bloques paralelos, hay variables especiales disponibles: - -```yaml -# Available in parallel child blocks - # Instance number (0-based) - # Item for this instance - # Full collection -``` - -## Ejemplos de referencias complejas - -### Acceso a datos anidados - -Cuando se hace referencia a objetos complejos, utiliza la notación de punto: - -```yaml -# If an agent returns structured data -data-analyzer: - type: agent - name: "Data Analyzer" - inputs: - responseFormat: | - { - "schema": { - "type": "object", - "properties": { - "analysis": {"type": "object"}, - "summary": {"type": "string"}, - "metrics": {"type": "object"} - } - } - } - -# Reference nested properties -next-step: - inputs: - userPrompt: | - Summary: - Score: - Full data: -``` - -### Múltiples referencias en texto - -```yaml -email-composer: - type: agent - inputs: - userPrompt: | - Create an email with the following information: - - Customer: - Order Details: - Support Ticket: - - Original request: -``` - -### Referencias en bloques de código - -Cuando se utilizan referencias en bloques de función, se reemplazan como valores de JavaScript: - -```yaml -data-processor: - type: function - inputs: - code: | - // References are replaced with actual values - const customerData = ; - const orderInfo = ; - const originalInput = ; - - // Process the data - return { - customer: customerData.name, - orderId: orderInfo.id, - processed: true - }; -``` - -## Validación de referencias - -Sim valida todas las referencias al importar YAML: - -### Referencias válidas -- El bloque existe en el flujo de trabajo -- La propiedad es apropiada para el tipo de bloque -- No hay dependencias circulares -- Formato de sintaxis adecuado - -### Errores comunes -- **Bloque no encontrado**: El bloque referenciado no existe -- **Propiedad incorrecta**: Usar `.content` en un bloque de función -- **Errores tipográficos**: Nombres de bloques o propiedades mal escritos -- **Referencias circulares**: El bloque se referencia a sí mismo directa o indirectamente - -## Mejores prácticas - -1. **Usar nombres descriptivos para los bloques**: Hace que las referencias sean más legibles -2. **Ser consistente**: Utilizar la misma convención de nomenclatura en todo el documento -3. **Verificar referencias**: Asegurarse de que todos los bloques referenciados existan -4. **Evitar anidamiento profundo**: Mantener las cadenas de referencia manejables -5. **Documentar flujos complejos**: Añadir comentarios para explicar las relaciones de referencia \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/blocks/agent.mdx b/apps/docs/content/docs/es/yaml/blocks/agent.mdx deleted file mode 100644 index 6fed3f25b7..0000000000 --- a/apps/docs/content/docs/es/yaml/blocks/agent.mdx +++ /dev/null @@ -1,218 +0,0 @@ ---- -title: Esquema YAML de bloques de agente -description: Referencia de configuración YAML para bloques de agente ---- - -## Definición del esquema - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [agent] - description: Block type identifier - name: - type: string - description: Display name for this agent block - inputs: - type: object - properties: - systemPrompt: - type: string - description: Instructions that define the agent's role and behavior - userPrompt: - type: string - description: Input content to process (can reference other blocks) - model: - type: string - description: AI model identifier (e.g., gpt-4o, gemini-2.5-pro, deepseek-chat) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Response creativity level (varies by model) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - memories: - type: string - description: Memory context from memory blocks - tools: - type: array - description: List of external tools the agent can use - items: - type: object - required: [type, title, toolId, operation, usageControl] - properties: - type: - type: string - description: Tool type identifier - title: - type: string - description: Human-readable display name - toolId: - type: string - description: Internal tool identifier - operation: - type: string - description: Tool operation/method name - usageControl: - type: string - enum: [auto, required, none] - description: When AI can use the tool - params: - type: object - description: Tool-specific configuration parameters - isExpanded: - type: boolean - description: UI state - default: false - responseFormat: - type: object - description: JSON Schema to enforce structured output - required: - - model - - apiKey - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful execution - error: - type: string - description: Target block ID for error handling -``` - -## Configuración de herramientas - -Las herramientas se definen como un array donde cada herramienta tiene esta estructura: - -```yaml -tools: - - type: # Tool type identifier (exa, gmail, slack, etc.) - title: # Human-readable display name - toolId: # Internal tool identifier - operation: # Tool operation/method name - usageControl: # When AI can use it (auto | required | none) - params: # Tool-specific configuration parameters - isExpanded: # UI state (optional, default: false) -``` - -## Configuración de conexiones - -Las conexiones definen hacia dónde va el flujo de trabajo según los resultados de la ejecución: - -```yaml -connections: - success: # Target block ID for successful execution - error: # Target block ID for error handling (optional) -``` - -## Ejemplos - -### Agente básico - -```yaml -content-agent: - type: agent - name: "Content Analyzer 1" - inputs: - systemPrompt: "You are a helpful content analyzer. Be concise and clear." - userPrompt: - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: summary-block - -summary-block: - type: agent - name: "Summary Generator" - inputs: - systemPrompt: "Create a brief summary of the analysis." - userPrompt: "Analyze this: " - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: final-step -``` - -### Agente con herramientas - -```yaml -research-agent: - type: agent - name: "Research Assistant" - inputs: - systemPrompt: "Research the topic and provide detailed information." - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - tools: - - type: exa - title: "Web Search" - toolId: exa_search - operation: exa_search - usageControl: auto - params: - apiKey: '{{EXA_API_KEY}}' - connections: - success: summary-block -``` - -### Salida estructurada - -```yaml -data-extractor: - type: agent - name: "Extract Contact Info" - inputs: - systemPrompt: "Extract contact information from the text." - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - responseFormat: | - { - "name": "contact_extraction", - "schema": { - "type": "object", - "properties": { - "name": {"type": "string"}, - "email": {"type": "string"}, - "phone": {"type": "string"} - }, - "required": ["name"] - }, - "strict": true - } - connections: - success: save-contact -``` - -### Azure OpenAI - -```yaml -azure-agent: - type: agent - name: "Azure AI Assistant" - inputs: - systemPrompt: "You are a helpful assistant." - userPrompt: - model: gpt-4o - apiKey: '{{AZURE_OPENAI_API_KEY}}' - azureEndpoint: '{{AZURE_OPENAI_ENDPOINT}}' - azureApiVersion: "2024-07-01-preview" - connections: - success: response-block -``` \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/blocks/api.mdx b/apps/docs/content/docs/es/yaml/blocks/api.mdx deleted file mode 100644 index bcca77b3dc..0000000000 --- a/apps/docs/content/docs/es/yaml/blocks/api.mdx +++ /dev/null @@ -1,429 +0,0 @@ ---- -title: Esquema YAML del bloque API -description: Referencia de configuración YAML para bloques API ---- - -## Definición del esquema - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [api] - description: Block type identifier - name: - type: string - description: Display name for this API block - inputs: - type: object - required: - - url - - method - properties: - url: - type: string - description: The endpoint URL to send the request to - method: - type: string - enum: [GET, POST, PUT, DELETE, PATCH] - description: HTTP method for the request - default: GET - params: - type: array - description: Query parameters as table entries - items: - type: object - required: - - id - - cells - properties: - id: - type: string - description: Unique identifier for the parameter entry - cells: - type: object - required: - - Key - - Value - properties: - Key: - type: string - description: Parameter name - Value: - type: string - description: Parameter value - headers: - type: array - description: HTTP headers as table entries - items: - type: object - required: - - id - - cells - properties: - id: - type: string - description: Unique identifier for the header entry - cells: - type: object - required: - - Key - - Value - properties: - Key: - type: string - description: Header name - Value: - type: string - description: Header value - body: - type: string - description: Request body for POST/PUT/PATCH methods - timeout: - type: number - description: Request timeout in milliseconds - default: 30000 - minimum: 1000 - maximum: 300000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful requests - error: - type: string - description: Target block ID for error handling -``` - -## Configuración de conexión - -Las conexiones definen hacia dónde va el flujo de trabajo según los resultados de la solicitud: - -```yaml -connections: - success: # Target block ID for successful requests - error: # Target block ID for error handling (optional) -``` - -## Ejemplos - -### Solicitud GET simple - -```yaml -user-api: - type: api - name: "Fetch User Data" - inputs: - url: "https://api.example.com/users/123" - method: GET - headers: - - id: header-1-uuid-here - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" - - id: header-2-uuid-here - cells: - Key: "Content-Type" - Value: "application/json" - connections: - success: process-user-data - error: handle-api-error -``` - -### Solicitud POST con cuerpo - -```yaml -create-ticket: - type: api - name: "Create Support Ticket" - inputs: - url: "https://api.support.com/tickets" - method: POST - headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{SUPPORT_API_KEY}}" - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" - body: | - { - "title": "", - "description": "", - "priority": "high" - } - connections: - success: ticket-created - error: ticket-error -``` - -### URL dinámica con parámetros de consulta - -```yaml -search-api: - type: api - name: "Search Products" - inputs: - url: "https://api.store.com/products" - method: GET - params: - - id: search-param-uuid - cells: - Key: "q" - Value: - - id: limit-param-uuid - cells: - Key: "limit" - Value: "10" - - id: category-param-uuid - cells: - Key: "category" - Value: - headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{STORE_API_KEY}}" - connections: - success: display-results -``` - -## Formato de parámetros - -Los encabezados y parámetros (parámetros de consulta) utilizan el formato de tabla con la siguiente estructura: - -```yaml -headers: - - id: unique-identifier-here - cells: - Key: "Content-Type" - Value: "application/json" - - id: another-unique-identifier - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" - -params: - - id: param-identifier-here - cells: - Key: "limit" - Value: "10" -``` - -**Detalles de la estructura:** -- `id`: Identificador único para rastrear la fila de la tabla -- `cells.Key`: El nombre del parámetro/encabezado -- `cells.Value`: El valor del parámetro/encabezado -- Este formato permite una gestión adecuada de la tabla y la preservación del estado de la interfaz de usuario - -## Referencias de salida - -Después de que un bloque API se ejecuta, puedes hacer referencia a sus salidas en bloques posteriores. El bloque API proporciona tres salidas principales: - -### Salidas disponibles - -| Salida | Tipo | Descripción | -|--------|------|-------------| -| `data` | cualquiera | El cuerpo/carga de respuesta de la API | -| `status` | número | Código de estado HTTP (200, 404, 500, etc.) | -| `headers` | objeto | Encabezados de respuesta devueltos por el servidor | - -### Ejemplos de uso - -```yaml -# Reference API response data -process-data: - type: function - name: "Process API Data" - inputs: - code: | - const responseData = ; - const statusCode = ; - const responseHeaders = ; - - if (statusCode === 200) { - return { - success: true, - user: responseData, - contentType: responseHeaders['content-type'] - }; - } else { - return { - success: false, - error: `API call failed with status ${statusCode}` - }; - } - -# Use API data in an agent block -analyze-response: - type: agent - name: "Analyze Response" - inputs: - userPrompt: | - Analyze this API response: - - Status: - Data: - - Provide insights about the response. - -# Conditional logic based on status -check-status: - type: condition - name: "Check API Status" - inputs: - condition: === 200 - connections: - true: success-handler - false: error-handler -``` - -### Ejemplo práctico - -```yaml -user-api: - type: api - name: "Fetch User Data" - inputs: - url: "https://api.example.com/users/123" - method: GET - connections: - success: process-response - -process-response: - type: function - name: "Process Response" - inputs: - code: | - const user = ; - const status = ; - - console.log(`API returned status: ${status}`); - console.log(`User data:`, user); - - return { - userId: user.id, - email: user.email, - isActive: status === 200 - }; -``` - -### Manejo de errores - -```yaml -api-with-error-handling: - type: api - name: "API Call" - inputs: - url: "https://api.example.com/data" - method: GET - connections: - success: check-response - error: handle-error - -check-response: - type: condition - name: "Check Response Status" - inputs: - condition: >= 200 && < 300 - connections: - true: process-success - false: handle-api-error - -process-success: - type: function - name: "Process Success" - inputs: - code: | - return { - success: true, - data: , - message: "API call successful" - }; - -handle-api-error: - type: function - name: "Handle API Error" - inputs: - code: | - return { - success: false, - status: , - error: "API call failed", - data: - }; -``` - -## Escape de cadenas en YAML - -Al escribir YAML, ciertas cadenas deben estar entre comillas para ser analizadas correctamente: - -### Cadenas que deben estar entre comillas - -```yaml -# URLs with hyphens, colons, special characters -url: "https://api.example.com/users/123" -url: "https://my-api.example.com/data" - -# Header values with hyphens or special characters -headers: - - id: header-uuid - cells: - Key: "User-Agent" - Value: "My-Application/1.0" - - id: auth-uuid - cells: - Key: "Authorization" - Value: "Bearer my-token-123" - -# Parameter values with hyphens -params: - - id: param-uuid - cells: - Key: "sort-by" - Value: "created-at" -``` - -### Cuándo usar comillas - -- ✅ **Siempre usar comillas para**: URLs, tokens, valores con guiones, dos puntos o caracteres especiales -- ✅ **Siempre usar comillas para**: Valores que comienzan con números pero deben ser cadenas -- ✅ **Siempre usar comillas para**: Cadenas que parecen booleanos pero deben permanecer como cadenas -- ❌ **No usar comillas para**: Cadenas alfanuméricas simples sin caracteres especiales - -### Ejemplos - -```yaml -# ✅ Correct -url: "https://api.stripe.com/v1/charges" -headers: - - id: auth-header - cells: - Key: "Authorization" - Value: "Bearer sk-test-123456789" - -# ❌ Incorrect (may cause parsing errors) -url: https://api.stripe.com/v1/charges -headers: - - id: auth-header - cells: - Key: Authorization - Value: Bearer sk-test-123456789 -``` - -## Mejores prácticas - -- Usar variables de entorno para claves API: `{{API_KEY_NAME}}` -- Incluir manejo de errores con conexiones de error -- Establecer tiempos de espera apropiados para tu caso de uso -- Validar códigos de estado de respuesta en bloques subsiguientes -- Usar nombres de bloque significativos para facilitar la referencia -- **Siempre poner entre comillas las cadenas con caracteres especiales, URLs y tokens** \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/blocks/condition.mdx b/apps/docs/content/docs/es/yaml/blocks/condition.mdx deleted file mode 100644 index fa1742d2e5..0000000000 --- a/apps/docs/content/docs/es/yaml/blocks/condition.mdx +++ /dev/null @@ -1,165 +0,0 @@ ---- -title: Esquema YAML del bloque de condición -description: Referencia de configuración YAML para bloques de condición ---- - -## Definición del esquema - -```yaml -type: object -required: - - type - - name - - inputs - - connections -properties: - type: - type: string - enum: [condition] - description: Block type identifier - name: - type: string - description: Display name for this condition block - inputs: - type: object - required: - - conditions - properties: - conditions: - type: object - description: Conditional expressions and their logic - properties: - if: - type: string - description: Primary condition expression (boolean) - else-if: - type: string - description: Secondary condition expression (optional) - else-if-2: - type: string - description: Third condition expression (optional) - else-if-3: - type: string - description: Fourth condition expression (optional) - # Additional else-if-N conditions can be added as needed - else: - type: boolean - description: Default fallback condition (optional) - default: true - connections: - type: object - required: - - conditions - properties: - conditions: - type: object - description: Target blocks for each condition outcome - properties: - if: - type: string - description: Target block ID when 'if' condition is true - else-if: - type: string - description: Target block ID when 'else-if' condition is true - else-if-2: - type: string - description: Target block ID when 'else-if-2' condition is true - else-if-3: - type: string - description: Target block ID when 'else-if-3' condition is true - # Additional else-if-N connections can be added as needed - else: - type: string - description: Target block ID when no conditions match -``` - -## Configuración de conexión - -A diferencia de otros bloques, las condiciones utilizan conexiones ramificadas basadas en los resultados de la condición: - -```yaml -connections: - conditions: - if: # Target block ID when primary condition is true - else-if: # Target block ID when secondary condition is true (optional) - else-if-2: # Target block ID when third condition is true (optional) - else-if-3: # Target block ID when fourth condition is true (optional) - # Additional else-if-N connections can be added as needed - else: # Target block ID when no conditions match (optional) -``` - -## Ejemplos - -### If-Else simple - -```yaml -status-check: - type: condition - name: "Status Check" - inputs: - conditions: - if: === "approved" - else: true - connections: - conditions: - if: send-approval-email - else: send-rejection-email -``` - -### Múltiples condiciones - -```yaml -user-routing: - type: condition - name: "User Type Router" - inputs: - conditions: - if: === "admin" - else-if: === "premium" - else-if-2: === "basic" - else: true - connections: - conditions: - if: admin-dashboard - else-if: premium-features - else-if-2: basic-features - else: registration-flow -``` - -### Comparaciones numéricas - -```yaml -score-evaluation: - type: condition - name: "Score Evaluation" - inputs: - conditions: - if: >= 90 - else-if: >= 70 - else-if-2: >= 50 - else: true - connections: - conditions: - if: excellent-response - else-if: good-response - else-if-2: average-response - else: poor-response -``` - -### Lógica compleja - -```yaml -eligibility-check: - type: condition - name: "Eligibility Check" - inputs: - conditions: - if: >= 18 && === true - else-if: >= 16 && === true - else: true - connections: - conditions: - if: full-access - else-if: limited-access - else: access-denied -``` \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/blocks/evaluator.mdx b/apps/docs/content/docs/es/yaml/blocks/evaluator.mdx deleted file mode 100644 index 919ff1bb9a..0000000000 --- a/apps/docs/content/docs/es/yaml/blocks/evaluator.mdx +++ /dev/null @@ -1,255 +0,0 @@ ---- -title: Esquema YAML del bloque evaluador -description: Referencia de configuración YAML para bloques evaluadores ---- - -## Definición del esquema - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [evaluator] - description: Block type identifier - name: - type: string - description: Display name for this evaluator block - inputs: - type: object - required: - - content - - metrics - - model - - apiKey - properties: - content: - type: string - description: Content to evaluate (can reference other blocks) - metrics: - type: array - description: Evaluation criteria and scoring ranges - items: - type: object - properties: - name: - type: string - description: Metric identifier - description: - type: string - description: Detailed explanation of what the metric measures - range: - type: object - properties: - min: - type: number - description: Minimum score value - max: - type: number - description: Maximum score value - required: [min, max] - description: Scoring range with numeric bounds - model: - type: string - description: AI model identifier (e.g., gpt-4o, claude-3-5-sonnet-20241022) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Model temperature for evaluation - default: 0.3 - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful evaluation - error: - type: string - description: Target block ID for error handling -``` - -## Configuración de conexiones - -Las conexiones definen hacia dónde va el flujo de trabajo según los resultados de la evaluación: - -```yaml -connections: - success: # Target block ID for successful evaluation - error: # Target block ID for error handling (optional) -``` - -## Ejemplos - -### Evaluación de calidad de contenido - -```yaml -content-evaluator: - type: evaluator - name: "Content Quality Evaluator" - inputs: - content: - metrics: - - name: "accuracy" - description: "How factually accurate is the content?" - range: - min: 1 - max: 5 - - name: "clarity" - description: "How clear and understandable is the content?" - range: - min: 1 - max: 5 - - name: "relevance" - description: "How relevant is the content to the original query?" - range: - min: 1 - max: 5 - - name: "completeness" - description: "How complete and comprehensive is the content?" - range: - min: 1 - max: 5 - model: gpt-4o - temperature: 0.2 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: quality-report - error: evaluation-error -``` - -### Evaluación de respuesta al cliente - -```yaml -response-evaluator: - type: evaluator - name: "Customer Response Evaluator" - inputs: - content: - metrics: - - name: "helpfulness" - description: "How helpful is the response in addressing the customer's needs?" - range: - min: 1 - max: 10 - - name: "tone" - description: "How appropriate and professional is the tone?" - range: - min: 1 - max: 10 - - name: "completeness" - description: "Does the response fully address all aspects of the inquiry?" - range: - min: 1 - max: 10 - model: claude-3-5-sonnet-20241022 - apiKey: '{{ANTHROPIC_API_KEY}}' - connections: - success: response-processor -``` - -### Evaluación de pruebas A/B - -```yaml -ab-test-evaluator: - type: evaluator - name: "A/B Test Evaluator" - inputs: - content: | - Version A: - Version B: - - Compare these two versions for the following criteria. - metrics: - - name: "engagement" - description: "Which version is more likely to engage users?" - range: "A, B, or Tie" - - name: "clarity" - description: "Which version communicates more clearly?" - range: "A, B, or Tie" - - name: "persuasiveness" - description: "Which version is more persuasive?" - range: "A, B, or Tie" - model: gpt-4o - temperature: 0.1 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: test-results -``` - -### Puntuación multidimensional de contenido - -```yaml -comprehensive-evaluator: - type: evaluator - name: "Comprehensive Content Evaluator" - inputs: - content: - metrics: - - name: "technical_accuracy" - description: "How technically accurate and correct is the information?" - range: - min: 0 - max: 100 - - name: "readability" - description: "How easy is the content to read and understand?" - range: - min: 0 - max: 100 - - name: "seo_optimization" - description: "How well optimized is the content for search engines?" - range: - min: 0 - max: 100 - - name: "user_engagement" - description: "How likely is this content to engage and retain readers?" - range: - min: 0 - max: 100 - - name: "brand_alignment" - description: "How well does the content align with brand voice and values?" - range: - min: 0 - max: 100 - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: content-optimization -``` - -## Referencias de salida - -Después de que un bloque evaluador se ejecuta, puedes hacer referencia a sus salidas: - -```yaml -# In subsequent blocks -next-block: - inputs: - evaluation: # Evaluation summary - scores: # Individual metric scores - overall: # Overall assessment -``` - -## Mejores prácticas - -- Define criterios de evaluación claros y específicos -- Utiliza rangos de puntuación apropiados para tu caso de uso -- Elige modelos con fuertes capacidades de razonamiento -- Usa temperatura más baja para puntuaciones consistentes -- Incluye descripciones detalladas de métricas -- Prueba con diversos tipos de contenido -- Considera múltiples evaluadores para evaluaciones complejas \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/blocks/function.mdx b/apps/docs/content/docs/es/yaml/blocks/function.mdx deleted file mode 100644 index ccc6049150..0000000000 --- a/apps/docs/content/docs/es/yaml/blocks/function.mdx +++ /dev/null @@ -1,162 +0,0 @@ ---- -title: Esquema YAML de bloque de función -description: Referencia de configuración YAML para bloques de función ---- - -## Definición del esquema - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [function] - description: Block type identifier - name: - type: string - description: Display name for this function block - inputs: - type: object - required: - - code - properties: - code: - type: string - description: JavaScript/TypeScript code to execute (multiline string) - timeout: - type: number - description: Maximum execution time in milliseconds - default: 30000 - minimum: 1000 - maximum: 300000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful execution - error: - type: string - description: Target block ID for error handling -``` - -## Configuración de conexión - -Las conexiones definen hacia dónde va el flujo de trabajo según los resultados de la ejecución: - -```yaml -connections: - success: # Target block ID for successful execution - error: # Target block ID for error handling (optional) -``` - -## Ejemplos - -### Validación simple - -```yaml -input-validator: - type: function - name: "Input Validator" - inputs: - code: |- - // Check if input number is greater than 5 - const inputValue = parseInt(, 10); - - if (inputValue > 5) { - return { - valid: true, - value: inputValue, - message: "Input is valid" - }; - } else { - return { - valid: false, - value: inputValue, - message: "Input must be greater than 5" - }; - } - connections: - success: next-step - error: handle-error -``` - -### Procesamiento de datos - -```yaml -data-processor: - type: function - name: "Data Transformer" - inputs: - code: | - // Transform the input data - const rawData = ; - - // Process and clean the data - const processed = rawData - .filter(item => item.status === 'active') - .map(item => ({ - id: item.id, - name: item.name.trim(), - date: new Date(item.created).toISOString() - })); - - return processed; - connections: - success: api-save - error: error-handler -``` - -### Integración de API - -```yaml -api-formatter: - type: function - name: "Format API Request" - inputs: - code: | - // Prepare data for API submission - const userData = ; - - const apiPayload = { - timestamp: new Date().toISOString(), - data: userData, - source: "workflow-automation", - version: "1.0" - }; - - return apiPayload; - connections: - success: api-call -``` - -### Cálculos - -```yaml -calculator: - type: function - name: "Calculate Results" - inputs: - code: | - // Perform calculations on input data - const numbers = ; - - const sum = numbers.reduce((a, b) => a + b, 0); - const average = sum / numbers.length; - const max = Math.max(...numbers); - const min = Math.min(...numbers); - - return { - sum, - average, - max, - min, - count: numbers.length - }; - connections: - success: results-display -``` \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/blocks/index.mdx b/apps/docs/content/docs/es/yaml/blocks/index.mdx deleted file mode 100644 index 3d44346f3a..0000000000 --- a/apps/docs/content/docs/es/yaml/blocks/index.mdx +++ /dev/null @@ -1,151 +0,0 @@ ---- -title: Esquemas de bloques -description: Referencia completa del esquema YAML para todos los bloques de Sim ---- - -import { Card, Cards } from "fumadocs-ui/components/card"; - -Esta sección contiene las definiciones completas del esquema YAML para todos los tipos de bloques disponibles en Sim. Cada tipo de bloque tiene requisitos de configuración específicos y formatos de salida. - -## Bloques principales - -Estos son los bloques esenciales para crear flujos de trabajo: - - - - Punto de entrada del flujo de trabajo que admite activadores manuales, webhooks y programaciones - - - Procesamiento impulsado por IA con integración de LLM y soporte de herramientas - - - Entorno de ejecución de código JavaScript/TypeScript personalizado - - - Formatear y devolver los resultados finales del flujo de trabajo - - - -## Lógica y flujo de control - -Bloques para implementar lógica condicional y flujo de control: - - - - Ramificación condicional basada en expresiones booleanas - - - Enrutamiento inteligente impulsado por IA a múltiples rutas - - - Procesamiento iterativo con bucles for y forEach - - - Ejecución concurrente en múltiples instancias - - - -## Bloques de integración - -Bloques para conectar con servicios y sistemas externos: - - - - Solicitudes HTTP a APIs REST externas - - - Activadores de webhook para integraciones externas - - - -## Bloques avanzados - -Bloques especializados para patrones de flujo de trabajo complejos: - - - - Validar salidas según criterios y métricas definidos - - - Ejecutar otros flujos de trabajo como componentes reutilizables - - - -## Elementos comunes del esquema - -Todos los bloques comparten estos elementos comunes: - -### Estructura básica - -```yaml -block-id: - type: - name: - inputs: - # Block-specific configuration - connections: - # Connection definitions -``` - -### Tipos de conexión - -- **success**: Bloque objetivo para ejecución exitosa -- **error**: Bloque objetivo para manejo de errores (opcional) -- **conditions**: Múltiples rutas para bloques condicionales - -### Variables de entorno - -Usa dobles llaves para las variables de entorno: - -```yaml -inputs: - apiKey: '{{API_KEY_NAME}}' - endpoint: '{{SERVICE_ENDPOINT}}' -``` - -### Referencias de bloque - -Referencia las salidas de otros bloques usando el nombre del bloque en minúsculas: - -```yaml -inputs: - userPrompt: - data: - originalInput: -``` - -## Reglas de validación - -Todos los bloques YAML se validan contra sus esquemas: - -1. **Campos obligatorios**: Deben estar presentes -2. **Validación de tipo**: Los valores deben coincidir con los tipos esperados -3. **Validación de enumeración**: Los valores de cadena deben ser de las listas permitidas -4. **Validación de rango**: Los números deben estar dentro de los rangos especificados -5. **Validación de patrón**: Las cadenas deben coincidir con patrones regex (cuando corresponda) - -## Referencia rápida - -### Tipos de bloques y propiedades - -| Tipo de bloque | Salida principal | Casos de uso comunes | -|------------|----------------|------------------| -| starter | `.input` | Punto de entrada del flujo de trabajo | -| agent | `.content` | Procesamiento de IA, generación de texto | -| function | `.output` | Transformación de datos, cálculos | -| api | `.output` | Integración con servicios externos | -| condition | N/A (ramificación) | Lógica condicional | -| router | N/A (ramificación) | Enrutamiento inteligente | -| response | N/A (terminal) | Formateo de salida final | -| loop | `.results` | Procesamiento iterativo | -| parallel | `.results` | Procesamiento concurrente | -| webhook | `.payload` | Disparadores externos | -| evaluator | `.score` | Validación de salida, evaluación de calidad | -| workflow | `.output` | Ejecución de subflujos de trabajo, modularidad | - -### Obligatorio vs opcional - -- **Siempre obligatorio**: `type`, `name` -- **Generalmente obligatorio**: `inputs`, `connections` -- **Dependiente del contexto**: Los campos de entrada específicos varían según el tipo de bloque -- **Siempre opcional**: Conexiones `error`, campos específicos de la interfaz de usuario \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/blocks/parallel.mdx b/apps/docs/content/docs/es/yaml/blocks/parallel.mdx deleted file mode 100644 index 71c84dedda..0000000000 --- a/apps/docs/content/docs/es/yaml/blocks/parallel.mdx +++ /dev/null @@ -1,312 +0,0 @@ ---- -title: Esquema YAML de bloque paralelo -description: Referencia de configuración YAML para bloques paralelos ---- - -## Definición del esquema - -```yaml -type: object -required: - - type - - name - - inputs - - connections -properties: - type: - type: string - enum: [parallel] - description: Block type identifier - name: - type: string - description: Display name for this parallel block - inputs: - type: object - required: - - parallelType - properties: - parallelType: - type: string - enum: [count, collection] - description: Type of parallel execution - count: - type: number - description: Number of parallel instances (for 'count' type) - minimum: 1 - maximum: 100 - collection: - type: string - description: Collection to distribute across instances (for 'collection' type) - maxConcurrency: - type: number - description: Maximum concurrent executions - default: 10 - minimum: 1 - maximum: 50 - connections: - type: object - required: - - parallel - properties: - parallel: - type: object - required: - - start - properties: - start: - type: string - description: Target block ID to execute inside each parallel instance - end: - type: string - description: Target block ID after all parallel instances complete (optional) - error: - type: string - description: Target block ID for error handling -``` - -## Configuración de conexión - -Los bloques paralelos utilizan un formato de conexión especial con una sección `parallel`: - -```yaml -connections: - parallel: - start: # Target block ID to execute inside each parallel instance - end: # Target block ID after all instances complete (optional) - error: # Target block ID for error handling (optional) -``` - -## Configuración de bloques secundarios - -Los bloques dentro de un bloque paralelo deben tener su `parentId` configurado con el ID del bloque paralelo: - -```yaml -parallel-1: - type: parallel - name: "Process Items" - inputs: - parallelType: collection - collection: - connections: - parallel: - start: process-item - end: aggregate-results - -# Child block inside the parallel -process-item: - type: agent - name: "Process Item" - parentId: parallel-1 # References the parallel block - inputs: - systemPrompt: "Process this item" - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## Ejemplos - -### Procesamiento paralelo basado en conteo - -```yaml -worker-parallel: - type: parallel - name: "Worker Parallel" - inputs: - parallelType: count - count: 5 - maxConcurrency: 3 - connections: - parallel: - start: worker-task - end: collect-worker-results - -worker-task: - type: api - name: "Worker Task" - parentId: worker-parallel - inputs: - url: "https://api.worker.com/process" - method: POST - headers: - - key: "Authorization" - value: "Bearer {{WORKER_API_KEY}}" - body: | - { - "instanceId": , - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: worker-complete -``` - -### Procesamiento paralelo basado en colecciones - -```yaml -api-parallel: - type: parallel - name: "API Parallel" - inputs: - parallelType: collection - collection: - maxConcurrency: 10 - connections: - parallel: - start: call-api - end: merge-api-results - -call-api: - type: api - name: "Call API" - parentId: api-parallel - inputs: - url: - method: - headers: - - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - connections: - success: api-complete -``` - -### Pipeline de procesamiento paralelo complejo - -```yaml -data-processing-parallel: - type: parallel - name: "Data Processing Parallel" - inputs: - parallelType: collection - collection: - maxConcurrency: 8 - connections: - parallel: - start: validate-data - end: final-aggregation - error: parallel-error-handler - -validate-data: - type: function - name: "Validate Data" - parentId: data-processing-parallel - inputs: - code: | - const record = ; - const index = ; - - // Validate record structure - if (!record.id || !record.content) { - throw new Error(`Invalid record at index ${index}`); - } - - return { - valid: true, - recordId: record.id, - validatedAt: new Date().toISOString() - }; - connections: - success: process-data - error: validation-error - -process-data: - type: agent - name: "Process Data" - parentId: data-processing-parallel - inputs: - systemPrompt: "Process and analyze this data record" - userPrompt: | - Record ID: - Content: - Instance: - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: store-result - -store-result: - type: function - name: "Store Result" - parentId: data-processing-parallel - inputs: - code: | - const processed = ; - const recordId = ; - - return { - recordId, - processed, - completedAt: new Date().toISOString(), - instanceIndex: - }; -``` - -### Análisis de IA concurrente - -```yaml -multi-model-parallel: - type: parallel - name: "Multi-Model Analysis" - inputs: - parallelType: collection - collection: | - [ - {"model": "gpt-4o", "focus": "technical accuracy"}, - {"model": "claude-3-5-sonnet-20241022", "focus": "creative quality"}, - {"model": "gemini-2.0-flash-exp", "focus": "factual verification"} - ] - maxConcurrency: 3 - connections: - parallel: - start: analyze-content - end: combine-analyses - -analyze-content: - type: agent - name: "Analyze Content" - parentId: multi-model-parallel - inputs: - systemPrompt: | - You are analyzing content with a focus on . - Provide detailed analysis from this perspective. - userPrompt: | - Content to analyze: - Analysis focus: - model: - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: analysis-complete -``` - -## Variables paralelas - -Dentro de los bloques secundarios paralelos, estas variables especiales están disponibles: - -```yaml -# Available in all child blocks of the parallel - # Instance number (0-based) - # Item for this instance (collection type) - # Full collection (collection type) -``` - -## Referencias de salida - -Después de que un bloque paralelo se completa, puedes hacer referencia a sus resultados agregados: - -```yaml -# In blocks after the parallel -final-processor: - inputs: - all-results: # Array of all instance results - total-count: # Number of instances completed -``` - -## Mejores prácticas - -- Utiliza un maxConcurrency apropiado para evitar sobrecargar las APIs -- Asegúrate de que las operaciones sean independientes y no dependan entre sí -- Incluye manejo de errores para una ejecución paralela robusta -- Prueba primero con colecciones pequeñas -- Monitorea los límites de frecuencia para APIs externas -- Usa el tipo collection para distribuir trabajo, tipo count para instancias fijas -- Considera el uso de memoria con colecciones grandes \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/blocks/response.mdx b/apps/docs/content/docs/es/yaml/blocks/response.mdx deleted file mode 100644 index 7d582d00cd..0000000000 --- a/apps/docs/content/docs/es/yaml/blocks/response.mdx +++ /dev/null @@ -1,239 +0,0 @@ ---- -title: Esquema YAML del bloque de respuesta -description: Referencia de configuración YAML para bloques de respuesta ---- - -## Definición del esquema - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [response] - description: Block type identifier - name: - type: string - description: Display name for this response block - inputs: - type: object - properties: - dataMode: - type: string - enum: [structured, json] - description: Mode for defining response data structure - default: structured - builderData: - type: object - description: Structured response data (when dataMode is 'structured') - data: - type: object - description: JSON response data (when dataMode is 'json') - status: - type: number - description: HTTP status code - default: 200 - minimum: 100 - maximum: 599 - headers: - type: array - description: Response headers as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column -``` - -## Configuración de conexión - -Los bloques de respuesta son bloques terminales (sin conexiones salientes) y definen la salida final: - -```yaml -# No connections object needed - Response blocks are always terminal -``` - -## Ejemplos - -### Respuesta simple - -```yaml -simple-response: - type: response - name: "Simple Response" - inputs: - data: - message: "Hello World" - timestamp: - status: 200 -``` - -### Respuesta exitosa - -```yaml -success-response: - type: response - name: "Success Response" - inputs: - data: - success: true - user: - id: - name: - email: - created_at: - status: 201 - headers: - - key: "Location" - value: "/api/users/" - - key: "X-Created-By" - value: "workflow-engine" -``` - -### Respuesta con formato completo de encabezado de tabla - -Cuando los encabezados se crean a través de la interfaz de tabla de la UI, el YAML incluye metadatos adicionales: - -```yaml -api-response: - type: response - name: "API Response" - inputs: - data: - message: "Request processed successfully" - id: - status: 200 - headers: - - id: header-1-uuid-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - - id: header-2-uuid-here - key: "Cache-Control" - value: "no-cache" - cells: - Key: "Cache-Control" - Value: "no-cache" - - id: header-3-uuid-here - key: "X-API-Version" - value: "2.1" - cells: - Key: "X-API-Version" - Value: "2.1" -``` - -### Respuesta de error - -```yaml -error-response: - type: response - name: "Error Response" - inputs: - data: - error: true - message: - code: "VALIDATION_FAILED" - details: - status: 400 - headers: - - key: "X-Error-Code" - value: "VALIDATION_FAILED" -``` - -### Respuesta paginada - -```yaml -paginated-response: - type: response - name: "Paginated Response" - inputs: - data: - data: - pagination: - page: - per_page: - total: - total_pages: - status: 200 - headers: - - key: "X-Total-Count" - value: - - key: "Cache-Control" - value: "public, max-age=300" - - key: "Content-Type" - value: "application/json" -``` - -## Formatos de parámetros de tabla - -El bloque de respuesta admite dos formatos para encabezados: - -### Formato simplificado (YAML manual) - -Al escribir YAML manualmente, puedes usar el formato simplificado: - -```yaml -headers: - - key: "Content-Type" - value: "application/json" - - key: "Cache-Control" - value: "no-cache" -``` - -### Formato de tabla completo (generado por la UI) - -Cuando los encabezados se crean a través de la interfaz de tabla de la UI, el YAML incluye metadatos adicionales: - -```yaml -headers: - - id: unique-identifier-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" -``` - -**Diferencias clave:** -- `id`: Identificador único para rastrear la fila de la tabla -- `cells`: Valores de visualización utilizados por la interfaz de tabla de la UI -- Ambos formatos son funcionalmente equivalentes para la ejecución del flujo de trabajo -- El formato completo preserva el estado de la UI al importar/exportar flujos de trabajo - -**Importante:** Siempre coloca entre comillas los nombres de encabezados y valores que contengan caracteres especiales: - -```yaml -headers: - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" - - id: cache-control-uuid - cells: - Key: "Cache-Control" - Value: "no-cache" -``` - -``` \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/blocks/router.mdx b/apps/docs/content/docs/es/yaml/blocks/router.mdx deleted file mode 100644 index de440b6681..0000000000 --- a/apps/docs/content/docs/es/yaml/blocks/router.mdx +++ /dev/null @@ -1,200 +0,0 @@ ---- -title: Esquema YAML del bloque Router -description: Referencia de configuración YAML para bloques Router ---- - -## Definición del esquema - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [router] - description: Block type identifier - name: - type: string - description: Display name for this router block - inputs: - type: object - required: - - prompt - - model - - apiKey - properties: - prompt: - type: string - description: Instructions for routing decisions and criteria - model: - type: string - description: AI model identifier (e.g., gpt-4o, gemini-2.5-pro, deepseek-chat) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Model temperature for routing decisions - default: 0.3 - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - connections: - type: object - description: Multiple connection paths for different routing outcomes - properties: - success: - type: array - items: - type: string - description: Array of target block IDs for routing destinations -``` - -## Configuración de conexión - -Los bloques Router utilizan un array de éxito que contiene todos los posibles destinos de enrutamiento: - -```yaml -connections: - success: - - # Target block ID option 1 - - # Target block ID option 2 - - # Target block ID option 3 - # Additional target block IDs as needed -``` - -## Ejemplos - -### Router de tipo de contenido - -```yaml -content-router: - type: router - name: "Content Type Router" - inputs: - prompt: | - Route this content based on its type: - - If it's a question, route to question-handler - - If it's a complaint, route to complaint-handler - - If it's feedback, route to feedback-handler - - If it's a request, route to request-handler - - Content: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - question-handler - - complaint-handler - - feedback-handler - - request-handler -``` - -### Router de prioridad - -```yaml -priority-router: - type: router - name: "Priority Router" - inputs: - prompt: | - Analyze the urgency and route accordingly: - - urgent-queue: High priority, needs immediate attention - - standard-queue: Normal priority, standard processing - - low-queue: Low priority, can be delayed - - Email content: - - Route based on urgency indicators, deadlines, and tone. - model: gpt-4o - temperature: 0.2 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - urgent-queue - - standard-queue - - low-queue -``` - -### Router de departamento - -```yaml -department-router: - type: router - name: "Department Router" - inputs: - prompt: | - Route this customer inquiry to the appropriate department: - - - sales-team: Sales questions, pricing, demos - - support-team: Technical issues, bug reports, how-to questions - - billing-team: Payment issues, subscription changes, invoices - - general-team: General inquiries, feedback, other topics - - Customer message: - Customer type: - model: claude-3-5-sonnet-20241022 - apiKey: '{{ANTHROPIC_API_KEY}}' - connections: - success: - - sales-team - - support-team - - billing-team - - general-team -``` - -## Configuración avanzada - -### Router de múltiples modelos - -```yaml -model-selector-router: - type: router - name: "Model Selection Router" - inputs: - prompt: | - Based on the task complexity, route to the appropriate model: - - simple-gpt35: Simple questions, basic tasks - - advanced-gpt4: Complex analysis, detailed reasoning - - specialized-claude: Creative writing, nuanced analysis - - Task: - Complexity indicators: - model: gpt-4o-mini - temperature: 0.1 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - simple-gpt35 - - advanced-gpt4 - - specialized-claude -``` - -## Referencias de salida - -Los bloques Router no producen salidas directas, sino que controlan la ruta del flujo de trabajo: - -```yaml -# Router decisions affect which subsequent blocks execute -# Access the routed block's outputs normally: -final-step: - inputs: - routed-result: -``` - -## Mejores prácticas - -- Proporcionar criterios de enrutamiento claros en el prompt -- Usar nombres de bloques de destino específicos y descriptivos -- Incluir ejemplos de contenido para cada ruta de enrutamiento -- Utilizar valores de temperatura más bajos para un enrutamiento consistente -- Probar con diversos tipos de entrada para garantizar un enrutamiento preciso -- Considerar rutas alternativas para casos excepcionales \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/blocks/starter.mdx b/apps/docs/content/docs/es/yaml/blocks/starter.mdx deleted file mode 100644 index 28c3d4c45b..0000000000 --- a/apps/docs/content/docs/es/yaml/blocks/starter.mdx +++ /dev/null @@ -1,183 +0,0 @@ ---- -title: Esquema YAML del bloque de inicio -description: Referencia de configuración YAML para bloques de inicio ---- - -## Definición del esquema - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [starter] - description: Block type identifier - name: - type: string - description: Display name for this starter block - inputs: - type: object - properties: - startWorkflow: - type: string - enum: [manual, webhook, schedule] - description: How the workflow should be triggered - default: manual - inputFormat: - type: array - description: Expected input structure for API calls (manual workflows) - items: - type: object - properties: - name: - type: string - description: Field name - type: - type: string - enum: [string, number, boolean, object, array] - description: Field type - scheduleType: - type: string - enum: [hourly, daily, weekly, monthly] - description: Schedule frequency (schedule workflows only) - hourlyMinute: - type: number - minimum: 0 - maximum: 59 - description: Minute of the hour to run (hourly schedules) - dailyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (daily schedules) - weeklyDay: - type: string - enum: [MON, TUE, WED, THU, FRI, SAT, SUN] - description: Day of week to run (weekly schedules) - weeklyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (weekly schedules) - monthlyDay: - type: number - minimum: 1 - maximum: 28 - description: Day of month to run (monthly schedules) - monthlyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (monthly schedules) - timezone: - type: string - description: Timezone for scheduled workflows - default: UTC - webhookProvider: - type: string - enum: [slack, gmail, airtable, telegram, generic, whatsapp, github, discord, stripe] - description: Provider for webhook integration (webhook workflows only) - webhookConfig: - type: object - description: Provider-specific webhook configuration - connections: - type: object - properties: - success: - type: string - description: Target block ID to execute when workflow starts -``` - -## Configuración de conexión - -El bloque de inicio solo tiene una conexión de éxito ya que es el punto de entrada: - -```yaml -connections: - success: # Target block ID to execute when workflow starts -``` - -## Ejemplos - -### Inicio manual - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: next-block -``` - -### Inicio manual con formato de entrada - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: manual - inputFormat: - - name: query - type: string - - name: email - type: string - - name: age - type: number - - name: isActive - type: boolean - - name: preferences - type: object - - name: tags - type: array - connections: - success: agent-1 -``` - -### Programación diaria - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: schedule - scheduleType: daily - dailyTime: "09:00" - timezone: "America/New_York" - connections: - success: daily-task -``` - -### Programación semanal - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: schedule - scheduleType: weekly - weeklyDay: MON - weeklyTime: "08:30" - timezone: UTC - connections: - success: weekly-report -``` - -### Disparador de webhook - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: webhook - webhookProvider: slack - webhookConfig: - # Provider-specific configuration - connections: - success: process-webhook -``` \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/blocks/webhook.mdx b/apps/docs/content/docs/es/yaml/blocks/webhook.mdx deleted file mode 100644 index 5ff05ae4a6..0000000000 --- a/apps/docs/content/docs/es/yaml/blocks/webhook.mdx +++ /dev/null @@ -1,403 +0,0 @@ ---- -title: Esquema YAML del bloque Webhook -description: Referencia de configuración YAML para bloques Webhook ---- - -## Definición del esquema - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [webhook] - description: Block type identifier - name: - type: string - description: Display name for this webhook block - inputs: - type: object - properties: - webhookConfig: - type: object - description: Webhook configuration settings - properties: - enabled: - type: boolean - description: Whether the webhook is active - default: true - secret: - type: string - description: Secret key for webhook verification - headers: - type: array - description: Expected headers for validation as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Expected header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column - methods: - type: array - description: Allowed HTTP methods - items: - type: string - enum: [GET, POST, PUT, DELETE, PATCH] - default: [POST] - responseConfig: - type: object - description: Response configuration for the webhook - properties: - status: - type: number - description: HTTP status code to return - default: 200 - minimum: 100 - maximum: 599 - headers: - type: array - description: Response headers as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column - body: - type: string - description: Response body content - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful webhook processing - error: - type: string - description: Target block ID for error handling -``` - -## Configuración de conexión - -Las conexiones definen hacia dónde va el flujo de trabajo basado en el procesamiento del webhook: - -```yaml -connections: - success: # Target block ID for successful processing - error: # Target block ID for error handling (optional) -``` - -## Ejemplos - -### Disparador básico de Webhook - -```yaml -github-webhook: - type: webhook - name: "GitHub Webhook" - inputs: - webhookConfig: - enabled: true - secret: "{{GITHUB_WEBHOOK_SECRET}}" - methods: [POST] - headers: - - key: "X-GitHub-Event" - value: "push" - responseConfig: - status: 200 - body: | - { - "message": "Webhook received successfully", - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: process-github-event - error: webhook-error-handler -``` - -### Webhook de eventos de Slack - -```yaml -slack-events: - type: webhook - name: "Slack Events" - inputs: - webhookConfig: - enabled: true - secret: "{{SLACK_SIGNING_SECRET}}" - methods: [POST] - headers: - - key: "Content-Type" - value: "application/json" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "challenge": "" - } - connections: - success: handle-slack-event -``` - -### Webhook de pago (Stripe) - -```yaml -stripe-webhook: - type: webhook - name: "Stripe Payment Webhook" - inputs: - webhookConfig: - enabled: true - secret: "{{STRIPE_WEBHOOK_SECRET}}" - methods: [POST] - headers: - - key: "Stripe-Signature" - value: "*" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "received": true - } - connections: - success: process-payment-event - error: payment-webhook-error -``` - -### Webhook con formato completo de encabezado de tabla - -Cuando los encabezados se crean a través de la interfaz de tabla UI, el YAML incluye metadatos adicionales: - -```yaml -api-webhook-complete: - type: webhook - name: "API Webhook with Table Headers" - inputs: - webhookConfig: - enabled: true - methods: [POST] - headers: - - id: header-1-uuid-here - key: "Authorization" - value: "Bearer {{WEBHOOK_API_KEY}}" - cells: - Key: "Authorization" - Value: "Bearer {{WEBHOOK_API_KEY}}" - - id: header-2-uuid-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - responseConfig: - status: 200 - headers: - - id: response-header-1-uuid - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - - id: response-header-2-uuid - key: "X-Webhook-Response" - value: "processed" - cells: - Key: "X-Webhook-Response" - Value: "processed" - body: | - { - "status": "received", - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: process-webhook-complete -``` - -### Webhook de API genérica - -```yaml -api-webhook: - type: webhook - name: "API Webhook" - inputs: - webhookConfig: - enabled: true - methods: [POST, PUT] - headers: - - key: "Authorization" - value: "Bearer {{WEBHOOK_API_KEY}}" - - key: "Content-Type" - value: "application/json" - responseConfig: - status: 202 - headers: - - key: "Content-Type" - value: "application/json" - - key: "X-Processed-By" - value: "Sim" - body: | - { - "status": "accepted", - "id": "{{Math.random().toString(36).substr(2, 9)}}", - "received_at": "{{new Date().toISOString()}}" - } - connections: - success: process-webhook-data -``` - -### Webhook multi-método - -```yaml -crud-webhook: - type: webhook - name: "CRUD Webhook" - inputs: - webhookConfig: - enabled: true - methods: [GET, POST, PUT, DELETE] - headers: - - key: "X-API-Key" - value: "{{CRUD_API_KEY}}" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "method": "", - "processed": true, - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: route-by-method -``` - -## Formatos de parámetros de tabla - -El bloque Webhook admite dos formatos para encabezados (tanto encabezados de validación como encabezados de respuesta): - -### Formato simplificado (YAML manual) - -Cuando escribes YAML manualmente, puedes usar el formato simplificado: - -```yaml -headers: - - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - - key: "Content-Type" - value: "application/json" -``` - -### Formato completo de tabla (generado por la interfaz de usuario) - -Cuando los encabezados se crean a través de la interfaz de tabla de la UI, el YAML incluye metadatos adicionales: - -```yaml -headers: - - id: unique-identifier-here - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" -``` - -**Diferencias clave:** -- `id`: Identificador único para rastrear la fila de la tabla -- `cells`: Valores de visualización utilizados por la interfaz de tabla de la UI -- Ambos formatos son funcionalmente equivalentes para el procesamiento de webhooks -- El formato completo preserva el estado de la UI al importar/exportar flujos de trabajo - -**Importante:** Siempre coloca entre comillas los nombres de encabezados y valores que contengan caracteres especiales: - -```yaml -headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{WEBHOOK_API_KEY}}" - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" -``` - -## Variables de webhook - -Dentro de los flujos de trabajo activados por webhook, estas variables especiales están disponibles: - -```yaml -# Available in blocks after the webhook - # Full request payload/body - # Request headers - # HTTP method used - # Query parameters - # Request path - # Challenge parameter (for verification) -``` - -## Referencias de salida - -Después de que un webhook procesa una solicitud, puedes hacer referencia a sus datos: - -```yaml -# In subsequent blocks -process-webhook: - inputs: - payload: # Request payload - headers: # Request headers - method: # HTTP method -``` - -## Mejores prácticas de seguridad - -- Utiliza siempre secretos de webhook para verificación -- Valida los encabezados y métodos esperados -- Implementa un manejo adecuado de errores -- Usa endpoints HTTPS en producción -- Monitorea la actividad y fallos de los webhooks -- Establece tiempos de espera de respuesta apropiados -- Valida la estructura de la carga útil antes de procesarla \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/blocks/workflow.mdx b/apps/docs/content/docs/es/yaml/blocks/workflow.mdx deleted file mode 100644 index 0f6e8cabc6..0000000000 --- a/apps/docs/content/docs/es/yaml/blocks/workflow.mdx +++ /dev/null @@ -1,299 +0,0 @@ ---- -title: Esquema YAML del bloque de flujo de trabajo -description: Referencia de configuración YAML para bloques de flujo de trabajo ---- - -## Definición del esquema - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [workflow] - description: Block type identifier - name: - type: string - description: Display name for this workflow block - inputs: - type: object - required: - - workflowId - properties: - workflowId: - type: string - description: ID of the workflow to execute - inputMapping: - type: object - description: Map current workflow data to sub-workflow inputs - additionalProperties: - type: string - description: Input value or reference to parent workflow data - environmentVariables: - type: object - description: Environment variables to pass to sub-workflow - additionalProperties: - type: string - description: Environment variable value - timeout: - type: number - description: Maximum execution time in milliseconds - default: 300000 - minimum: 1000 - maximum: 1800000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful workflow completion - error: - type: string - description: Target block ID for error handling -``` - -## Configuración de conexión - -Las conexiones definen hacia dónde va el flujo de trabajo según los resultados del subflujo de trabajo: - -```yaml -connections: - success: # Target block ID for successful completion - error: # Target block ID for error handling (optional) -``` - -## Ejemplos - -### Ejecución simple de flujo de trabajo - -```yaml -data-processor: - type: workflow - name: "Data Processing Workflow" - inputs: - workflowId: "data-processing-v2" - inputMapping: - rawData: - userId: - environmentVariables: - PROCESSING_MODE: "production" - LOG_LEVEL: "info" - connections: - success: process-results - error: workflow-error-handler -``` - -### Pipeline de generación de contenido - -```yaml -content-generator: - type: workflow - name: "Content Generation Pipeline" - inputs: - workflowId: "content-generation-v3" - inputMapping: - topic: - style: - targetAudience: - brandGuidelines: - environmentVariables: - CONTENT_API_KEY: "{{CONTENT_API_KEY}}" - QUALITY_THRESHOLD: "high" - timeout: 120000 - connections: - success: review-content - error: content-generation-failed -``` - -### Flujo de trabajo de análisis de múltiples pasos - -```yaml -analysis-workflow: - type: workflow - name: "Analysis Workflow" - inputs: - workflowId: "comprehensive-analysis" - inputMapping: - document: - analysisType: "comprehensive" - includeMetrics: true - outputFormat: "structured" - environmentVariables: - ANALYSIS_MODEL: "gpt-4o" - OPENAI_API_KEY: "{{OPENAI_API_KEY}}" - CLAUDE_API_KEY: "{{CLAUDE_API_KEY}}" - connections: - success: compile-analysis-report - error: analysis-workflow-error -``` - -### Ejecución condicional de flujo de trabajo - -```yaml -customer-workflow-router: - type: condition - name: "Customer Workflow Router" - inputs: - conditions: - if: === "enterprise" - else-if: === "premium" - else: true - connections: - conditions: - if: enterprise-workflow - else-if: premium-workflow - else: standard-workflow - -enterprise-workflow: - type: workflow - name: "Enterprise Customer Workflow" - inputs: - workflowId: "enterprise-customer-processing" - inputMapping: - customerData: - accountManager: - tier: "enterprise" - environmentVariables: - PRIORITY_LEVEL: "high" - SLA_REQUIREMENTS: "strict" - connections: - success: enterprise-complete - -premium-workflow: - type: workflow - name: "Premium Customer Workflow" - inputs: - workflowId: "premium-customer-processing" - inputMapping: - customerData: - supportLevel: "premium" - environmentVariables: - PRIORITY_LEVEL: "medium" - connections: - success: premium-complete - -standard-workflow: - type: workflow - name: "Standard Customer Workflow" - inputs: - workflowId: "standard-customer-processing" - inputMapping: - customerData: - environmentVariables: - PRIORITY_LEVEL: "standard" - connections: - success: standard-complete -``` - -### Ejecución paralela de flujo de trabajo - -```yaml -parallel-workflows: - type: parallel - name: "Parallel Workflow Processing" - inputs: - parallelType: collection - collection: | - [ - {"workflowId": "sentiment-analysis", "focus": "sentiment"}, - {"workflowId": "topic-extraction", "focus": "topics"}, - {"workflowId": "entity-recognition", "focus": "entities"} - ] - connections: - success: merge-workflow-results - -execute-analysis-workflow: - type: workflow - name: "Execute Analysis Workflow" - parentId: parallel-workflows - inputs: - workflowId: - inputMapping: - content: - analysisType: - environmentVariables: - ANALYSIS_API_KEY: "{{ANALYSIS_API_KEY}}" - connections: - success: workflow-complete -``` - -### Flujo de trabajo de manejo de errores - -```yaml -main-workflow: - type: workflow - name: "Main Processing Workflow" - inputs: - workflowId: "main-processing-v1" - inputMapping: - data: - timeout: 180000 - connections: - success: main-complete - error: error-recovery-workflow - -error-recovery-workflow: - type: workflow - name: "Error Recovery Workflow" - inputs: - workflowId: "error-recovery-v1" - inputMapping: - originalInput: - errorDetails: - failureTimestamp: "{{new Date().toISOString()}}" - environmentVariables: - RECOVERY_MODE: "automatic" - FALLBACK_ENABLED: "true" - connections: - success: recovery-complete - error: manual-intervention-required -``` - -## Mapeo de entrada - -Mapea datos desde el flujo de trabajo principal al subflujo de trabajo: - -```yaml -inputMapping: - # Static values - mode: "production" - version: "1.0" - - # References to parent workflow data - userData: - settings: - - # Complex object mapping - requestData: - id: - timestamp: "{{new Date().toISOString()}}" - source: "parent-workflow" -``` - -## Referencias de salida - -Después de que un bloque de flujo de trabajo se completa, puedes hacer referencia a sus salidas: - -```yaml -# In subsequent blocks -next-block: - inputs: - workflowResult: # Sub-workflow output - executionTime: # Execution duration - status: # Execution status -``` - -## Mejores prácticas - -- Utiliza identificadores descriptivos para los flujos de trabajo para mayor claridad -- Mapea solo los datos necesarios a los subflujos de trabajo -- Establece tiempos de espera apropiados según la complejidad del flujo de trabajo -- Incluye manejo de errores para una ejecución robusta -- Pasa las variables de entorno de forma segura -- Prueba los subflujos de trabajo de forma independiente primero -- Monitorea el rendimiento de los flujos de trabajo anidados -- Utiliza identificadores de flujos de trabajo versionados para mayor estabilidad \ No newline at end of file diff --git a/apps/docs/content/docs/es/yaml/examples.mdx b/apps/docs/content/docs/es/yaml/examples.mdx deleted file mode 100644 index 1c0e59d1a7..0000000000 --- a/apps/docs/content/docs/es/yaml/examples.mdx +++ /dev/null @@ -1,273 +0,0 @@ ---- -title: Ejemplos de flujos de trabajo YAML -description: Ejemplos de flujos de trabajo YAML completos ---- - -import { Tab, Tabs } from 'fumadocs-ui/components/tabs' - -## Flujo de trabajo de cadena multi-agente - -Un flujo de trabajo donde múltiples agentes de IA procesan información secuencialmente: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: agent-1-initiator - - agent-1-initiator: - type: agent - name: Agent 1 Initiator - inputs: - systemPrompt: You are the first agent in a chain. Your role is to analyze the input and create an initial response that will be passed to the next agent. - userPrompt: |- - Welcome! I'm the first agent in our chain. - - Input to process: - - Please create an initial analysis or greeting that the next agent can build upon. Be creative and set a positive tone for the chain! - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-2-enhancer - - agent-2-enhancer: - type: agent - name: Agent 2 Enhancer - inputs: - systemPrompt: You are the second agent in a chain. Take the output from Agent 1 and enhance it with additional insights or improvements. - userPrompt: |- - I'm the second agent! Here's what Agent 1 provided: - - - - Now I'll enhance this with additional details, insights, or improvements. Let me build upon their work! - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-3-refiner - - agent-3-refiner: - type: agent - name: Agent 3 Refiner - inputs: - systemPrompt: You are the third agent in a chain. Take the enhanced output from Agent 2 and refine it further, adding structure or organization. - userPrompt: |- - I'm the third agent in our chain! Here's the enhanced work from Agent 2: - - - - My job is to refine and organize this content. I'll add structure, clarity, and polish to make it even better! - model: gpt-4o - temperature: 0.6 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-4-finalizer - - agent-4-finalizer: - type: agent - name: Agent 4 Finalizer - inputs: - systemPrompt: You are the final agent in a chain of 4. Create a comprehensive summary and conclusion based on all the previous agents' work. - userPrompt: |- - I'm the final agent! Here's the refined work from Agent 3: - - - - As the last agent in our chain, I'll create a final, polished summary that brings together all the work from our team of 4 agents. Let me conclude this beautifully! - model: gpt-4o - temperature: 0.5 - apiKey: '{{OPENAI_API_KEY}}' -``` - -## Flujo de trabajo condicional basado en enrutador - -Un flujo de trabajo que utiliza lógica de enrutamiento para enviar datos a diferentes agentes según las condiciones: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: router-1 - - router-1: - type: router - name: Router 1 - inputs: - prompt: go to agent 1 if is greater than 5. else agent 2 if greater than 10. else agent 3 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - agent-1 - - agent-2 - - agent-3 - - agent-1: - type: agent - name: Agent 1 - inputs: - systemPrompt: say 1 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - - agent-2: - type: agent - name: Agent 2 - inputs: - systemPrompt: say 2 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - - agent-3: - type: agent - name: Agent 3 - inputs: - systemPrompt: say 3 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## Búsqueda web con salida estructurada - -Un flujo de trabajo que busca en la web utilizando herramientas y devuelve datos estructurados: - -```yaml -version: '1.0' -blocks: - 59eb07c1-1411-4b28-a274-fa78f55daf72: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: d77c2c98-56c4-432d-9338-9bac54a2d42f - d77c2c98-56c4-432d-9338-9bac54a2d42f: - type: agent - name: Agent 1 - inputs: - systemPrompt: look up the user input. use structured output - userPrompt: - model: claude-sonnet-4-0 - apiKey: '{{ANTHROPIC_API_KEY}}' - tools: - - type: exa - title: Exa - params: - type: auto - apiKey: '{{EXA_API_KEY}}' - numResults: '' - toolId: exa_search - operation: exa_search - isExpanded: true - usageControl: auto - responseFormat: |- - { - "name": "output_schema", - "description": "Defines the structure for an output object.", - "strict": true, - "schema": { - "type": "object", - "properties": { - "output": { - "type": "string", - "description": "The output value" - } - }, - "additionalProperties": false, - "required": ["output"] - } - } -``` - -## Procesamiento en bucle con colección - -Un flujo de trabajo que procesa cada elemento en una colección utilizando un bucle: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: food-analysis-loop - food-analysis-loop: - type: loop - name: Food Analysis Loop - inputs: - count: 5 - loopType: forEach - collection: '["apple", "banana", "carrot"]' - connections: - loop: - start: calorie-agent - calorie-agent: - type: agent - name: Calorie Analyzer - inputs: - systemPrompt: Return the number of calories in the food - userPrompt: - model: claude-sonnet-4-0 - apiKey: '{{ANTHROPIC_API_KEY}}' - parentId: food-analysis-loop -``` - -## Clasificación y respuesta de correos electrónicos - -Un flujo de trabajo que clasifica correos electrónicos y genera respuestas apropiadas: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: email-classifier - - email-classifier: - type: agent - name: Email Classifier - inputs: - systemPrompt: Classify emails into categories and extract key information. - userPrompt: | - Classify this email: - - Categories: support, billing, sales, feedback - Extract: urgency level, customer sentiment, main request - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: response-generator - - response-generator: - type: agent - name: Response Generator - inputs: - systemPrompt: Generate appropriate responses based on email classification. - userPrompt: | - Email classification: - Original email: - - Generate a professional, helpful response addressing the customer's needs. - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' -``` diff --git a/apps/docs/content/docs/es/yaml/index.mdx b/apps/docs/content/docs/es/yaml/index.mdx deleted file mode 100644 index b49b31de40..0000000000 --- a/apps/docs/content/docs/es/yaml/index.mdx +++ /dev/null @@ -1,159 +0,0 @@ ---- -title: Referencia de flujos de trabajo YAML -description: Guía completa para escribir flujos de trabajo YAML en Sim ---- - -import { Card, Cards } from "fumadocs-ui/components/card"; -import { Step, Steps } from "fumadocs-ui/components/steps"; -import { Tab, Tabs } from "fumadocs-ui/components/tabs"; - -Los flujos de trabajo YAML proporcionan una forma potente de definir, versionar y compartir configuraciones de flujos de trabajo en Sim. Esta guía de referencia cubre la sintaxis completa de YAML, esquemas de bloques y mejores prácticas para crear flujos de trabajo robustos. - -## Inicio rápido - -Cada flujo de trabajo de Sim sigue esta estructura básica: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: agent-1 - - agent-1: - type: agent - name: "AI Assistant" - inputs: - systemPrompt: "You are a helpful assistant." - userPrompt: 'Hi' - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## Conceptos fundamentales - - - - Declaración de versión: Debe ser exactamente `version: '1.0'` (con comillas) - - - Estructura de bloques: Todos los bloques del flujo de trabajo se definen bajo la clave `blocks` - - - Referencias de bloques: Usa nombres de bloques en minúsculas sin espacios (por ejemplo, ``) - - - Variables de entorno: Referencia con dobles llaves `{{VARIABLE_NAME}}` - - - -## Tipos de bloques - -Sim admite varios tipos de bloques principales, cada uno con esquemas YAML específicos: - - - - Punto de entrada del flujo de trabajo con soporte para activadores manuales, webhooks y programados - - - Procesamiento impulsado por IA con soporte para herramientas y salida estructurada - - - Ejecución de código JavaScript/TypeScript personalizado - - - Solicitudes HTTP a servicios externos - - - Ramificación condicional basada en expresiones booleanas - - - Enrutamiento inteligente impulsado por IA a múltiples rutas - - - Procesamiento iterativo con bucles for y forEach - - - Ejecución concurrente en múltiples instancias - - - Activadores de webhook para integraciones externas - - - Validación de salidas según criterios y métricas definidos - - - Ejecuta otros flujos de trabajo como componentes reutilizables - - - Formateo de salida final del flujo de trabajo - - - -## Sintaxis de referencia de bloques - -El aspecto más crítico de los flujos de trabajo YAML es entender cómo referenciar datos entre bloques: - -### Reglas básicas - -1. **Usa el nombre del bloque** (no el ID del bloque) convertido a minúsculas con espacios eliminados -2. **Añade la propiedad apropiada** (.content para agentes, .output para herramientas) -3. **Cuando uses chat, referencia el bloque inicial** como `` - -### Ejemplos - -```yaml -# Block definitions -email-processor: - type: agent - name: "Email Agent" - # ... configuration - -data-formatter: - type: function - name: "Data Agent" - # ... configuration - -# Referencing their outputs -next-block: - type: agent - name: "Next Step" - inputs: - userPrompt: | - Process this email: - Use this formatted data: - Original input: -``` - -### Casos especiales - -- **Variables de bucle**: ``, ``, `` -- **Variables paralelas**: ``, `` - -## Variables de entorno - -Usa variables de entorno para datos sensibles como claves API: - -```yaml -inputs: - apiKey: '{{OPENAI_API_KEY}}' - database: '{{DATABASE_URL}}' - token: '{{SLACK_BOT_TOKEN}}' -``` - -## Mejores prácticas - -- **Mantén los nombres de bloques legibles**: "Procesador de correo" para mostrar en la interfaz -- **Referencia variables de entorno**: Nunca codifiques claves API directamente -- **Estructura para legibilidad**: Agrupa bloques relacionados de manera lógica -- **Prueba incrementalmente**: Construye flujos de trabajo paso a paso - -## Próximos pasos - -- [Sintaxis de referencia de bloques](/yaml/block-reference) - Reglas de referencia detalladas -- [Esquemas completos de bloques](/yaml/blocks) - Todos los tipos de bloques disponibles -- [Ejemplos de flujos de trabajo](/yaml/examples) - Patrones de flujos de trabajo del mundo real \ No newline at end of file diff --git a/apps/docs/content/docs/fr/blocks/guardrails.mdx b/apps/docs/content/docs/fr/blocks/guardrails.mdx new file mode 100644 index 0000000000..f2d6a95f8f --- /dev/null +++ b/apps/docs/content/docs/fr/blocks/guardrails.mdx @@ -0,0 +1,251 @@ +--- +title: Guardrails +--- + +import { Callout } from 'fumadocs-ui/components/callout' +import { Step, Steps } from 'fumadocs-ui/components/steps' +import { Tab, Tabs } from 'fumadocs-ui/components/tabs' +import { Image } from '@/components/ui/image' +import { Video } from '@/components/ui/video' + +The Guardrails block validates and protects your AI workflows by checking content against multiple validation types. Ensure data quality, prevent hallucinations, detect PII, and enforce format requirements before content moves through your workflow. + +
+ Guardrails Block +
+ +## Overview + +The Guardrails block enables you to: + + + + Validate JSON Structure: Ensure LLM outputs are valid JSON before parsing + + + Match Regex Patterns: Verify content matches specific formats (emails, phone numbers, URLs, etc.) + + + Detect Hallucinations: Use RAG + LLM scoring to validate AI outputs against knowledge base content + + + Detect PII: Identify and optionally mask personally identifiable information across 40+ entity types + + + +## Validation Types + +### JSON Validation + +Validates that content is properly formatted JSON. Perfect for ensuring structured LLM outputs can be safely parsed. + +**Use Cases:** +- Validate JSON responses from Agent blocks before parsing +- Ensure API payloads are properly formatted +- Check structured data integrity + +**Output:** +- `passed`: `true` if valid JSON, `false` otherwise +- `error`: Error message if validation fails (e.g., "Invalid JSON: Unexpected token...") + +### Regex Validation + +Checks if content matches a specified regular expression pattern. + +**Use Cases:** +- Validate email addresses +- Check phone number formats +- Verify URLs or custom identifiers +- Enforce specific text patterns + +**Configuration:** +- **Regex Pattern**: The regular expression to match against (e.g., `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` for emails) + +**Output:** +- `passed`: `true` if content matches pattern, `false` otherwise +- `error`: Error message if validation fails + +### Hallucination Detection + +Uses Retrieval-Augmented Generation (RAG) with LLM scoring to detect when AI-generated content contradicts or isn't grounded in your knowledge base. + +**How It Works:** +1. Queries your knowledge base for relevant context +2. Sends both the AI output and retrieved context to an LLM +3. LLM assigns a confidence score (0-10 scale) + - **0** = Full hallucination (completely ungrounded) + - **10** = Fully grounded (completely supported by knowledge base) +4. Validation passes if score ≥ threshold (default: 3) + +**Configuration:** +- **Knowledge Base**: Select from your existing knowledge bases +- **Model**: Choose LLM for scoring (requires strong reasoning - GPT-4o, Claude 3.7 Sonnet recommended) +- **API Key**: Authentication for selected LLM provider (auto-hidden for hosted/Ollama models) +- **Confidence Threshold**: Minimum score to pass (0-10, default: 3) +- **Top K** (Advanced): Number of knowledge base chunks to retrieve (default: 10) + +**Output:** +- `passed`: `true` if confidence score ≥ threshold +- `score`: Confidence score (0-10) +- `reasoning`: LLM's explanation for the score +- `error`: Error message if validation fails + +**Use Cases:** +- Validate Agent responses against documentation +- Ensure customer support answers are factually accurate +- Verify generated content matches source material +- Quality control for RAG applications + +### PII Detection + +Detects personally identifiable information using Microsoft Presidio. Supports 40+ entity types across multiple countries and languages. + +
+
+ +**How It Works:** +1. Scans content for PII entities using pattern matching and NLP +2. Returns detected entities with locations and confidence scores +3. Optionally masks detected PII in the output + +**Configuration:** +- **PII Types to Detect**: Select from grouped categories via modal selector + - **Common**: Person name, Email, Phone, Credit card, IP address, etc. + - **USA**: SSN, Driver's license, Passport, etc. + - **UK**: NHS number, National insurance number + - **Spain**: NIF, NIE, CIF + - **Italy**: Fiscal code, Driver's license, VAT code + - **Poland**: PESEL, NIP, REGON + - **Singapore**: NRIC/FIN, UEN + - **Australia**: ABN, ACN, TFN, Medicare + - **India**: Aadhaar, PAN, Passport, Voter number +- **Mode**: + - **Detect**: Only identify PII (default) + - **Mask**: Replace detected PII with masked values +- **Language**: Detection language (default: English) + +**Output:** +- `passed`: `false` if any selected PII types are detected +- `detectedEntities`: Array of detected PII with type, location, and confidence +- `maskedText`: Content with PII masked (only if mode = "Mask") +- `error`: Error message if validation fails + +**Use Cases:** +- Block content containing sensitive personal information +- Mask PII before logging or storing data +- Compliance with GDPR, HIPAA, and other privacy regulations +- Sanitize user inputs before processing + +## Configuration + +### Content to Validate + +The input content to validate. This typically comes from: +- Agent block outputs: `` +- Function block results: `` +- API responses: `` +- Any other block output + +### Validation Type + +Choose from four validation types: +- **Valid JSON**: Check if content is properly formatted JSON +- **Regex Match**: Verify content matches a regex pattern +- **Hallucination Check**: Validate against knowledge base with LLM scoring +- **PII Detection**: Detect and optionally mask personally identifiable information + +## Outputs + +All validation types return: + +- **``**: Boolean indicating if validation passed +- **``**: The type of validation performed +- **``**: The original input that was validated +- **``**: Error message if validation failed (optional) + +Additional outputs by type: + +**Hallucination Check:** +- **``**: Confidence score (0-10) +- **``**: LLM's explanation + +**PII Detection:** +- **``**: Array of detected PII entities +- **``**: Content with PII masked (if mode = "Mask") + +## Example Use Cases + +### Validate JSON Before Parsing + +
+

Scenario: Ensure Agent output is valid JSON

+
    +
  1. Agent generates structured JSON response
  2. +
  3. Guardrails validates JSON format
  4. +
  5. Condition block checks ``
  6. +
  7. If passed → Parse and use data, If failed → Retry or handle error
  8. +
+
+ +### Prevent Hallucinations + +
+

Scenario: Validate customer support responses

+
    +
  1. Agent generates response to customer question
  2. +
  3. Guardrails checks against support documentation knowledge base
  4. +
  5. If confidence score ≥ 3 → Send response
  6. +
  7. If confidence score \< 3 → Flag for human review
  8. +
+
+ +### Block PII in User Inputs + +
+

Scenario: Sanitize user-submitted content

+
    +
  1. User submits form with text content
  2. +
  3. Guardrails detects PII (emails, phone numbers, SSN, etc.)
  4. +
  5. If PII detected → Reject submission or mask sensitive data
  6. +
  7. If no PII → Process normally
  8. +
+
+ +
+
+ +### Validate Email Format + +
+

Scenario: Check email address format

+
    +
  1. Agent extracts email from text
  2. +
  3. Guardrails validates with regex pattern
  4. +
  5. If valid → Use email for notification
  6. +
  7. If invalid → Request correction
  8. +
+
+ +## Best Practices + +- **Chain with Condition blocks**: Use `` to branch workflow logic based on validation results +- **Use JSON validation before parsing**: Always validate JSON structure before attempting to parse LLM outputs +- **Choose appropriate PII types**: Only select the PII entity types relevant to your use case for better performance +- **Set reasonable confidence thresholds**: For hallucination detection, adjust threshold based on your accuracy requirements (higher = stricter) +- **Use strong models for hallucination detection**: GPT-4o or Claude 3.7 Sonnet provide more accurate confidence scoring +- **Mask PII for logging**: Use "Mask" mode when you need to log or store content that may contain PII +- **Test regex patterns**: Validate your regex patterns thoroughly before deploying to production +- **Monitor validation failures**: Track `` messages to identify common validation issues + + + Guardrails validation happens synchronously in your workflow. For hallucination detection, choose faster models (like GPT-4o-mini) if latency is critical. + + diff --git a/apps/docs/content/docs/fr/execution/costs.mdx b/apps/docs/content/docs/fr/execution/costs.mdx index 7ab7b0099f..9fc4b73750 100644 --- a/apps/docs/content/docs/fr/execution/costs.mdx +++ b/apps/docs/content/docs/fr/execution/costs.mdx @@ -183,4 +183,39 @@ Les différents forfaits d'abonnement ont des limites d'utilisation différentes - Examinez votre utilisation actuelle dans [Paramètres → Abonnement](https://sim.ai/settings/subscription) - Apprenez-en plus sur la [Journalisation](/execution/logging) pour suivre les détails d'exécution - Explorez l'[API externe](/execution/api) pour la surveillance programmatique des coûts -- Découvrez les [techniques d'optimisation de flux de travail](/blocks) pour réduire les coûts \ No newline at end of file +- Découvrez les [techniques d'optimisation de flux de travail](/blocks) pour réduire les coûts + +**Forfait Équipe (40 $/siège/mois) :** +- Utilisation mutualisée entre tous les membres de l'équipe +- Dépassement calculé sur l'utilisation totale de l'équipe +- Le propriétaire de l'organisation reçoit une seule facture + +**Forfaits Entreprise :** +- Prix mensuel fixe, sans dépassements +- Limites d'utilisation personnalisées selon l'accord + +### Facturation par seuil + +Lorsque le dépassement non facturé atteint 50 $, Sim facture automatiquement le montant total non facturé. + +**Exemple :** +- Jour 10 : 70 $ de dépassement → Facturation immédiate de 70 $ +- Jour 15 : 35 $ d'utilisation supplémentaire (105 $ au total) → Déjà facturé, aucune action +- Jour 20 : 50 $ d'utilisation supplémentaire (155 $ au total, 85 $ non facturés) → Facturation immédiate de 85 $ + +Cela répartit les frais de dépassement importants tout au long du mois au lieu d'une seule grosse facture en fin de période. + +## Bonnes pratiques de gestion des coûts + +1. **Surveillance régulière** : vérifiez fréquemment votre tableau de bord d'utilisation pour éviter les surprises +2. **Définir des budgets** : utilisez les limites du forfait comme garde-fous pour vos dépenses +3. **Optimiser les flux de travail** : examinez les exécutions à coût élevé et optimisez les prompts ou la sélection de modèles +4. **Utiliser des modèles appropriés** : adaptez la complexité du modèle aux exigences de la tâche +5. **Regrouper les tâches similaires** : combinez plusieurs requêtes lorsque c'est possible pour réduire les frais généraux + +## Prochaines étapes + +- Consultez votre utilisation actuelle dans [Paramètres → Abonnement](https://sim.ai/settings/subscription) +- Découvrez la [Journalisation](/execution/logging) pour suivre les détails d'exécution +- Explorez l'[API externe](/execution/api) pour la surveillance programmatique des coûts +- Consultez les [techniques d'optimisation des flux de travail](/blocks) pour réduire les coûts \ No newline at end of file diff --git a/apps/docs/content/docs/fr/sdks/typescript.mdx b/apps/docs/content/docs/fr/sdks/typescript.mdx index ca572c346e..b023ed12ac 100644 --- a/apps/docs/content/docs/fr/sdks/typescript.mdx +++ b/apps/docs/content/docs/fr/sdks/typescript.mdx @@ -814,12 +814,28 @@ async function checkUsage() { console.log(' Resets at:', limits.rateLimit.async.resetAt); console.log(' Is limited:', limits.rateLimit.async.isLimited); - console.log('\n=== Usage ==='); - console.log('Current period cost: + console.log('\n=== Utilisation ==='); + console.log('Coût de la période actuelle : ' + limits.usage.currentPeriodCost.toFixed(2) + ' $'); + console.log('Limite : ' + limits.usage.limit.toFixed(2) + ' $'); + console.log('Forfait :', limits.usage.plan); -### Streaming Workflow Execution + const percentUsed = (limits.usage.currentPeriodCost / limits.usage.limit) * 100; + console.log('Utilisation : ' + percentUsed.toFixed(1) + ' %'); -Execute workflows with real-time streaming responses: + if (percentUsed > 80) { + console.warn('⚠️ Attention : vous approchez de votre limite d\'utilisation !'); + } + } catch (error) { + console.error('Erreur lors de la vérification de l\'utilisation :', error); + } +} + +checkUsage(); +``` + +### Exécution de flux de travail avec streaming + +Exécutez des flux de travail avec des réponses en streaming en temps réel : ```typescript import { SimStudioClient } from 'simstudio-ts-sdk'; @@ -842,11 +858,13 @@ async function executeWithStreaming() { console.error('Erreur :', error); } } + ``` The streaming response follows the Server-Sent Events (SSE) format: ``` + data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":"One"} data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":", deux"} @@ -854,11 +872,14 @@ data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":", deux"} data: {"event":"done","success":true,"output":{},"metadata":{"duration":610}} data: [DONE] + ``` **React Streaming Example:** -```typescript +``` + +typescript import { useState, useEffect } from 'react'; function StreamingWorkflow() { @@ -926,6 +947,7 @@ function StreamingWorkflow() { ); } + ``` ## Getting Your API Key @@ -957,35 +979,6 @@ function StreamingWorkflow() { - Node.js 16+ - TypeScript 5.0+ (for TypeScript projects) -## TypeScript Support - -The SDK is written in TypeScript and provides full type safety: - -```typescript -import { - SimStudioClient, - WorkflowExecutionResult, - WorkflowStatus, - SimStudioError -} from 'simstudio-ts-sdk'; - -// Type-safe client initialization -const client: SimStudioClient = new SimStudioClient({ - apiKey: process.env.SIM_API_KEY! -}); - -// Type-safe workflow execution -const result: WorkflowExecutionResult = await client.executeWorkflow('workflow-id', { - input: { - message: 'Bonjour, TypeScript !' - } -}); - -// Type-safe status checking -const status: WorkflowStatus = await client.getWorkflowStatus('workflow-id'); -``` - ## License - Apache-2.0 diff --git a/apps/docs/content/docs/fr/tools/knowledge.mdx b/apps/docs/content/docs/fr/tools/knowledge.mdx index db63900ea9..b117c49339 100644 --- a/apps/docs/content/docs/fr/tools/knowledge.mdx +++ b/apps/docs/content/docs/fr/tools/knowledge.mdx @@ -61,9 +61,9 @@ Rechercher du contenu similaire dans une base de connaissances en utilisant la s | Paramètre | Type | Obligatoire | Description | | --------- | ---- | ---------- | ----------- | | `knowledgeBaseId` | chaîne | Oui | ID de la base de connaissances dans laquelle effectuer la recherche | -| `query` | chaîne | Non | Texte de la requête de recherche \(facultatif lors de l'utilisation de filtres par tags\) | +| `query` | chaîne | Non | Texte de la requête de recherche \(facultatif lors de l'utilisation de filtres de tags\) | | `topK` | nombre | Non | Nombre de résultats les plus similaires à retourner \(1-100\) | -| `tagFilters` | quelconque | Non | Tableau de filtres de tags avec les propriétés tagName et tagValue | +| `tagFilters` | tableau | Non | Tableau de filtres de tags avec les propriétés tagName et tagValue | #### Sortie diff --git a/apps/docs/content/docs/fr/tools/supabase.mdx b/apps/docs/content/docs/fr/tools/supabase.mdx index b1c8055340..c5258cbaa7 100644 --- a/apps/docs/content/docs/fr/tools/supabase.mdx +++ b/apps/docs/content/docs/fr/tools/supabase.mdx @@ -109,10 +109,10 @@ Insérer des données dans une table Supabase | Paramètre | Type | Obligatoire | Description | | --------- | ---- | ----------- | ----------- | -| `projectId` | string | Oui | L'ID de votre projet Supabase (ex. : jdrkgepadsdopsntdlom) | -| `table` | string | Oui | Le nom de la table Supabase dans laquelle insérer les données | -| `data` | any | Oui | Les données à insérer | -| `apiKey` | string | Oui | Votre clé secrète de rôle de service Supabase | +| `projectId` | chaîne | Oui | L'ID de votre projet Supabase (ex. : jdrkgepadsdopsntdlom) | +| `table` | chaîne | Oui | Le nom de la table Supabase dans laquelle insérer des données | +| `data` | tableau | Oui | Les données à insérer (tableau d'objets ou un seul objet) | +| `apiKey` | chaîne | Oui | Votre clé secrète de rôle de service Supabase | #### Sortie @@ -190,10 +190,10 @@ Insérer ou mettre à jour des données dans une table Supabase (opération upse | Paramètre | Type | Obligatoire | Description | | --------- | ---- | ----------- | ----------- | -| `projectId` | string | Oui | L'ID de votre projet Supabase \(ex. : jdrkgepadsdopsntdlom\) | -| `table` | string | Oui | Le nom de la table Supabase dans laquelle insérer ou mettre à jour des données | -| `data` | any | Oui | Les données à insérer ou mettre à jour \(upsert\) | -| `apiKey` | string | Oui | Votre clé secrète de rôle de service Supabase | +| `projectId` | chaîne | Oui | L'ID de votre projet Supabase (ex. : jdrkgepadsdopsntdlom) | +| `table` | chaîne | Oui | Le nom de la table Supabase dans laquelle upserter des données | +| `data` | tableau | Oui | Les données à upserter (insérer ou mettre à jour) - tableau d'objets ou un seul objet | +| `apiKey` | chaîne | Oui | Votre clé secrète de rôle de service Supabase | #### Sortie diff --git a/apps/docs/content/docs/fr/tools/telegram.mdx b/apps/docs/content/docs/fr/tools/telegram.mdx index d25ce75b73..539e391fe2 100644 --- a/apps/docs/content/docs/fr/tools/telegram.mdx +++ b/apps/docs/content/docs/fr/tools/telegram.mdx @@ -87,12 +87,108 @@ Envoyez des messages aux canaux ou utilisateurs Telegram via l'API Bot Telegram. | Paramètre | Type | Description | | --------- | ---- | ----------- | -| `success` | boolean | Statut de succès d'envoi du message Telegram | -| `messageId` | number | Identifiant unique du message Telegram | -| `chatId` | string | ID du chat cible où le message a été envoyé | -| `text` | string | Contenu textuel du message envoyé | -| `timestamp` | number | Horodatage Unix lorsque le message a été envoyé | -| `from` | object | Informations sur le bot qui a envoyé le message | +| `message` | chaîne | Message de succès ou d'erreur | +| `data` | objet | Données du message Telegram | + +## Notes + +- Catégorie : `tools` +- Type : `telegram` + +#### Entrée + +| Paramètre | Type | Obligatoire | Description | +| --------- | ---- | ----------- | ----------- | +| `botToken` | chaîne | Oui | Votre jeton d'API Bot Telegram | +| `chatId` | chaîne | Oui | ID du chat Telegram cible | +| `messageId` | chaîne | Oui | ID du message à supprimer | + +#### Sortie + +| Paramètre | Type | Description | +| --------- | ---- | ----------- | +| `message` | chaîne | Message de succès ou d'erreur | +| `data` | objet | Résultat de l'opération de suppression | + +### `telegram_send_photo` + +Envoyez des photos aux canaux ou utilisateurs Telegram via l'API Bot Telegram. + +#### Entrée + +| Paramètre | Type | Obligatoire | Description | +| --------- | ---- | ----------- | ----------- | +| `botToken` | chaîne | Oui | Votre jeton d'API Bot Telegram | +| `chatId` | chaîne | Oui | ID du chat Telegram cible | +| `photo` | chaîne | Oui | Photo à envoyer. Passez un file_id ou une URL HTTP | +| `caption` | chaîne | Non | Légende de la photo \(facultatif\) | + +#### Sortie + +| Paramètre | Type | Description | +| --------- | ---- | ----------- | +| `message` | chaîne | Message de succès ou d'erreur | +| `data` | objet | Données du message Telegram incluant la/les photo(s) facultative(s) | + +### `telegram_send_video` + +Envoyez des vidéos aux canaux ou utilisateurs Telegram via l'API Bot Telegram. + +#### Entrée + +| Paramètre | Type | Obligatoire | Description | +| --------- | ---- | ----------- | ----------- | +| `botToken` | chaîne | Oui | Votre jeton d'API Bot Telegram | +| `chatId` | chaîne | Oui | ID du chat Telegram cible | +| `video` | chaîne | Oui | Vidéo à envoyer. Passez un file_id ou une URL HTTP | +| `caption` | chaîne | Non | Légende de la vidéo \(facultatif\) | + +#### Sortie + +| Paramètre | Type | Description | +| --------- | ---- | ----------- | +| `message` | string | Message de succès ou d'erreur | +| `data` | object | Données du message Telegram incluant les médias optionnels | + +### `telegram_send_audio` + +Envoyez des fichiers audio aux canaux ou utilisateurs Telegram via l'API Bot Telegram. + +#### Entrée + +| Paramètre | Type | Obligatoire | Description | +| --------- | ---- | ----------- | ----------- | +| `botToken` | chaîne | Oui | Votre jeton d'API Bot Telegram | +| `chatId` | chaîne | Oui | ID du chat Telegram cible | +| `audio` | chaîne | Oui | Fichier audio à envoyer. Passez un file_id ou une URL HTTP | +| `caption` | chaîne | Non | Légende audio \(facultatif\) | + +#### Sortie + +| Paramètre | Type | Description | +| --------- | ---- | ----------- | +| `message` | string | Message de succès ou d'erreur | +| `data` | object | Données du message Telegram incluant les informations vocales/audio | + +### `telegram_send_animation` + +Envoyez des animations (GIF) aux canaux ou utilisateurs Telegram via l'API Bot Telegram. + +#### Entrée + +| Paramètre | Type | Obligatoire | Description | +| --------- | ---- | ----------- | ----------- | +| `botToken` | chaîne | Oui | Votre jeton d'API Bot Telegram | +| `chatId` | chaîne | Oui | ID du chat Telegram cible | +| `animation` | chaîne | Oui | Animation à envoyer. Passez un file_id ou une URL HTTP | +| `caption` | chaîne | Non | Légende de l'animation \(facultatif\) | + +#### Sortie + +| Paramètre | Type | Description | +| --------- | ---- | ----------- | +| `message` | chaîne | Message de succès ou d'erreur | +| `data` | objet | Données du message Telegram incluant les médias optionnels | ## Notes diff --git a/apps/docs/content/docs/fr/tools/youtube.mdx b/apps/docs/content/docs/fr/tools/youtube.mdx index b6ae2da7bf..3aa43eb299 100644 --- a/apps/docs/content/docs/fr/tools/youtube.mdx +++ b/apps/docs/content/docs/fr/tools/youtube.mdx @@ -1,6 +1,6 @@ --- title: YouTube -description: Rechercher des vidéos sur YouTube +description: Interagir avec les vidéos, chaînes et playlists YouTube --- import { BlockInfoCard } from "@/components/ui/block-info-card" @@ -39,7 +39,7 @@ Dans Sim, l'intégration YouTube permet à vos agents de rechercher et d'analyse ## Instructions d'utilisation -Intégrer YouTube dans le flux de travail. Peut rechercher des vidéos. Nécessite une clé API. +Intégrez YouTube dans le flux de travail. Permet de rechercher des vidéos, obtenir les détails d'une vidéo, obtenir des informations sur une chaîne, obtenir les éléments d'une playlist et obtenir les commentaires d'une vidéo. ## Outils @@ -61,6 +61,99 @@ Recherchez des vidéos sur YouTube en utilisant l'API YouTube Data. | --------- | ---- | ----------- | | `items` | tableau | Tableau de vidéos YouTube correspondant à la requête de recherche | +### `youtube_video_details` + +Obtenir des informations détaillées sur une vidéo YouTube spécifique. + +#### Entrée + +| Paramètre | Type | Obligatoire | Description | +| --------- | ---- | ----------- | ----------- | +| `videoId` | chaîne | Oui | ID de la vidéo YouTube | +| `apiKey` | chaîne | Oui | Clé API YouTube | + +#### Sortie + +| Paramètre | Type | Description | +| --------- | ---- | ----------- | +| `videoId` | chaîne | ID de la vidéo YouTube | +| `title` | chaîne | Titre de la vidéo | +| `description` | chaîne | Description de la vidéo | +| `channelId` | chaîne | ID de la chaîne | +| `channelTitle` | chaîne | Nom de la chaîne | +| `publishedAt` | chaîne | Date et heure de publication | +| `duration` | chaîne | Durée de la vidéo au format ISO 8601 | +| `viewCount` | nombre | Nombre de vues | +| `likeCount` | nombre | Nombre de j'aime | +| `commentCount` | nombre | Nombre de commentaires | +| `thumbnail` | chaîne | URL de la miniature de la vidéo | +| `tags` | tableau | Tags de la vidéo | + +### `youtube_channel_info` + +Obtenir des informations détaillées sur une chaîne YouTube. + +#### Entrée + +| Paramètre | Type | Obligatoire | Description | +| --------- | ---- | ----------- | ----------- | +| `channelId` | chaîne | Non | ID de la chaîne YouTube \(utilisez soit channelId soit username\) | +| `username` | chaîne | Non | Nom d'utilisateur de la chaîne YouTube \(utilisez soit channelId soit username\) | +| `apiKey` | chaîne | Oui | Clé API YouTube | + +#### Sortie + +| Paramètre | Type | Description | +| --------- | ---- | ----------- | +| `channelId` | chaîne | ID de la chaîne YouTube | +| `title` | chaîne | Nom de la chaîne | +| `description` | chaîne | Description de la chaîne | +| `subscriberCount` | nombre | Nombre d'abonnés | +| `videoCount` | nombre | Nombre de vidéos | +| `viewCount` | nombre | Nombre total de vues de la chaîne | +| `publishedAt` | chaîne | Date de création de la chaîne | +| `thumbnail` | chaîne | URL de la miniature de la chaîne | +| `customUrl` | chaîne | URL personnalisée de la chaîne | + +### `youtube_playlist_items` + +Obtenir des vidéos d'une playlist YouTube. + +#### Entrée + +| Paramètre | Type | Obligatoire | Description | +| --------- | ---- | ----------- | ----------- | +| `playlistId` | chaîne | Oui | ID de la playlist YouTube | +| `maxResults` | nombre | Non | Nombre maximum de vidéos à retourner | +| `pageToken` | chaîne | Non | Jeton de page pour la pagination | +| `apiKey` | chaîne | Oui | Clé API YouTube | + +#### Sortie + +| Paramètre | Type | Description | +| --------- | ---- | ----------- | +| `items` | tableau | Tableau de vidéos dans la playlist | + +### `youtube_comments` + +Obtenir les commentaires d'une vidéo YouTube. + +#### Entrée + +| Paramètre | Type | Obligatoire | Description | +| --------- | ---- | ----------- | ----------- | +| `videoId` | chaîne | Oui | ID de la vidéo YouTube | +| `maxResults` | nombre | Non | Nombre maximum de commentaires à retourner | +| `order` | chaîne | Non | Ordre des commentaires : time (chronologique) ou relevance (pertinence) | +| `pageToken` | chaîne | Non | Jeton de page pour la pagination | +| `apiKey` | chaîne | Oui | Clé API YouTube | + +#### Sortie + +| Paramètre | Type | Description | +| --------- | ---- | ----------- | +| `items` | tableau | Tableau de commentaires de la vidéo | + ## Notes - Catégorie : `tools` diff --git a/apps/docs/content/docs/fr/triggers/api.mdx b/apps/docs/content/docs/fr/triggers/api.mdx index 978ec55610..7a04b4f120 100644 --- a/apps/docs/content/docs/fr/triggers/api.mdx +++ b/apps/docs/content/docs/fr/triggers/api.mdx @@ -128,3 +128,60 @@ Si aucun format d'entrée n'est défini, l'exécuteur expose uniquement le JSON Un workflow ne peut contenir qu'un seul déclencheur API. Publiez un nouveau déploiement après les modifications pour que le point de terminaison reste à jour. + +### Format de téléchargement de fichiers + +L'API accepte les fichiers dans deux formats : + +**1. Fichiers encodés en Base64** (recommandé pour les SDK) : + +```json +{ + "documents": [{ + "type": "file", + "data": "data:application/pdf;base64,JVBERi0xLjQK...", + "name": "document.pdf", + "mime": "application/pdf" + }] +} +``` + +- Taille maximale de fichier : 20 Mo par fichier +- Les fichiers sont téléchargés vers le stockage cloud et convertis en objets UserFile avec toutes les propriétés + +**2. Références URL directes** : + +```json +{ + "documents": [{ + "type": "url", + "data": "https://example.com/document.pdf", + "name": "document.pdf", + "mime": "application/pdf" + }] +} +``` + +- Le fichier n'est pas téléchargé, l'URL est transmise directement +- Utile pour référencer des fichiers existants + +### Propriétés des fichiers + +Pour les fichiers, accédez à toutes les propriétés : + +| Propriété | Description | Type | +|----------|-------------|------| +| `` | URL de téléchargement signée | chaîne | +| `` | Nom de fichier original | chaîne | +| `` | Taille du fichier en octets | nombre | +| `` | Type MIME | chaîne | +| `` | Horodatage du téléchargement (ISO 8601) | chaîne | +| `` | Horodatage d'expiration de l'URL (ISO 8601) | chaîne | + +Pour les fichiers référencés par URL, les mêmes propriétés sont disponibles à l'exception de `uploadedAt` et `expiresAt` puisque le fichier n'est pas téléchargé vers notre stockage. + +Si aucun format d'entrée n'est défini, l'exécuteur expose uniquement le JSON brut à ``. + + +Un flux de travail ne peut contenir qu'un seul déclencheur API. Publiez un nouveau déploiement après les modifications pour que le point de terminaison reste à jour. + diff --git a/apps/docs/content/docs/fr/triggers/chat.mdx b/apps/docs/content/docs/fr/triggers/chat.mdx index 56f04cb022..143e924568 100644 --- a/apps/docs/content/docs/fr/triggers/chat.mdx +++ b/apps/docs/content/docs/fr/triggers/chat.mdx @@ -41,3 +41,11 @@ Les fichiers incluent `name`, `mimeType`, et un `url` signé. Le constructeur bloque plusieurs blocs Déclencheur de chat dans le même flux de travail. + +1. Ajoutez un bloc Déclencheur de Chat par workflow. +2. Déployez le workflow en mode chat. +3. Partagez le lien de déploiement—chaque réponse réutilise l'ID de conversation pour que le workflow puisse conserver le contexte. + + +Le constructeur bloque plusieurs blocs Déclencheur de Chat dans le même workflow. + diff --git a/apps/docs/content/docs/fr/yaml/block-reference.mdx b/apps/docs/content/docs/fr/yaml/block-reference.mdx deleted file mode 100644 index 6f72a5cfe6..0000000000 --- a/apps/docs/content/docs/fr/yaml/block-reference.mdx +++ /dev/null @@ -1,242 +0,0 @@ ---- -title: Syntaxe de référence de bloc -description: Comment référencer des données entre les blocs dans les workflows YAML ---- - -import { Callout } from 'fumadocs-ui/components/callout' -import { Tab, Tabs } from 'fumadocs-ui/components/tabs' - -Les références de bloc sont le fondement du flux de données dans les workflows Sim. Comprendre comment référencer correctement les sorties d'un bloc comme entrées d'un autre est essentiel pour créer des workflows fonctionnels. - -## Règles de référence de base - -### 1. Utilisez les noms de bloc, pas les identifiants de bloc - - - - - ```yaml - # Block definition - email-sender: - type: agent - name: "Email Generator" - # ... configuration - - # Reference the block - next-block: - inputs: - userPrompt: "Process this: " - ``` - - - - - ```yaml - # Block definition - email-sender: - type: agent - name: "Email Generator" - # ... configuration - - # ❌ Don't reference by block ID - next-block: - inputs: - userPrompt: "Process this: " - ``` - - - - -### 2. Convertir les noms au format de référence - -Pour créer une référence de bloc : - -1. **Prenez le nom du bloc** : « Email Generator » -2. **Convertissez en minuscules** : « email generator » -3. **Supprimez les espaces et les caractères spéciaux** : « emailgenerator » -4. **Ajoutez la propriété** : `` - -### 3. Utilisez les propriétés correctes - -Différents types de blocs exposent différentes propriétés : - -- **Blocs d'agent** : `.content` (la réponse de l'IA) -- **Blocs de fonction** : `.output` (la valeur de retour) -- **Blocs d'API** : `.output` (les données de réponse) -- **Blocs d'outil** : `.output` (le résultat de l'outil) - -## Exemples de référence - -### Références de bloc courantes - -```yaml -# Agent block outputs - # Primary AI response - # Token usage information - # Estimated cost - # Tool execution details - -# Function block outputs - # Function return value - # Error information (if any) - -# API block outputs - # Response data - # HTTP status code - # Response headers - -# Tool block outputs - # Tool execution result -``` - -### Noms de bloc à plusieurs mots - -```yaml -# Block name: "Data Processor 2" - - -# Block name: "Email Validation Service" - - -# Block name: "Customer Info Agent" - -``` - -## Cas de référence spéciaux - -### Bloc de démarrage - - - Le bloc de démarrage est toujours référencé comme `` quel que soit son nom réel. - - -```yaml -# Starter block definition -my-custom-start: - type: starter - name: "Custom Workflow Start" - # ... configuration - -# Always reference as 'start' -agent-1: - inputs: - userPrompt: # ✅ Correct - # userPrompt: # ❌ Wrong -``` - -### Variables de boucle - -À l'intérieur des blocs de boucle, des variables spéciales sont disponibles : - -```yaml -# Available in loop child blocks - # Current iteration (0-based) - # Current item being processed (forEach loops) - # Full collection (forEach loops) -``` - -### Variables parallèles - -À l'intérieur des blocs parallèles, des variables spéciales sont disponibles : - -```yaml -# Available in parallel child blocks - # Instance number (0-based) - # Item for this instance - # Full collection -``` - -## Exemples de références complexes - -### Accès aux données imbriquées - -Lors de la référence à des objets complexes, utilisez la notation par points : - -```yaml -# If an agent returns structured data -data-analyzer: - type: agent - name: "Data Analyzer" - inputs: - responseFormat: | - { - "schema": { - "type": "object", - "properties": { - "analysis": {"type": "object"}, - "summary": {"type": "string"}, - "metrics": {"type": "object"} - } - } - } - -# Reference nested properties -next-step: - inputs: - userPrompt: | - Summary: - Score: - Full data: -``` - -### Références multiples dans le texte - -```yaml -email-composer: - type: agent - inputs: - userPrompt: | - Create an email with the following information: - - Customer: - Order Details: - Support Ticket: - - Original request: -``` - -### Références dans les blocs de code - -Lorsque vous utilisez des références dans des blocs de fonction, elles sont remplacées par des valeurs JavaScript : - -```yaml -data-processor: - type: function - inputs: - code: | - // References are replaced with actual values - const customerData = ; - const orderInfo = ; - const originalInput = ; - - // Process the data - return { - customer: customerData.name, - orderId: orderInfo.id, - processed: true - }; -``` - -## Validation des références - -Sim valide toutes les références lors de l'importation de YAML : - -### Références valides -- Le bloc existe dans le flux de travail -- La propriété est appropriée pour le type de bloc -- Pas de dépendances circulaires -- Formatage syntaxique correct - -### Erreurs courantes -- **Bloc introuvable** : le bloc référencé n'existe pas -- **Propriété incorrecte** : utilisation de `.content` sur un bloc de fonction -- **Fautes de frappe** : noms de blocs ou propriétés mal orthographiés -- **Références circulaires** : un bloc se référence lui-même directement ou indirectement - -## Bonnes pratiques - -1. **Utilisez des noms de blocs descriptifs** : rend les références plus lisibles -2. **Soyez cohérent** : utilisez la même convention de nommage partout -3. **Vérifiez les références** : assurez-vous que tous les blocs référencés existent -4. **Évitez l'imbrication profonde** : gardez les chaînes de référence gérables -5. **Documentez les flux complexes** : ajoutez des commentaires pour expliquer les relations entre références \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/blocks/agent.mdx b/apps/docs/content/docs/fr/yaml/blocks/agent.mdx deleted file mode 100644 index 90027ba722..0000000000 --- a/apps/docs/content/docs/fr/yaml/blocks/agent.mdx +++ /dev/null @@ -1,218 +0,0 @@ ---- -title: Schéma YAML des blocs Agent -description: Référence de configuration YAML pour les blocs Agent ---- - -## Définition du schéma - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [agent] - description: Block type identifier - name: - type: string - description: Display name for this agent block - inputs: - type: object - properties: - systemPrompt: - type: string - description: Instructions that define the agent's role and behavior - userPrompt: - type: string - description: Input content to process (can reference other blocks) - model: - type: string - description: AI model identifier (e.g., gpt-4o, gemini-2.5-pro, deepseek-chat) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Response creativity level (varies by model) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - memories: - type: string - description: Memory context from memory blocks - tools: - type: array - description: List of external tools the agent can use - items: - type: object - required: [type, title, toolId, operation, usageControl] - properties: - type: - type: string - description: Tool type identifier - title: - type: string - description: Human-readable display name - toolId: - type: string - description: Internal tool identifier - operation: - type: string - description: Tool operation/method name - usageControl: - type: string - enum: [auto, required, none] - description: When AI can use the tool - params: - type: object - description: Tool-specific configuration parameters - isExpanded: - type: boolean - description: UI state - default: false - responseFormat: - type: object - description: JSON Schema to enforce structured output - required: - - model - - apiKey - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful execution - error: - type: string - description: Target block ID for error handling -``` - -## Configuration des outils - -Les outils sont définis comme un tableau où chaque outil a cette structure : - -```yaml -tools: - - type: # Tool type identifier (exa, gmail, slack, etc.) - title: # Human-readable display name - toolId: # Internal tool identifier - operation: # Tool operation/method name - usageControl: # When AI can use it (auto | required | none) - params: # Tool-specific configuration parameters - isExpanded: # UI state (optional, default: false) -``` - -## Configuration des connexions - -Les connexions définissent où le flux de travail se dirige en fonction des résultats d'exécution : - -```yaml -connections: - success: # Target block ID for successful execution - error: # Target block ID for error handling (optional) -``` - -## Exemples - -### Agent basique - -```yaml -content-agent: - type: agent - name: "Content Analyzer 1" - inputs: - systemPrompt: "You are a helpful content analyzer. Be concise and clear." - userPrompt: - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: summary-block - -summary-block: - type: agent - name: "Summary Generator" - inputs: - systemPrompt: "Create a brief summary of the analysis." - userPrompt: "Analyze this: " - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: final-step -``` - -### Agent avec outils - -```yaml -research-agent: - type: agent - name: "Research Assistant" - inputs: - systemPrompt: "Research the topic and provide detailed information." - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - tools: - - type: exa - title: "Web Search" - toolId: exa_search - operation: exa_search - usageControl: auto - params: - apiKey: '{{EXA_API_KEY}}' - connections: - success: summary-block -``` - -### Sortie structurée - -```yaml -data-extractor: - type: agent - name: "Extract Contact Info" - inputs: - systemPrompt: "Extract contact information from the text." - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - responseFormat: | - { - "name": "contact_extraction", - "schema": { - "type": "object", - "properties": { - "name": {"type": "string"}, - "email": {"type": "string"}, - "phone": {"type": "string"} - }, - "required": ["name"] - }, - "strict": true - } - connections: - success: save-contact -``` - -### Azure OpenAI - -```yaml -azure-agent: - type: agent - name: "Azure AI Assistant" - inputs: - systemPrompt: "You are a helpful assistant." - userPrompt: - model: gpt-4o - apiKey: '{{AZURE_OPENAI_API_KEY}}' - azureEndpoint: '{{AZURE_OPENAI_ENDPOINT}}' - azureApiVersion: "2024-07-01-preview" - connections: - success: response-block -``` \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/blocks/api.mdx b/apps/docs/content/docs/fr/yaml/blocks/api.mdx deleted file mode 100644 index 933ad0aad9..0000000000 --- a/apps/docs/content/docs/fr/yaml/blocks/api.mdx +++ /dev/null @@ -1,429 +0,0 @@ ---- -title: Schéma YAML du bloc API -description: Référence de configuration YAML pour les blocs API ---- - -## Définition du schéma - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [api] - description: Block type identifier - name: - type: string - description: Display name for this API block - inputs: - type: object - required: - - url - - method - properties: - url: - type: string - description: The endpoint URL to send the request to - method: - type: string - enum: [GET, POST, PUT, DELETE, PATCH] - description: HTTP method for the request - default: GET - params: - type: array - description: Query parameters as table entries - items: - type: object - required: - - id - - cells - properties: - id: - type: string - description: Unique identifier for the parameter entry - cells: - type: object - required: - - Key - - Value - properties: - Key: - type: string - description: Parameter name - Value: - type: string - description: Parameter value - headers: - type: array - description: HTTP headers as table entries - items: - type: object - required: - - id - - cells - properties: - id: - type: string - description: Unique identifier for the header entry - cells: - type: object - required: - - Key - - Value - properties: - Key: - type: string - description: Header name - Value: - type: string - description: Header value - body: - type: string - description: Request body for POST/PUT/PATCH methods - timeout: - type: number - description: Request timeout in milliseconds - default: 30000 - minimum: 1000 - maximum: 300000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful requests - error: - type: string - description: Target block ID for error handling -``` - -## Configuration de connexion - -Les connexions définissent où le flux de travail se dirige en fonction des résultats de la requête : - -```yaml -connections: - success: # Target block ID for successful requests - error: # Target block ID for error handling (optional) -``` - -## Exemples - -### Requête GET simple - -```yaml -user-api: - type: api - name: "Fetch User Data" - inputs: - url: "https://api.example.com/users/123" - method: GET - headers: - - id: header-1-uuid-here - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" - - id: header-2-uuid-here - cells: - Key: "Content-Type" - Value: "application/json" - connections: - success: process-user-data - error: handle-api-error -``` - -### Requête POST avec corps - -```yaml -create-ticket: - type: api - name: "Create Support Ticket" - inputs: - url: "https://api.support.com/tickets" - method: POST - headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{SUPPORT_API_KEY}}" - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" - body: | - { - "title": "", - "description": "", - "priority": "high" - } - connections: - success: ticket-created - error: ticket-error -``` - -### URL dynamique avec paramètres de requête - -```yaml -search-api: - type: api - name: "Search Products" - inputs: - url: "https://api.store.com/products" - method: GET - params: - - id: search-param-uuid - cells: - Key: "q" - Value: - - id: limit-param-uuid - cells: - Key: "limit" - Value: "10" - - id: category-param-uuid - cells: - Key: "category" - Value: - headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{STORE_API_KEY}}" - connections: - success: display-results -``` - -## Format des paramètres - -Les en-têtes et les paramètres (paramètres de requête) utilisent le format de tableau avec la structure suivante : - -```yaml -headers: - - id: unique-identifier-here - cells: - Key: "Content-Type" - Value: "application/json" - - id: another-unique-identifier - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" - -params: - - id: param-identifier-here - cells: - Key: "limit" - Value: "10" -``` - -**Détails de la structure :** -- `id` : identifiant unique pour suivre la ligne du tableau -- `cells.Key` : le nom du paramètre/en-tête -- `cells.Value` : la valeur du paramètre/en-tête -- Ce format permet une gestion appropriée des tableaux et la préservation de l'état de l'interface utilisateur - -## Références de sortie - -Après l'exécution d'un bloc API, vous pouvez référencer ses sorties dans les blocs suivants. Le bloc API fournit trois sorties principales : - -### Sorties disponibles - -| Sortie | Type | Description | -|--------|------|-------------| -| `data` | any | Le corps/charge utile de la réponse de l'API | -| `status` | number | Code de statut HTTP (200, 404, 500, etc.) | -| `headers` | object | En-têtes de réponse renvoyés par le serveur | - -### Exemples d'utilisation - -```yaml -# Reference API response data -process-data: - type: function - name: "Process API Data" - inputs: - code: | - const responseData = ; - const statusCode = ; - const responseHeaders = ; - - if (statusCode === 200) { - return { - success: true, - user: responseData, - contentType: responseHeaders['content-type'] - }; - } else { - return { - success: false, - error: `API call failed with status ${statusCode}` - }; - } - -# Use API data in an agent block -analyze-response: - type: agent - name: "Analyze Response" - inputs: - userPrompt: | - Analyze this API response: - - Status: - Data: - - Provide insights about the response. - -# Conditional logic based on status -check-status: - type: condition - name: "Check API Status" - inputs: - condition: === 200 - connections: - true: success-handler - false: error-handler -``` - -### Exemple pratique - -```yaml -user-api: - type: api - name: "Fetch User Data" - inputs: - url: "https://api.example.com/users/123" - method: GET - connections: - success: process-response - -process-response: - type: function - name: "Process Response" - inputs: - code: | - const user = ; - const status = ; - - console.log(`API returned status: ${status}`); - console.log(`User data:`, user); - - return { - userId: user.id, - email: user.email, - isActive: status === 200 - }; -``` - -### Gestion des erreurs - -```yaml -api-with-error-handling: - type: api - name: "API Call" - inputs: - url: "https://api.example.com/data" - method: GET - connections: - success: check-response - error: handle-error - -check-response: - type: condition - name: "Check Response Status" - inputs: - condition: >= 200 && < 300 - connections: - true: process-success - false: handle-api-error - -process-success: - type: function - name: "Process Success" - inputs: - code: | - return { - success: true, - data: , - message: "API call successful" - }; - -handle-api-error: - type: function - name: "Handle API Error" - inputs: - code: | - return { - success: false, - status: , - error: "API call failed", - data: - }; -``` - -## Échappement des chaînes YAML - -Lors de l'écriture en YAML, certaines chaînes doivent être entre guillemets pour être correctement analysées : - -### Chaînes qui doivent être entre guillemets - -```yaml -# URLs with hyphens, colons, special characters -url: "https://api.example.com/users/123" -url: "https://my-api.example.com/data" - -# Header values with hyphens or special characters -headers: - - id: header-uuid - cells: - Key: "User-Agent" - Value: "My-Application/1.0" - - id: auth-uuid - cells: - Key: "Authorization" - Value: "Bearer my-token-123" - -# Parameter values with hyphens -params: - - id: param-uuid - cells: - Key: "sort-by" - Value: "created-at" -``` - -### Quand utiliser les guillemets - -- ✅ **Toujours mettre entre guillemets** : URLs, tokens, valeurs avec des traits d'union, des deux-points ou des caractères spéciaux -- ✅ **Toujours mettre entre guillemets** : Valeurs qui commencent par des chiffres mais qui doivent rester des chaînes -- ✅ **Toujours mettre entre guillemets** : Chaînes ressemblant à des booléens mais qui doivent rester des chaînes -- ❌ **Ne pas mettre entre guillemets** : Chaînes alphanumériques simples sans caractères spéciaux - -### Exemples - -```yaml -# ✅ Correct -url: "https://api.stripe.com/v1/charges" -headers: - - id: auth-header - cells: - Key: "Authorization" - Value: "Bearer sk-test-123456789" - -# ❌ Incorrect (may cause parsing errors) -url: https://api.stripe.com/v1/charges -headers: - - id: auth-header - cells: - Key: Authorization - Value: Bearer sk-test-123456789 -``` - -## Bonnes pratiques - -- Utilisez des variables d'environnement pour les clés API : `{{API_KEY_NAME}}` -- Incluez la gestion des erreurs avec les connexions d'erreur -- Définissez des délais d'attente appropriés pour votre cas d'utilisation -- Validez les codes d'état de réponse dans les blocs suivants -- Utilisez des noms de blocs significatifs pour faciliter les références -- **Mettez toujours entre guillemets les chaînes avec des caractères spéciaux, les URLs et les tokens** \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/blocks/condition.mdx b/apps/docs/content/docs/fr/yaml/blocks/condition.mdx deleted file mode 100644 index be5fa279c3..0000000000 --- a/apps/docs/content/docs/fr/yaml/blocks/condition.mdx +++ /dev/null @@ -1,165 +0,0 @@ ---- -title: Schéma YAML du bloc de condition -description: Référence de configuration YAML pour les blocs de condition ---- - -## Définition du schéma - -```yaml -type: object -required: - - type - - name - - inputs - - connections -properties: - type: - type: string - enum: [condition] - description: Block type identifier - name: - type: string - description: Display name for this condition block - inputs: - type: object - required: - - conditions - properties: - conditions: - type: object - description: Conditional expressions and their logic - properties: - if: - type: string - description: Primary condition expression (boolean) - else-if: - type: string - description: Secondary condition expression (optional) - else-if-2: - type: string - description: Third condition expression (optional) - else-if-3: - type: string - description: Fourth condition expression (optional) - # Additional else-if-N conditions can be added as needed - else: - type: boolean - description: Default fallback condition (optional) - default: true - connections: - type: object - required: - - conditions - properties: - conditions: - type: object - description: Target blocks for each condition outcome - properties: - if: - type: string - description: Target block ID when 'if' condition is true - else-if: - type: string - description: Target block ID when 'else-if' condition is true - else-if-2: - type: string - description: Target block ID when 'else-if-2' condition is true - else-if-3: - type: string - description: Target block ID when 'else-if-3' condition is true - # Additional else-if-N connections can be added as needed - else: - type: string - description: Target block ID when no conditions match -``` - -## Configuration des connexions - -Contrairement aux autres blocs, les conditions utilisent des connexions ramifiées basées sur les résultats des conditions : - -```yaml -connections: - conditions: - if: # Target block ID when primary condition is true - else-if: # Target block ID when secondary condition is true (optional) - else-if-2: # Target block ID when third condition is true (optional) - else-if-3: # Target block ID when fourth condition is true (optional) - # Additional else-if-N connections can be added as needed - else: # Target block ID when no conditions match (optional) -``` - -## Exemples - -### Simple Si-Sinon - -```yaml -status-check: - type: condition - name: "Status Check" - inputs: - conditions: - if: === "approved" - else: true - connections: - conditions: - if: send-approval-email - else: send-rejection-email -``` - -### Conditions multiples - -```yaml -user-routing: - type: condition - name: "User Type Router" - inputs: - conditions: - if: === "admin" - else-if: === "premium" - else-if-2: === "basic" - else: true - connections: - conditions: - if: admin-dashboard - else-if: premium-features - else-if-2: basic-features - else: registration-flow -``` - -### Comparaisons numériques - -```yaml -score-evaluation: - type: condition - name: "Score Evaluation" - inputs: - conditions: - if: >= 90 - else-if: >= 70 - else-if-2: >= 50 - else: true - connections: - conditions: - if: excellent-response - else-if: good-response - else-if-2: average-response - else: poor-response -``` - -### Logique complexe - -```yaml -eligibility-check: - type: condition - name: "Eligibility Check" - inputs: - conditions: - if: >= 18 && === true - else-if: >= 16 && === true - else: true - connections: - conditions: - if: full-access - else-if: limited-access - else: access-denied -``` \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/blocks/evaluator.mdx b/apps/docs/content/docs/fr/yaml/blocks/evaluator.mdx deleted file mode 100644 index d3f014355e..0000000000 --- a/apps/docs/content/docs/fr/yaml/blocks/evaluator.mdx +++ /dev/null @@ -1,255 +0,0 @@ ---- -title: Schéma YAML du bloc évaluateur -description: Référence de configuration YAML pour les blocs évaluateurs ---- - -## Définition du schéma - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [evaluator] - description: Block type identifier - name: - type: string - description: Display name for this evaluator block - inputs: - type: object - required: - - content - - metrics - - model - - apiKey - properties: - content: - type: string - description: Content to evaluate (can reference other blocks) - metrics: - type: array - description: Evaluation criteria and scoring ranges - items: - type: object - properties: - name: - type: string - description: Metric identifier - description: - type: string - description: Detailed explanation of what the metric measures - range: - type: object - properties: - min: - type: number - description: Minimum score value - max: - type: number - description: Maximum score value - required: [min, max] - description: Scoring range with numeric bounds - model: - type: string - description: AI model identifier (e.g., gpt-4o, claude-3-5-sonnet-20241022) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Model temperature for evaluation - default: 0.3 - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful evaluation - error: - type: string - description: Target block ID for error handling -``` - -## Configuration des connexions - -Les connexions définissent où le flux de travail se dirige en fonction des résultats d'évaluation : - -```yaml -connections: - success: # Target block ID for successful evaluation - error: # Target block ID for error handling (optional) -``` - -## Exemples - -### Évaluation de la qualité du contenu - -```yaml -content-evaluator: - type: evaluator - name: "Content Quality Evaluator" - inputs: - content: - metrics: - - name: "accuracy" - description: "How factually accurate is the content?" - range: - min: 1 - max: 5 - - name: "clarity" - description: "How clear and understandable is the content?" - range: - min: 1 - max: 5 - - name: "relevance" - description: "How relevant is the content to the original query?" - range: - min: 1 - max: 5 - - name: "completeness" - description: "How complete and comprehensive is the content?" - range: - min: 1 - max: 5 - model: gpt-4o - temperature: 0.2 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: quality-report - error: evaluation-error -``` - -### Évaluation de la réponse client - -```yaml -response-evaluator: - type: evaluator - name: "Customer Response Evaluator" - inputs: - content: - metrics: - - name: "helpfulness" - description: "How helpful is the response in addressing the customer's needs?" - range: - min: 1 - max: 10 - - name: "tone" - description: "How appropriate and professional is the tone?" - range: - min: 1 - max: 10 - - name: "completeness" - description: "Does the response fully address all aspects of the inquiry?" - range: - min: 1 - max: 10 - model: claude-3-5-sonnet-20241022 - apiKey: '{{ANTHROPIC_API_KEY}}' - connections: - success: response-processor -``` - -### Évaluation par test A/B - -```yaml -ab-test-evaluator: - type: evaluator - name: "A/B Test Evaluator" - inputs: - content: | - Version A: - Version B: - - Compare these two versions for the following criteria. - metrics: - - name: "engagement" - description: "Which version is more likely to engage users?" - range: "A, B, or Tie" - - name: "clarity" - description: "Which version communicates more clearly?" - range: "A, B, or Tie" - - name: "persuasiveness" - description: "Which version is more persuasive?" - range: "A, B, or Tie" - model: gpt-4o - temperature: 0.1 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: test-results -``` - -### Notation multidimensionnelle du contenu - -```yaml -comprehensive-evaluator: - type: evaluator - name: "Comprehensive Content Evaluator" - inputs: - content: - metrics: - - name: "technical_accuracy" - description: "How technically accurate and correct is the information?" - range: - min: 0 - max: 100 - - name: "readability" - description: "How easy is the content to read and understand?" - range: - min: 0 - max: 100 - - name: "seo_optimization" - description: "How well optimized is the content for search engines?" - range: - min: 0 - max: 100 - - name: "user_engagement" - description: "How likely is this content to engage and retain readers?" - range: - min: 0 - max: 100 - - name: "brand_alignment" - description: "How well does the content align with brand voice and values?" - range: - min: 0 - max: 100 - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: content-optimization -``` - -## Références de sortie - -Après l'exécution d'un bloc évaluateur, vous pouvez référencer ses sorties : - -```yaml -# In subsequent blocks -next-block: - inputs: - evaluation: # Evaluation summary - scores: # Individual metric scores - overall: # Overall assessment -``` - -## Bonnes pratiques - -- Définir des critères d'évaluation clairs et spécifiques -- Utiliser des plages de notation appropriées pour votre cas d'utilisation -- Choisir des modèles avec de solides capacités de raisonnement -- Utiliser une température plus basse pour une notation cohérente -- Inclure des descriptions détaillées des métriques -- Tester avec divers types de contenu -- Envisager plusieurs évaluateurs pour des évaluations complexes \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/blocks/function.mdx b/apps/docs/content/docs/fr/yaml/blocks/function.mdx deleted file mode 100644 index 4c5bc1fc11..0000000000 --- a/apps/docs/content/docs/fr/yaml/blocks/function.mdx +++ /dev/null @@ -1,162 +0,0 @@ ---- -title: Schéma YAML du bloc de fonction -description: Référence de configuration YAML pour les blocs de fonction ---- - -## Définition du schéma - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [function] - description: Block type identifier - name: - type: string - description: Display name for this function block - inputs: - type: object - required: - - code - properties: - code: - type: string - description: JavaScript/TypeScript code to execute (multiline string) - timeout: - type: number - description: Maximum execution time in milliseconds - default: 30000 - minimum: 1000 - maximum: 300000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful execution - error: - type: string - description: Target block ID for error handling -``` - -## Configuration des connexions - -Les connexions définissent où le flux de travail se dirige en fonction des résultats d'exécution : - -```yaml -connections: - success: # Target block ID for successful execution - error: # Target block ID for error handling (optional) -``` - -## Exemples - -### Validation simple - -```yaml -input-validator: - type: function - name: "Input Validator" - inputs: - code: |- - // Check if input number is greater than 5 - const inputValue = parseInt(, 10); - - if (inputValue > 5) { - return { - valid: true, - value: inputValue, - message: "Input is valid" - }; - } else { - return { - valid: false, - value: inputValue, - message: "Input must be greater than 5" - }; - } - connections: - success: next-step - error: handle-error -``` - -### Traitement des données - -```yaml -data-processor: - type: function - name: "Data Transformer" - inputs: - code: | - // Transform the input data - const rawData = ; - - // Process and clean the data - const processed = rawData - .filter(item => item.status === 'active') - .map(item => ({ - id: item.id, - name: item.name.trim(), - date: new Date(item.created).toISOString() - })); - - return processed; - connections: - success: api-save - error: error-handler -``` - -### Intégration d'API - -```yaml -api-formatter: - type: function - name: "Format API Request" - inputs: - code: | - // Prepare data for API submission - const userData = ; - - const apiPayload = { - timestamp: new Date().toISOString(), - data: userData, - source: "workflow-automation", - version: "1.0" - }; - - return apiPayload; - connections: - success: api-call -``` - -### Calculs - -```yaml -calculator: - type: function - name: "Calculate Results" - inputs: - code: | - // Perform calculations on input data - const numbers = ; - - const sum = numbers.reduce((a, b) => a + b, 0); - const average = sum / numbers.length; - const max = Math.max(...numbers); - const min = Math.min(...numbers); - - return { - sum, - average, - max, - min, - count: numbers.length - }; - connections: - success: results-display -``` \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/blocks/index.mdx b/apps/docs/content/docs/fr/yaml/blocks/index.mdx deleted file mode 100644 index 28e0fbb5fb..0000000000 --- a/apps/docs/content/docs/fr/yaml/blocks/index.mdx +++ /dev/null @@ -1,151 +0,0 @@ ---- -title: Schémas de blocs -description: Référence complète du schéma YAML pour tous les blocs Sim ---- - -import { Card, Cards } from "fumadocs-ui/components/card"; - -Cette section contient les définitions complètes du schéma YAML pour tous les types de blocs disponibles dans Sim. Chaque type de bloc a des exigences de configuration spécifiques et des formats de sortie. - -## Blocs fondamentaux - -Voici les éléments essentiels pour créer des flux de travail : - - - - Point d'entrée du flux de travail prenant en charge les déclencheurs manuels, les webhooks et les planifications - - - Traitement alimenté par l'IA avec intégration LLM et prise en charge d'outils - - - Environnement d'exécution de code JavaScript/TypeScript personnalisé - - - Formatage et renvoi des résultats finaux du flux de travail - - - -## Logique et flux de contrôle - -Blocs pour implémenter la logique conditionnelle et le flux de contrôle : - - - - Branchement conditionnel basé sur des expressions booléennes - - - Routage intelligent alimenté par l'IA vers plusieurs chemins - - - Traitement itératif avec des boucles for et forEach - - - Exécution simultanée sur plusieurs instances - - - -## Blocs d'intégration - -Blocs pour se connecter à des services et systèmes externes : - - - - Requêtes HTTP vers des API REST externes - - - Déclencheurs webhook pour intégrations externes - - - -## Blocs avancés - -Blocs spécialisés pour des modèles de flux de travail complexes : - - - - Valider les sorties selon des critères et métriques définis - - - Exécuter d'autres flux de travail comme composants réutilisables - - - -## Éléments de schéma communs - -Tous les blocs partagent ces éléments communs : - -### Structure de base - -```yaml -block-id: - type: - name: - inputs: - # Block-specific configuration - connections: - # Connection definitions -``` - -### Types de connexion - -- **success** : Bloc cible pour une exécution réussie -- **error** : Bloc cible pour la gestion des erreurs (facultatif) -- **conditions** : Chemins multiples pour les blocs conditionnels - -### Variables d'environnement - -Utilisez des doubles accolades pour les variables d'environnement : - -```yaml -inputs: - apiKey: '{{API_KEY_NAME}}' - endpoint: '{{SERVICE_ENDPOINT}}' -``` - -### Références de bloc - -Référencez les sorties d'autres blocs en utilisant le nom du bloc en minuscules : - -```yaml -inputs: - userPrompt: - data: - originalInput: -``` - -## Règles de validation - -Tous les blocs YAML sont validés par rapport à leurs schémas : - -1. **Champs obligatoires** : doivent être présents -2. **Validation de type** : les valeurs doivent correspondre aux types attendus -3. **Validation d'énumération** : les valeurs de chaîne doivent provenir des listes autorisées -4. **Validation de plage** : les nombres doivent être dans les plages spécifiées -5. **Validation de modèle** : les chaînes doivent correspondre aux modèles regex (le cas échéant) - -## Référence rapide - -### Types de blocs et propriétés - -| Type de bloc | Sortie principale | Cas d'utilisation courants | -|------------|----------------|------------------| -| starter | `.input` | Point d'entrée du workflow | -| agent | `.content` | Traitement IA, génération de texte | -| function | `.output` | Transformation de données, calculs | -| api | `.output` | Intégration de services externes | -| condition | N/A (branchement) | Logique conditionnelle | -| router | N/A (branchement) | Routage intelligent | -| response | N/A (terminal) | Formatage de sortie finale | -| loop | `.results` | Traitement itératif | -| parallel | `.results` | Traitement concurrent | -| webhook | `.payload` | Déclencheurs externes | -| evaluator | `.score` | Validation de sortie, évaluation de qualité | -| workflow | `.output` | Exécution de sous-workflow, modularité | - -### Obligatoire vs optionnel - -- **Toujours obligatoire** : `type`, `name` -- **Généralement obligatoire** : `inputs`, `connections` -- **Dépendant du contexte** : les champs d'entrée spécifiques varient selon le type de bloc -- **Toujours optionnel** : connexions `error`, champs spécifiques à l'interface utilisateur \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/blocks/parallel.mdx b/apps/docs/content/docs/fr/yaml/blocks/parallel.mdx deleted file mode 100644 index 8c4e20eee1..0000000000 --- a/apps/docs/content/docs/fr/yaml/blocks/parallel.mdx +++ /dev/null @@ -1,312 +0,0 @@ ---- -title: Schéma YAML des blocs parallèles -description: Référence de configuration YAML pour les blocs parallèles ---- - -## Définition du schéma - -```yaml -type: object -required: - - type - - name - - inputs - - connections -properties: - type: - type: string - enum: [parallel] - description: Block type identifier - name: - type: string - description: Display name for this parallel block - inputs: - type: object - required: - - parallelType - properties: - parallelType: - type: string - enum: [count, collection] - description: Type of parallel execution - count: - type: number - description: Number of parallel instances (for 'count' type) - minimum: 1 - maximum: 100 - collection: - type: string - description: Collection to distribute across instances (for 'collection' type) - maxConcurrency: - type: number - description: Maximum concurrent executions - default: 10 - minimum: 1 - maximum: 50 - connections: - type: object - required: - - parallel - properties: - parallel: - type: object - required: - - start - properties: - start: - type: string - description: Target block ID to execute inside each parallel instance - end: - type: string - description: Target block ID after all parallel instances complete (optional) - error: - type: string - description: Target block ID for error handling -``` - -## Configuration de connexion - -Les blocs parallèles utilisent un format de connexion spécial avec une section `parallel` : - -```yaml -connections: - parallel: - start: # Target block ID to execute inside each parallel instance - end: # Target block ID after all instances complete (optional) - error: # Target block ID for error handling (optional) -``` - -## Configuration des blocs enfants - -Les blocs à l'intérieur d'un bloc parallèle doivent avoir leur `parentId` défini sur l'ID du bloc parallèle : - -```yaml -parallel-1: - type: parallel - name: "Process Items" - inputs: - parallelType: collection - collection: - connections: - parallel: - start: process-item - end: aggregate-results - -# Child block inside the parallel -process-item: - type: agent - name: "Process Item" - parentId: parallel-1 # References the parallel block - inputs: - systemPrompt: "Process this item" - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## Exemples - -### Traitement parallèle basé sur le comptage - -```yaml -worker-parallel: - type: parallel - name: "Worker Parallel" - inputs: - parallelType: count - count: 5 - maxConcurrency: 3 - connections: - parallel: - start: worker-task - end: collect-worker-results - -worker-task: - type: api - name: "Worker Task" - parentId: worker-parallel - inputs: - url: "https://api.worker.com/process" - method: POST - headers: - - key: "Authorization" - value: "Bearer {{WORKER_API_KEY}}" - body: | - { - "instanceId": , - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: worker-complete -``` - -### Traitement parallèle basé sur les collections - -```yaml -api-parallel: - type: parallel - name: "API Parallel" - inputs: - parallelType: collection - collection: - maxConcurrency: 10 - connections: - parallel: - start: call-api - end: merge-api-results - -call-api: - type: api - name: "Call API" - parentId: api-parallel - inputs: - url: - method: - headers: - - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - connections: - success: api-complete -``` - -### Pipeline de traitement parallèle complexe - -```yaml -data-processing-parallel: - type: parallel - name: "Data Processing Parallel" - inputs: - parallelType: collection - collection: - maxConcurrency: 8 - connections: - parallel: - start: validate-data - end: final-aggregation - error: parallel-error-handler - -validate-data: - type: function - name: "Validate Data" - parentId: data-processing-parallel - inputs: - code: | - const record = ; - const index = ; - - // Validate record structure - if (!record.id || !record.content) { - throw new Error(`Invalid record at index ${index}`); - } - - return { - valid: true, - recordId: record.id, - validatedAt: new Date().toISOString() - }; - connections: - success: process-data - error: validation-error - -process-data: - type: agent - name: "Process Data" - parentId: data-processing-parallel - inputs: - systemPrompt: "Process and analyze this data record" - userPrompt: | - Record ID: - Content: - Instance: - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: store-result - -store-result: - type: function - name: "Store Result" - parentId: data-processing-parallel - inputs: - code: | - const processed = ; - const recordId = ; - - return { - recordId, - processed, - completedAt: new Date().toISOString(), - instanceIndex: - }; -``` - -### Analyse IA concurrente - -```yaml -multi-model-parallel: - type: parallel - name: "Multi-Model Analysis" - inputs: - parallelType: collection - collection: | - [ - {"model": "gpt-4o", "focus": "technical accuracy"}, - {"model": "claude-3-5-sonnet-20241022", "focus": "creative quality"}, - {"model": "gemini-2.0-flash-exp", "focus": "factual verification"} - ] - maxConcurrency: 3 - connections: - parallel: - start: analyze-content - end: combine-analyses - -analyze-content: - type: agent - name: "Analyze Content" - parentId: multi-model-parallel - inputs: - systemPrompt: | - You are analyzing content with a focus on . - Provide detailed analysis from this perspective. - userPrompt: | - Content to analyze: - Analysis focus: - model: - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: analysis-complete -``` - -## Variables parallèles - -À l'intérieur des blocs enfants parallèles, ces variables spéciales sont disponibles : - -```yaml -# Available in all child blocks of the parallel - # Instance number (0-based) - # Item for this instance (collection type) - # Full collection (collection type) -``` - -## Références de sortie - -Une fois qu'un bloc parallèle est terminé, vous pouvez référencer ses résultats agrégés : - -```yaml -# In blocks after the parallel -final-processor: - inputs: - all-results: # Array of all instance results - total-count: # Number of instances completed -``` - -## Bonnes pratiques - -- Utilisez un maxConcurrency approprié pour éviter de surcharger les API -- Assurez-vous que les opérations sont indépendantes et ne dépendent pas les unes des autres -- Incluez une gestion des erreurs pour une exécution parallèle robuste -- Testez d'abord avec de petites collections -- Surveillez les limites de taux pour les API externes -- Utilisez le type collection pour distribuer le travail, le type count pour les instances fixes -- Tenez compte de l'utilisation de la mémoire avec de grandes collections \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/blocks/response.mdx b/apps/docs/content/docs/fr/yaml/blocks/response.mdx deleted file mode 100644 index 0c3165a8a8..0000000000 --- a/apps/docs/content/docs/fr/yaml/blocks/response.mdx +++ /dev/null @@ -1,239 +0,0 @@ ---- -title: Schéma YAML du bloc de réponse -description: Référence de configuration YAML pour les blocs de réponse ---- - -## Définition du schéma - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [response] - description: Block type identifier - name: - type: string - description: Display name for this response block - inputs: - type: object - properties: - dataMode: - type: string - enum: [structured, json] - description: Mode for defining response data structure - default: structured - builderData: - type: object - description: Structured response data (when dataMode is 'structured') - data: - type: object - description: JSON response data (when dataMode is 'json') - status: - type: number - description: HTTP status code - default: 200 - minimum: 100 - maximum: 599 - headers: - type: array - description: Response headers as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column -``` - -## Configuration de connexion - -Les blocs de réponse sont des blocs terminaux (sans connexions sortantes) et définissent la sortie finale : - -```yaml -# No connections object needed - Response blocks are always terminal -``` - -## Exemples - -### Réponse simple - -```yaml -simple-response: - type: response - name: "Simple Response" - inputs: - data: - message: "Hello World" - timestamp: - status: 200 -``` - -### Réponse de succès - -```yaml -success-response: - type: response - name: "Success Response" - inputs: - data: - success: true - user: - id: - name: - email: - created_at: - status: 201 - headers: - - key: "Location" - value: "/api/users/" - - key: "X-Created-By" - value: "workflow-engine" -``` - -### Réponse avec format complet d'en-tête de tableau - -Lorsque les en-têtes sont créés via l'interface utilisateur du tableau, le YAML inclut des métadonnées supplémentaires : - -```yaml -api-response: - type: response - name: "API Response" - inputs: - data: - message: "Request processed successfully" - id: - status: 200 - headers: - - id: header-1-uuid-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - - id: header-2-uuid-here - key: "Cache-Control" - value: "no-cache" - cells: - Key: "Cache-Control" - Value: "no-cache" - - id: header-3-uuid-here - key: "X-API-Version" - value: "2.1" - cells: - Key: "X-API-Version" - Value: "2.1" -``` - -### Réponse d'erreur - -```yaml -error-response: - type: response - name: "Error Response" - inputs: - data: - error: true - message: - code: "VALIDATION_FAILED" - details: - status: 400 - headers: - - key: "X-Error-Code" - value: "VALIDATION_FAILED" -``` - -### Réponse paginée - -```yaml -paginated-response: - type: response - name: "Paginated Response" - inputs: - data: - data: - pagination: - page: - per_page: - total: - total_pages: - status: 200 - headers: - - key: "X-Total-Count" - value: - - key: "Cache-Control" - value: "public, max-age=300" - - key: "Content-Type" - value: "application/json" -``` - -## Formats de paramètres de tableau - -Le bloc de réponse prend en charge deux formats pour les en-têtes : - -### Format simplifié (YAML manuel) - -Lors de l'écriture manuelle du YAML, vous pouvez utiliser le format simplifié : - -```yaml -headers: - - key: "Content-Type" - value: "application/json" - - key: "Cache-Control" - value: "no-cache" -``` - -### Format de tableau complet (généré par l'interface utilisateur) - -Lorsque les en-têtes sont créés via l'interface utilisateur du tableau, le YAML inclut des métadonnées supplémentaires : - -```yaml -headers: - - id: unique-identifier-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" -``` - -**Différences clés :** -- `id` : Identifiant unique pour suivre la ligne du tableau -- `cells` : Valeurs d'affichage utilisées par l'interface utilisateur du tableau -- Les deux formats sont fonctionnellement équivalents pour l'exécution du workflow -- Le format complet préserve l'état de l'interface utilisateur lors de l'importation/exportation des workflows - -**Important :** Mettez toujours entre guillemets les noms d'en-têtes et les valeurs qui contiennent des caractères spéciaux : - -```yaml -headers: - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" - - id: cache-control-uuid - cells: - Key: "Cache-Control" - Value: "no-cache" -``` - -``` \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/blocks/router.mdx b/apps/docs/content/docs/fr/yaml/blocks/router.mdx deleted file mode 100644 index fd523c5ed3..0000000000 --- a/apps/docs/content/docs/fr/yaml/blocks/router.mdx +++ /dev/null @@ -1,200 +0,0 @@ ---- -title: Schéma YAML du bloc routeur -description: Référence de configuration YAML pour les blocs routeur ---- - -## Définition du schéma - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [router] - description: Block type identifier - name: - type: string - description: Display name for this router block - inputs: - type: object - required: - - prompt - - model - - apiKey - properties: - prompt: - type: string - description: Instructions for routing decisions and criteria - model: - type: string - description: AI model identifier (e.g., gpt-4o, gemini-2.5-pro, deepseek-chat) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Model temperature for routing decisions - default: 0.3 - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - connections: - type: object - description: Multiple connection paths for different routing outcomes - properties: - success: - type: array - items: - type: string - description: Array of target block IDs for routing destinations -``` - -## Configuration de connexion - -Les blocs routeur utilisent un tableau success contenant toutes les destinations de routage possibles : - -```yaml -connections: - success: - - # Target block ID option 1 - - # Target block ID option 2 - - # Target block ID option 3 - # Additional target block IDs as needed -``` - -## Exemples - -### Routeur par type de contenu - -```yaml -content-router: - type: router - name: "Content Type Router" - inputs: - prompt: | - Route this content based on its type: - - If it's a question, route to question-handler - - If it's a complaint, route to complaint-handler - - If it's feedback, route to feedback-handler - - If it's a request, route to request-handler - - Content: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - question-handler - - complaint-handler - - feedback-handler - - request-handler -``` - -### Routeur par priorité - -```yaml -priority-router: - type: router - name: "Priority Router" - inputs: - prompt: | - Analyze the urgency and route accordingly: - - urgent-queue: High priority, needs immediate attention - - standard-queue: Normal priority, standard processing - - low-queue: Low priority, can be delayed - - Email content: - - Route based on urgency indicators, deadlines, and tone. - model: gpt-4o - temperature: 0.2 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - urgent-queue - - standard-queue - - low-queue -``` - -### Routeur par département - -```yaml -department-router: - type: router - name: "Department Router" - inputs: - prompt: | - Route this customer inquiry to the appropriate department: - - - sales-team: Sales questions, pricing, demos - - support-team: Technical issues, bug reports, how-to questions - - billing-team: Payment issues, subscription changes, invoices - - general-team: General inquiries, feedback, other topics - - Customer message: - Customer type: - model: claude-3-5-sonnet-20241022 - apiKey: '{{ANTHROPIC_API_KEY}}' - connections: - success: - - sales-team - - support-team - - billing-team - - general-team -``` - -## Configuration avancée - -### Routeur multi-modèles - -```yaml -model-selector-router: - type: router - name: "Model Selection Router" - inputs: - prompt: | - Based on the task complexity, route to the appropriate model: - - simple-gpt35: Simple questions, basic tasks - - advanced-gpt4: Complex analysis, detailed reasoning - - specialized-claude: Creative writing, nuanced analysis - - Task: - Complexity indicators: - model: gpt-4o-mini - temperature: 0.1 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - simple-gpt35 - - advanced-gpt4 - - specialized-claude -``` - -## Références de sortie - -Les blocs routeur ne produisent pas de sorties directes mais contrôlent le chemin du flux de travail : - -```yaml -# Router decisions affect which subsequent blocks execute -# Access the routed block's outputs normally: -final-step: - inputs: - routed-result: -``` - -## Bonnes pratiques - -- Fournir des critères de routage clairs dans le prompt -- Utiliser des noms de blocs cibles spécifiques et descriptifs -- Inclure des exemples de contenu pour chaque chemin de routage -- Utiliser des valeurs de température plus basses pour un routage cohérent -- Tester avec divers types d'entrées pour assurer un routage précis -- Envisager des chemins de repli pour les cas particuliers \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/blocks/starter.mdx b/apps/docs/content/docs/fr/yaml/blocks/starter.mdx deleted file mode 100644 index ee8cd8f51f..0000000000 --- a/apps/docs/content/docs/fr/yaml/blocks/starter.mdx +++ /dev/null @@ -1,183 +0,0 @@ ---- -title: Schéma YAML du bloc de démarrage -description: Référence de configuration YAML pour les blocs de démarrage ---- - -## Définition du schéma - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [starter] - description: Block type identifier - name: - type: string - description: Display name for this starter block - inputs: - type: object - properties: - startWorkflow: - type: string - enum: [manual, webhook, schedule] - description: How the workflow should be triggered - default: manual - inputFormat: - type: array - description: Expected input structure for API calls (manual workflows) - items: - type: object - properties: - name: - type: string - description: Field name - type: - type: string - enum: [string, number, boolean, object, array] - description: Field type - scheduleType: - type: string - enum: [hourly, daily, weekly, monthly] - description: Schedule frequency (schedule workflows only) - hourlyMinute: - type: number - minimum: 0 - maximum: 59 - description: Minute of the hour to run (hourly schedules) - dailyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (daily schedules) - weeklyDay: - type: string - enum: [MON, TUE, WED, THU, FRI, SAT, SUN] - description: Day of week to run (weekly schedules) - weeklyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (weekly schedules) - monthlyDay: - type: number - minimum: 1 - maximum: 28 - description: Day of month to run (monthly schedules) - monthlyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (monthly schedules) - timezone: - type: string - description: Timezone for scheduled workflows - default: UTC - webhookProvider: - type: string - enum: [slack, gmail, airtable, telegram, generic, whatsapp, github, discord, stripe] - description: Provider for webhook integration (webhook workflows only) - webhookConfig: - type: object - description: Provider-specific webhook configuration - connections: - type: object - properties: - success: - type: string - description: Target block ID to execute when workflow starts -``` - -## Configuration de connexion - -Le bloc de démarrage n'a qu'une connexion de succès puisqu'il s'agit du point d'entrée : - -```yaml -connections: - success: # Target block ID to execute when workflow starts -``` - -## Exemples - -### Démarrage manuel - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: next-block -``` - -### Démarrage manuel avec format d'entrée - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: manual - inputFormat: - - name: query - type: string - - name: email - type: string - - name: age - type: number - - name: isActive - type: boolean - - name: preferences - type: object - - name: tags - type: array - connections: - success: agent-1 -``` - -### Planification quotidienne - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: schedule - scheduleType: daily - dailyTime: "09:00" - timezone: "America/New_York" - connections: - success: daily-task -``` - -### Planification hebdomadaire - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: schedule - scheduleType: weekly - weeklyDay: MON - weeklyTime: "08:30" - timezone: UTC - connections: - success: weekly-report -``` - -### Déclencheur webhook - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: webhook - webhookProvider: slack - webhookConfig: - # Provider-specific configuration - connections: - success: process-webhook -``` \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/blocks/webhook.mdx b/apps/docs/content/docs/fr/yaml/blocks/webhook.mdx deleted file mode 100644 index 0c4dbbf289..0000000000 --- a/apps/docs/content/docs/fr/yaml/blocks/webhook.mdx +++ /dev/null @@ -1,403 +0,0 @@ ---- -title: Schéma YAML du bloc Webhook -description: Référence de configuration YAML pour les blocs Webhook ---- - -## Définition du schéma - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [webhook] - description: Block type identifier - name: - type: string - description: Display name for this webhook block - inputs: - type: object - properties: - webhookConfig: - type: object - description: Webhook configuration settings - properties: - enabled: - type: boolean - description: Whether the webhook is active - default: true - secret: - type: string - description: Secret key for webhook verification - headers: - type: array - description: Expected headers for validation as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Expected header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column - methods: - type: array - description: Allowed HTTP methods - items: - type: string - enum: [GET, POST, PUT, DELETE, PATCH] - default: [POST] - responseConfig: - type: object - description: Response configuration for the webhook - properties: - status: - type: number - description: HTTP status code to return - default: 200 - minimum: 100 - maximum: 599 - headers: - type: array - description: Response headers as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column - body: - type: string - description: Response body content - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful webhook processing - error: - type: string - description: Target block ID for error handling -``` - -## Configuration de connexion - -Les connexions définissent où le flux de travail se dirige en fonction du traitement du webhook : - -```yaml -connections: - success: # Target block ID for successful processing - error: # Target block ID for error handling (optional) -``` - -## Exemples - -### Déclencheur Webhook basique - -```yaml -github-webhook: - type: webhook - name: "GitHub Webhook" - inputs: - webhookConfig: - enabled: true - secret: "{{GITHUB_WEBHOOK_SECRET}}" - methods: [POST] - headers: - - key: "X-GitHub-Event" - value: "push" - responseConfig: - status: 200 - body: | - { - "message": "Webhook received successfully", - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: process-github-event - error: webhook-error-handler -``` - -### Webhook d'événement Slack - -```yaml -slack-events: - type: webhook - name: "Slack Events" - inputs: - webhookConfig: - enabled: true - secret: "{{SLACK_SIGNING_SECRET}}" - methods: [POST] - headers: - - key: "Content-Type" - value: "application/json" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "challenge": "" - } - connections: - success: handle-slack-event -``` - -### Webhook de paiement (Stripe) - -```yaml -stripe-webhook: - type: webhook - name: "Stripe Payment Webhook" - inputs: - webhookConfig: - enabled: true - secret: "{{STRIPE_WEBHOOK_SECRET}}" - methods: [POST] - headers: - - key: "Stripe-Signature" - value: "*" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "received": true - } - connections: - success: process-payment-event - error: payment-webhook-error -``` - -### Webhook avec format complet d'en-tête de tableau - -Lorsque les en-têtes sont créés via l'interface utilisateur du tableau, le YAML inclut des métadonnées supplémentaires : - -```yaml -api-webhook-complete: - type: webhook - name: "API Webhook with Table Headers" - inputs: - webhookConfig: - enabled: true - methods: [POST] - headers: - - id: header-1-uuid-here - key: "Authorization" - value: "Bearer {{WEBHOOK_API_KEY}}" - cells: - Key: "Authorization" - Value: "Bearer {{WEBHOOK_API_KEY}}" - - id: header-2-uuid-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - responseConfig: - status: 200 - headers: - - id: response-header-1-uuid - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - - id: response-header-2-uuid - key: "X-Webhook-Response" - value: "processed" - cells: - Key: "X-Webhook-Response" - Value: "processed" - body: | - { - "status": "received", - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: process-webhook-complete -``` - -### Webhook API générique - -```yaml -api-webhook: - type: webhook - name: "API Webhook" - inputs: - webhookConfig: - enabled: true - methods: [POST, PUT] - headers: - - key: "Authorization" - value: "Bearer {{WEBHOOK_API_KEY}}" - - key: "Content-Type" - value: "application/json" - responseConfig: - status: 202 - headers: - - key: "Content-Type" - value: "application/json" - - key: "X-Processed-By" - value: "Sim" - body: | - { - "status": "accepted", - "id": "{{Math.random().toString(36).substr(2, 9)}}", - "received_at": "{{new Date().toISOString()}}" - } - connections: - success: process-webhook-data -``` - -### Webhook multi-méthodes - -```yaml -crud-webhook: - type: webhook - name: "CRUD Webhook" - inputs: - webhookConfig: - enabled: true - methods: [GET, POST, PUT, DELETE] - headers: - - key: "X-API-Key" - value: "{{CRUD_API_KEY}}" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "method": "", - "processed": true, - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: route-by-method -``` - -## Formats de paramètres de tableau - -Le bloc Webhook prend en charge deux formats pour les en-têtes (à la fois les en-têtes de validation et les en-têtes de réponse) : - -### Format simplifié (YAML manuel) - -Lors de la rédaction manuelle du YAML, vous pouvez utiliser le format simplifié : - -```yaml -headers: - - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - - key: "Content-Type" - value: "application/json" -``` - -### Format de tableau complet (généré par l'interface utilisateur) - -Lorsque les en-têtes sont créés via l'interface utilisateur du tableau, le YAML inclut des métadonnées supplémentaires : - -```yaml -headers: - - id: unique-identifier-here - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" -``` - -**Différences clés :** -- `id` : Identifiant unique pour suivre la ligne du tableau -- `cells` : Valeurs d'affichage utilisées par l'interface utilisateur du tableau -- Les deux formats sont fonctionnellement équivalents pour le traitement des webhooks -- Le format complet préserve l'état de l'interface utilisateur lors de l'importation/exportation des workflows - -**Important :** mettez toujours entre guillemets les noms d'en-têtes et les valeurs qui contiennent des caractères spéciaux : - -```yaml -headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{WEBHOOK_API_KEY}}" - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" -``` - -## Variables de webhook - -Dans les workflows déclenchés par webhook, ces variables spéciales sont disponibles : - -```yaml -# Available in blocks after the webhook - # Full request payload/body - # Request headers - # HTTP method used - # Query parameters - # Request path - # Challenge parameter (for verification) -``` - -## Références de sortie - -Après qu'un webhook a traité une requête, vous pouvez référencer ses données : - -```yaml -# In subsequent blocks -process-webhook: - inputs: - payload: # Request payload - headers: # Request headers - method: # HTTP method -``` - -## Bonnes pratiques de sécurité - -- Utilisez toujours des secrets de webhook pour la vérification -- Validez les en-têtes et méthodes attendus -- Implémentez une gestion d'erreurs appropriée -- Utilisez des points de terminaison HTTPS en production -- Surveillez l'activité des webhooks et les échecs -- Définissez des délais d'attente de réponse appropriés -- Validez la structure de la charge utile avant le traitement \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/blocks/workflow.mdx b/apps/docs/content/docs/fr/yaml/blocks/workflow.mdx deleted file mode 100644 index a601acf79b..0000000000 --- a/apps/docs/content/docs/fr/yaml/blocks/workflow.mdx +++ /dev/null @@ -1,299 +0,0 @@ ---- -title: Schéma YAML des blocs de flux de travail -description: Référence de configuration YAML pour les blocs de flux de travail ---- - -## Définition du schéma - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [workflow] - description: Block type identifier - name: - type: string - description: Display name for this workflow block - inputs: - type: object - required: - - workflowId - properties: - workflowId: - type: string - description: ID of the workflow to execute - inputMapping: - type: object - description: Map current workflow data to sub-workflow inputs - additionalProperties: - type: string - description: Input value or reference to parent workflow data - environmentVariables: - type: object - description: Environment variables to pass to sub-workflow - additionalProperties: - type: string - description: Environment variable value - timeout: - type: number - description: Maximum execution time in milliseconds - default: 300000 - minimum: 1000 - maximum: 1800000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful workflow completion - error: - type: string - description: Target block ID for error handling -``` - -## Configuration des connexions - -Les connexions définissent où le flux de travail se dirige en fonction des résultats des sous-flux de travail : - -```yaml -connections: - success: # Target block ID for successful completion - error: # Target block ID for error handling (optional) -``` - -## Exemples - -### Exécution simple d'un flux de travail - -```yaml -data-processor: - type: workflow - name: "Data Processing Workflow" - inputs: - workflowId: "data-processing-v2" - inputMapping: - rawData: - userId: - environmentVariables: - PROCESSING_MODE: "production" - LOG_LEVEL: "info" - connections: - success: process-results - error: workflow-error-handler -``` - -### Pipeline de génération de contenu - -```yaml -content-generator: - type: workflow - name: "Content Generation Pipeline" - inputs: - workflowId: "content-generation-v3" - inputMapping: - topic: - style: - targetAudience: - brandGuidelines: - environmentVariables: - CONTENT_API_KEY: "{{CONTENT_API_KEY}}" - QUALITY_THRESHOLD: "high" - timeout: 120000 - connections: - success: review-content - error: content-generation-failed -``` - -### Flux de travail d'analyse en plusieurs étapes - -```yaml -analysis-workflow: - type: workflow - name: "Analysis Workflow" - inputs: - workflowId: "comprehensive-analysis" - inputMapping: - document: - analysisType: "comprehensive" - includeMetrics: true - outputFormat: "structured" - environmentVariables: - ANALYSIS_MODEL: "gpt-4o" - OPENAI_API_KEY: "{{OPENAI_API_KEY}}" - CLAUDE_API_KEY: "{{CLAUDE_API_KEY}}" - connections: - success: compile-analysis-report - error: analysis-workflow-error -``` - -### Exécution conditionnelle de flux de travail - -```yaml -customer-workflow-router: - type: condition - name: "Customer Workflow Router" - inputs: - conditions: - if: === "enterprise" - else-if: === "premium" - else: true - connections: - conditions: - if: enterprise-workflow - else-if: premium-workflow - else: standard-workflow - -enterprise-workflow: - type: workflow - name: "Enterprise Customer Workflow" - inputs: - workflowId: "enterprise-customer-processing" - inputMapping: - customerData: - accountManager: - tier: "enterprise" - environmentVariables: - PRIORITY_LEVEL: "high" - SLA_REQUIREMENTS: "strict" - connections: - success: enterprise-complete - -premium-workflow: - type: workflow - name: "Premium Customer Workflow" - inputs: - workflowId: "premium-customer-processing" - inputMapping: - customerData: - supportLevel: "premium" - environmentVariables: - PRIORITY_LEVEL: "medium" - connections: - success: premium-complete - -standard-workflow: - type: workflow - name: "Standard Customer Workflow" - inputs: - workflowId: "standard-customer-processing" - inputMapping: - customerData: - environmentVariables: - PRIORITY_LEVEL: "standard" - connections: - success: standard-complete -``` - -### Exécution parallèle de flux de travail - -```yaml -parallel-workflows: - type: parallel - name: "Parallel Workflow Processing" - inputs: - parallelType: collection - collection: | - [ - {"workflowId": "sentiment-analysis", "focus": "sentiment"}, - {"workflowId": "topic-extraction", "focus": "topics"}, - {"workflowId": "entity-recognition", "focus": "entities"} - ] - connections: - success: merge-workflow-results - -execute-analysis-workflow: - type: workflow - name: "Execute Analysis Workflow" - parentId: parallel-workflows - inputs: - workflowId: - inputMapping: - content: - analysisType: - environmentVariables: - ANALYSIS_API_KEY: "{{ANALYSIS_API_KEY}}" - connections: - success: workflow-complete -``` - -### Flux de travail de gestion d'erreurs - -```yaml -main-workflow: - type: workflow - name: "Main Processing Workflow" - inputs: - workflowId: "main-processing-v1" - inputMapping: - data: - timeout: 180000 - connections: - success: main-complete - error: error-recovery-workflow - -error-recovery-workflow: - type: workflow - name: "Error Recovery Workflow" - inputs: - workflowId: "error-recovery-v1" - inputMapping: - originalInput: - errorDetails: - failureTimestamp: "{{new Date().toISOString()}}" - environmentVariables: - RECOVERY_MODE: "automatic" - FALLBACK_ENABLED: "true" - connections: - success: recovery-complete - error: manual-intervention-required -``` - -## Mappage des entrées - -Mappez les données du flux de travail parent vers le sous-flux de travail : - -```yaml -inputMapping: - # Static values - mode: "production" - version: "1.0" - - # References to parent workflow data - userData: - settings: - - # Complex object mapping - requestData: - id: - timestamp: "{{new Date().toISOString()}}" - source: "parent-workflow" -``` - -## Références des sorties - -Une fois qu'un bloc de flux de travail est terminé, vous pouvez référencer ses sorties : - -```yaml -# In subsequent blocks -next-block: - inputs: - workflowResult: # Sub-workflow output - executionTime: # Execution duration - status: # Execution status -``` - -## Bonnes pratiques - -- Utilisez des identifiants de workflow descriptifs pour plus de clarté -- Ne mappez que les données nécessaires aux sous-workflows -- Définissez des délais d'expiration appropriés selon la complexité du workflow -- Incluez une gestion des erreurs pour une exécution robuste -- Transmettez les variables d'environnement de manière sécurisée -- Testez d'abord les sous-workflows indépendamment -- Surveillez les performances des workflows imbriqués -- Utilisez des identifiants de workflow versionnés pour la stabilité \ No newline at end of file diff --git a/apps/docs/content/docs/fr/yaml/examples.mdx b/apps/docs/content/docs/fr/yaml/examples.mdx deleted file mode 100644 index 441ccc2ad6..0000000000 --- a/apps/docs/content/docs/fr/yaml/examples.mdx +++ /dev/null @@ -1,273 +0,0 @@ ---- -title: Exemples de flux de travail YAML -description: Exemples de flux de travail YAML complets ---- - -import { Tab, Tabs } from 'fumadocs-ui/components/tabs' - -## Flux de travail en chaîne multi-agents - -Un flux de travail où plusieurs agents IA traitent l'information séquentiellement : - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: agent-1-initiator - - agent-1-initiator: - type: agent - name: Agent 1 Initiator - inputs: - systemPrompt: You are the first agent in a chain. Your role is to analyze the input and create an initial response that will be passed to the next agent. - userPrompt: |- - Welcome! I'm the first agent in our chain. - - Input to process: - - Please create an initial analysis or greeting that the next agent can build upon. Be creative and set a positive tone for the chain! - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-2-enhancer - - agent-2-enhancer: - type: agent - name: Agent 2 Enhancer - inputs: - systemPrompt: You are the second agent in a chain. Take the output from Agent 1 and enhance it with additional insights or improvements. - userPrompt: |- - I'm the second agent! Here's what Agent 1 provided: - - - - Now I'll enhance this with additional details, insights, or improvements. Let me build upon their work! - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-3-refiner - - agent-3-refiner: - type: agent - name: Agent 3 Refiner - inputs: - systemPrompt: You are the third agent in a chain. Take the enhanced output from Agent 2 and refine it further, adding structure or organization. - userPrompt: |- - I'm the third agent in our chain! Here's the enhanced work from Agent 2: - - - - My job is to refine and organize this content. I'll add structure, clarity, and polish to make it even better! - model: gpt-4o - temperature: 0.6 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-4-finalizer - - agent-4-finalizer: - type: agent - name: Agent 4 Finalizer - inputs: - systemPrompt: You are the final agent in a chain of 4. Create a comprehensive summary and conclusion based on all the previous agents' work. - userPrompt: |- - I'm the final agent! Here's the refined work from Agent 3: - - - - As the last agent in our chain, I'll create a final, polished summary that brings together all the work from our team of 4 agents. Let me conclude this beautifully! - model: gpt-4o - temperature: 0.5 - apiKey: '{{OPENAI_API_KEY}}' -``` - -## Flux de travail conditionnel basé sur un routeur - -Un flux de travail qui utilise une logique de routage pour envoyer des données à différents agents selon les conditions : - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: router-1 - - router-1: - type: router - name: Router 1 - inputs: - prompt: go to agent 1 if is greater than 5. else agent 2 if greater than 10. else agent 3 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - agent-1 - - agent-2 - - agent-3 - - agent-1: - type: agent - name: Agent 1 - inputs: - systemPrompt: say 1 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - - agent-2: - type: agent - name: Agent 2 - inputs: - systemPrompt: say 2 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - - agent-3: - type: agent - name: Agent 3 - inputs: - systemPrompt: say 3 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## Recherche web avec sortie structurée - -Un flux de travail qui effectue des recherches sur le web à l'aide d'outils et renvoie des données structurées : - -```yaml -version: '1.0' -blocks: - 59eb07c1-1411-4b28-a274-fa78f55daf72: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: d77c2c98-56c4-432d-9338-9bac54a2d42f - d77c2c98-56c4-432d-9338-9bac54a2d42f: - type: agent - name: Agent 1 - inputs: - systemPrompt: look up the user input. use structured output - userPrompt: - model: claude-sonnet-4-0 - apiKey: '{{ANTHROPIC_API_KEY}}' - tools: - - type: exa - title: Exa - params: - type: auto - apiKey: '{{EXA_API_KEY}}' - numResults: '' - toolId: exa_search - operation: exa_search - isExpanded: true - usageControl: auto - responseFormat: |- - { - "name": "output_schema", - "description": "Defines the structure for an output object.", - "strict": true, - "schema": { - "type": "object", - "properties": { - "output": { - "type": "string", - "description": "The output value" - } - }, - "additionalProperties": false, - "required": ["output"] - } - } -``` - -## Traitement en boucle avec collection - -Un flux de travail qui traite chaque élément d'une collection à l'aide d'une boucle : - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: food-analysis-loop - food-analysis-loop: - type: loop - name: Food Analysis Loop - inputs: - count: 5 - loopType: forEach - collection: '["apple", "banana", "carrot"]' - connections: - loop: - start: calorie-agent - calorie-agent: - type: agent - name: Calorie Analyzer - inputs: - systemPrompt: Return the number of calories in the food - userPrompt: - model: claude-sonnet-4-0 - apiKey: '{{ANTHROPIC_API_KEY}}' - parentId: food-analysis-loop -``` - -## Classification et réponse aux e-mails - -Un flux de travail qui classe les e-mails et génère des réponses appropriées : - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: email-classifier - - email-classifier: - type: agent - name: Email Classifier - inputs: - systemPrompt: Classify emails into categories and extract key information. - userPrompt: | - Classify this email: - - Categories: support, billing, sales, feedback - Extract: urgency level, customer sentiment, main request - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: response-generator - - response-generator: - type: agent - name: Response Generator - inputs: - systemPrompt: Generate appropriate responses based on email classification. - userPrompt: | - Email classification: - Original email: - - Generate a professional, helpful response addressing the customer's needs. - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' -``` diff --git a/apps/docs/content/docs/fr/yaml/index.mdx b/apps/docs/content/docs/fr/yaml/index.mdx deleted file mode 100644 index 5712ff2be2..0000000000 --- a/apps/docs/content/docs/fr/yaml/index.mdx +++ /dev/null @@ -1,159 +0,0 @@ ---- -title: Référence du flux de travail YAML -description: Guide complet pour écrire des flux de travail YAML dans Sim ---- - -import { Card, Cards } from "fumadocs-ui/components/card"; -import { Step, Steps } from "fumadocs-ui/components/steps"; -import { Tab, Tabs } from "fumadocs-ui/components/tabs"; - -Les flux de travail YAML offrent un moyen puissant de définir, versionner et partager des configurations de flux de travail dans Sim. Ce guide de référence couvre la syntaxe YAML complète, les schémas de blocs et les meilleures pratiques pour créer des flux de travail robustes. - -## Démarrage rapide - -Chaque flux de travail Sim suit cette structure de base : - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: agent-1 - - agent-1: - type: agent - name: "AI Assistant" - inputs: - systemPrompt: "You are a helpful assistant." - userPrompt: 'Hi' - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## Concepts fondamentaux - - - - Déclaration de version : Doit être exactement `version: '1.0'` (avec guillemets) - - - Structure des blocs : Tous les blocs de flux de travail sont définis sous la clé `blocks` - - - Références de bloc : Utilisez les noms de blocs en minuscules sans espaces (par ex., ``) - - - Variables d'environnement : Référencez avec des doubles accolades `{{VARIABLE_NAME}}` - - - -## Types de blocs - -Sim prend en charge plusieurs types de blocs principaux, chacun avec des schémas YAML spécifiques : - - - - Point d'entrée du flux de travail avec prise en charge des déclencheurs manuels, webhooks et planifiés - - - Traitement alimenté par l'IA avec prise en charge d'outils et de sorties structurées - - - Exécution de code JavaScript/TypeScript personnalisé - - - Requêtes HTTP vers des services externes - - - Branchement conditionnel basé sur des expressions booléennes - - - Routage intelligent alimenté par l'IA vers plusieurs chemins - - - Traitement itératif avec des boucles for et forEach - - - Exécution simultanée sur plusieurs instances - - - Déclencheurs webhook pour les intégrations externes - - - Validation des sorties selon des critères et métriques définis - - - Exécution d'autres flux de travail comme composants réutilisables - - - Formatage de sortie finale du flux de travail - - - -## Syntaxe de référence des blocs - -L'aspect le plus critique des workflows YAML est de comprendre comment référencer les données entre les blocs : - -### Règles de base - -1. **Utilisez le nom du bloc** (pas l'ID du bloc) converti en minuscules avec les espaces supprimés -2. **Ajoutez la propriété appropriée** (.content pour les agents, .output pour les outils) -3. **Lors de l'utilisation du chat, référencez le bloc de départ** comme `` - -### Exemples - -```yaml -# Block definitions -email-processor: - type: agent - name: "Email Agent" - # ... configuration - -data-formatter: - type: function - name: "Data Agent" - # ... configuration - -# Referencing their outputs -next-block: - type: agent - name: "Next Step" - inputs: - userPrompt: | - Process this email: - Use this formatted data: - Original input: -``` - -### Cas particuliers - -- **Variables de boucle** : ``, ``, `` -- **Variables parallèles** : ``, `` - -## Variables d'environnement - -Utilisez des variables d'environnement pour les données sensibles comme les clés API : - -```yaml -inputs: - apiKey: '{{OPENAI_API_KEY}}' - database: '{{DATABASE_URL}}' - token: '{{SLACK_BOT_TOKEN}}' -``` - -## Bonnes pratiques - -- **Gardez les noms de blocs lisibles** : « Email Processor » pour l'affichage dans l'interface -- **Référencez les variables d'environnement** : ne codez jamais en dur les clés API -- **Structurez pour la lisibilité** : regroupez logiquement les blocs liés -- **Testez progressivement** : construisez les workflows étape par étape - -## Prochaines étapes - -- [Syntaxe de référence des blocs](/yaml/block-reference) - Règles de référence détaillées -- [Schémas complets des blocs](/yaml/blocks) - Tous les types de blocs disponibles -- [Exemples de workflow](/yaml/examples) - Modèles de workflow réels \ No newline at end of file diff --git a/apps/docs/content/docs/ja/blocks/guardrails.mdx b/apps/docs/content/docs/ja/blocks/guardrails.mdx new file mode 100644 index 0000000000..f2d6a95f8f --- /dev/null +++ b/apps/docs/content/docs/ja/blocks/guardrails.mdx @@ -0,0 +1,251 @@ +--- +title: Guardrails +--- + +import { Callout } from 'fumadocs-ui/components/callout' +import { Step, Steps } from 'fumadocs-ui/components/steps' +import { Tab, Tabs } from 'fumadocs-ui/components/tabs' +import { Image } from '@/components/ui/image' +import { Video } from '@/components/ui/video' + +The Guardrails block validates and protects your AI workflows by checking content against multiple validation types. Ensure data quality, prevent hallucinations, detect PII, and enforce format requirements before content moves through your workflow. + +
+ Guardrails Block +
+ +## Overview + +The Guardrails block enables you to: + + + + Validate JSON Structure: Ensure LLM outputs are valid JSON before parsing + + + Match Regex Patterns: Verify content matches specific formats (emails, phone numbers, URLs, etc.) + + + Detect Hallucinations: Use RAG + LLM scoring to validate AI outputs against knowledge base content + + + Detect PII: Identify and optionally mask personally identifiable information across 40+ entity types + + + +## Validation Types + +### JSON Validation + +Validates that content is properly formatted JSON. Perfect for ensuring structured LLM outputs can be safely parsed. + +**Use Cases:** +- Validate JSON responses from Agent blocks before parsing +- Ensure API payloads are properly formatted +- Check structured data integrity + +**Output:** +- `passed`: `true` if valid JSON, `false` otherwise +- `error`: Error message if validation fails (e.g., "Invalid JSON: Unexpected token...") + +### Regex Validation + +Checks if content matches a specified regular expression pattern. + +**Use Cases:** +- Validate email addresses +- Check phone number formats +- Verify URLs or custom identifiers +- Enforce specific text patterns + +**Configuration:** +- **Regex Pattern**: The regular expression to match against (e.g., `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` for emails) + +**Output:** +- `passed`: `true` if content matches pattern, `false` otherwise +- `error`: Error message if validation fails + +### Hallucination Detection + +Uses Retrieval-Augmented Generation (RAG) with LLM scoring to detect when AI-generated content contradicts or isn't grounded in your knowledge base. + +**How It Works:** +1. Queries your knowledge base for relevant context +2. Sends both the AI output and retrieved context to an LLM +3. LLM assigns a confidence score (0-10 scale) + - **0** = Full hallucination (completely ungrounded) + - **10** = Fully grounded (completely supported by knowledge base) +4. Validation passes if score ≥ threshold (default: 3) + +**Configuration:** +- **Knowledge Base**: Select from your existing knowledge bases +- **Model**: Choose LLM for scoring (requires strong reasoning - GPT-4o, Claude 3.7 Sonnet recommended) +- **API Key**: Authentication for selected LLM provider (auto-hidden for hosted/Ollama models) +- **Confidence Threshold**: Minimum score to pass (0-10, default: 3) +- **Top K** (Advanced): Number of knowledge base chunks to retrieve (default: 10) + +**Output:** +- `passed`: `true` if confidence score ≥ threshold +- `score`: Confidence score (0-10) +- `reasoning`: LLM's explanation for the score +- `error`: Error message if validation fails + +**Use Cases:** +- Validate Agent responses against documentation +- Ensure customer support answers are factually accurate +- Verify generated content matches source material +- Quality control for RAG applications + +### PII Detection + +Detects personally identifiable information using Microsoft Presidio. Supports 40+ entity types across multiple countries and languages. + +
+
+ +**How It Works:** +1. Scans content for PII entities using pattern matching and NLP +2. Returns detected entities with locations and confidence scores +3. Optionally masks detected PII in the output + +**Configuration:** +- **PII Types to Detect**: Select from grouped categories via modal selector + - **Common**: Person name, Email, Phone, Credit card, IP address, etc. + - **USA**: SSN, Driver's license, Passport, etc. + - **UK**: NHS number, National insurance number + - **Spain**: NIF, NIE, CIF + - **Italy**: Fiscal code, Driver's license, VAT code + - **Poland**: PESEL, NIP, REGON + - **Singapore**: NRIC/FIN, UEN + - **Australia**: ABN, ACN, TFN, Medicare + - **India**: Aadhaar, PAN, Passport, Voter number +- **Mode**: + - **Detect**: Only identify PII (default) + - **Mask**: Replace detected PII with masked values +- **Language**: Detection language (default: English) + +**Output:** +- `passed`: `false` if any selected PII types are detected +- `detectedEntities`: Array of detected PII with type, location, and confidence +- `maskedText`: Content with PII masked (only if mode = "Mask") +- `error`: Error message if validation fails + +**Use Cases:** +- Block content containing sensitive personal information +- Mask PII before logging or storing data +- Compliance with GDPR, HIPAA, and other privacy regulations +- Sanitize user inputs before processing + +## Configuration + +### Content to Validate + +The input content to validate. This typically comes from: +- Agent block outputs: `` +- Function block results: `` +- API responses: `` +- Any other block output + +### Validation Type + +Choose from four validation types: +- **Valid JSON**: Check if content is properly formatted JSON +- **Regex Match**: Verify content matches a regex pattern +- **Hallucination Check**: Validate against knowledge base with LLM scoring +- **PII Detection**: Detect and optionally mask personally identifiable information + +## Outputs + +All validation types return: + +- **``**: Boolean indicating if validation passed +- **``**: The type of validation performed +- **``**: The original input that was validated +- **``**: Error message if validation failed (optional) + +Additional outputs by type: + +**Hallucination Check:** +- **``**: Confidence score (0-10) +- **``**: LLM's explanation + +**PII Detection:** +- **``**: Array of detected PII entities +- **``**: Content with PII masked (if mode = "Mask") + +## Example Use Cases + +### Validate JSON Before Parsing + +
+

Scenario: Ensure Agent output is valid JSON

+
    +
  1. Agent generates structured JSON response
  2. +
  3. Guardrails validates JSON format
  4. +
  5. Condition block checks ``
  6. +
  7. If passed → Parse and use data, If failed → Retry or handle error
  8. +
+
+ +### Prevent Hallucinations + +
+

Scenario: Validate customer support responses

+
    +
  1. Agent generates response to customer question
  2. +
  3. Guardrails checks against support documentation knowledge base
  4. +
  5. If confidence score ≥ 3 → Send response
  6. +
  7. If confidence score \< 3 → Flag for human review
  8. +
+
+ +### Block PII in User Inputs + +
+

Scenario: Sanitize user-submitted content

+
    +
  1. User submits form with text content
  2. +
  3. Guardrails detects PII (emails, phone numbers, SSN, etc.)
  4. +
  5. If PII detected → Reject submission or mask sensitive data
  6. +
  7. If no PII → Process normally
  8. +
+
+ +
+
+ +### Validate Email Format + +
+

Scenario: Check email address format

+
    +
  1. Agent extracts email from text
  2. +
  3. Guardrails validates with regex pattern
  4. +
  5. If valid → Use email for notification
  6. +
  7. If invalid → Request correction
  8. +
+
+ +## Best Practices + +- **Chain with Condition blocks**: Use `` to branch workflow logic based on validation results +- **Use JSON validation before parsing**: Always validate JSON structure before attempting to parse LLM outputs +- **Choose appropriate PII types**: Only select the PII entity types relevant to your use case for better performance +- **Set reasonable confidence thresholds**: For hallucination detection, adjust threshold based on your accuracy requirements (higher = stricter) +- **Use strong models for hallucination detection**: GPT-4o or Claude 3.7 Sonnet provide more accurate confidence scoring +- **Mask PII for logging**: Use "Mask" mode when you need to log or store content that may contain PII +- **Test regex patterns**: Validate your regex patterns thoroughly before deploying to production +- **Monitor validation failures**: Track `` messages to identify common validation issues + + + Guardrails validation happens synchronously in your workflow. For hallucination detection, choose faster models (like GPT-4o-mini) if latency is critical. + + diff --git a/apps/docs/content/docs/ja/execution/costs.mdx b/apps/docs/content/docs/ja/execution/costs.mdx index 6f83172d2b..22bd76133b 100644 --- a/apps/docs/content/docs/ja/execution/costs.mdx +++ b/apps/docs/content/docs/ja/execution/costs.mdx @@ -183,4 +183,39 @@ curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" htt - [設定 → サブスクリプション](https://sim.ai/settings/subscription)で現在の使用状況を確認する - 実行詳細を追跡するための[ロギング](/execution/logging)について学ぶ - プログラムによるコスト監視のための[外部API](/execution/api)を探索する -- コスト削減のための[ワークフロー最適化テクニック](/blocks)をチェックする \ No newline at end of file +- コスト削減のための[ワークフロー最適化テクニック](/blocks)をチェックする + +**チームプラン($40/シート/月):** +- チームメンバー全体でのプール使用量 +- 超過料金はチーム全体の使用量から計算 +- 組織のオーナーが一括で請求書を受け取る + +**エンタープライズプラン:** +- 固定月額料金、超過料金なし +- 契約に基づくカスタム使用制限 + +### 閾値請求 + +未請求の超過料金が$50に達すると、Simは自動的に未請求の全額を請求します。 + +**例:** +- 10日目:$70の超過料金 → 即時に$70を請求 +- 15日目:追加$35の使用(合計$105) → すでに請求済み、アクションなし +- 20日目:さらに$50の使用(合計$155、未請求$85) → 即時に$85を請求 + +これにより、期間終了時に一度に大きな請求が発生する代わりに、月を通じて大きな超過料金が分散されます。 + +## コスト管理のベストプラクティス + +1. **定期的な監視**:予想外の事態を避けるため、使用量ダッシュボードを頻繁にチェック +2. **予算設定**:プランの制限を支出のガードレールとして使用 +3. **ワークフローの最適化**:高コストの実行を見直し、プロンプトやモデル選択を最適化 +4. **適切なモデルの使用**:タスク要件にモデルの複雑さを合わせる +5. **類似タスクのバッチ処理**:オーバーヘッドを減らすために可能な場合は複数のリクエストを組み合わせる + +## 次のステップ + +- [設定 → サブスクリプション](https://sim.ai/settings/subscription)で現在の使用状況を確認 +- 実行詳細を追跡するための[ロギング](/execution/logging)について学ぶ +- プログラムによるコスト監視のための[外部API](/execution/api)を探索 +- コスト削減のための[ワークフロー最適化テクニック](/blocks)をチェック \ No newline at end of file diff --git a/apps/docs/content/docs/ja/sdks/typescript.mdx b/apps/docs/content/docs/ja/sdks/typescript.mdx index 785f60b29d..06798a1a35 100644 --- a/apps/docs/content/docs/ja/sdks/typescript.mdx +++ b/apps/docs/content/docs/ja/sdks/typescript.mdx @@ -957,34 +957,6 @@ function StreamingWorkflow() { - Node.js 16+ - TypeScript 5.0+ (for TypeScript projects) -## TypeScript Support - -The SDK is written in TypeScript and provides full type safety: - -```typescript -import { - SimStudioClient, - WorkflowExecutionResult, - WorkflowStatus, - SimStudioError -} from 'simstudio-ts-sdk'; - -// Type-safe client initialization -const client: SimStudioClient = new SimStudioClient({ - apiKey: process.env.SIM_API_KEY! -}); - -// Type-safe workflow execution -const result: WorkflowExecutionResult = await client.executeWorkflow('workflow-id', { - input: { - message: 'Hello, TypeScript!' - } -}); - -// Type-safe status checking -const status: WorkflowStatus = await client.getWorkflowStatus('workflow-id'); -``` - ## License diff --git a/apps/docs/content/docs/ja/tools/clay.mdx b/apps/docs/content/docs/ja/tools/clay.mdx new file mode 100644 index 0000000000..def872aa52 --- /dev/null +++ b/apps/docs/content/docs/ja/tools/clay.mdx @@ -0,0 +1,226 @@ +--- +title: Clay +description: Populate Clay workbook +--- + +import { BlockInfoCard } from "@/components/ui/block-info-card" + + + + + + `} +/> + +{/* MANUAL-CONTENT-START:intro */} +[Clay](https://www.clay.com/) is a data enrichment and workflow automation platform that helps teams streamline lead generation, research, and data operations through powerful integrations and flexible inputs. + +Learn how to use the Clay Tool in Sim to seamlessly insert data into a Clay workbook through webhook triggers. This tutorial walks you through setting up a webhook, configuring data mapping, and automating real-time updates to your Clay workbooks. Perfect for streamlining lead generation and data enrichment directly from your workflow! + + + +With Clay, you can: + +- **Enrich agent outputs**: Automatically feed your Sim agent data into Clay tables for structured tracking and analysis +- **Trigger workflows via webhooks**: Use Clay’s webhook support to initiate Sim agent tasks from within Clay +- **Leverage data loops**: Seamlessly iterate over enriched data rows with agents that operate across dynamic datasets + +In Sim, the Clay integration allows your agents to push structured data into Clay tables via webhooks. This makes it easy to collect, enrich, and manage dynamic outputs such as leads, research summaries, or action items—all in a collaborative, spreadsheet-like interface. Your agents can populate rows in real time, enabling asynchronous workflows where AI-generated insights are captured, reviewed, and used by your team. Whether you're automating research, enriching CRM data, or tracking operational outcomes, Clay becomes a living data layer that interacts intelligently with your agents. By connecting Sim with Clay, you gain a powerful way to operationalize agent results, loop over datasets with precision, and maintain a clean, auditable record of AI-driven work. +{/* MANUAL-CONTENT-END */} + +## Usage Instructions + +Integrate Clay into the workflow. Can populate a table with data. + +## Tools + +### `clay_populate` + +Populate Clay with data from a JSON file. Enables direct communication and notifications with timestamp tracking and channel confirmation. + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `webhookURL` | string | Yes | The webhook URL to populate | +| `data` | json | Yes | The data to populate | +| `authToken` | string | Yes | Auth token for Clay webhook authentication | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `success` | boolean | Operation success status | +| `output` | json | Clay populate operation results including response data from Clay webhook | + +## Notes + +- Category: `tools` +- Type: `clay` diff --git a/apps/docs/content/docs/ja/tools/huggingface.mdx b/apps/docs/content/docs/ja/tools/huggingface.mdx new file mode 100644 index 0000000000..ec1558de05 --- /dev/null +++ b/apps/docs/content/docs/ja/tools/huggingface.mdx @@ -0,0 +1,98 @@ +--- +title: Hugging Face +description: Use Hugging Face Inference API +--- + +import { BlockInfoCard } from "@/components/ui/block-info-card" + + + + + + + + + `} +/> + +{/* MANUAL-CONTENT-START:intro */} +[HuggingFace](https://huggingface.co/) is a leading AI platform that provides access to thousands of pre-trained machine learning models and powerful inference capabilities. With its extensive model hub and robust API, HuggingFace offers comprehensive tools for both research and production AI applications. +With HuggingFace, you can: + +Access pre-trained models: Utilize models for text generation, translation, image processing, and more +Generate AI completions: Create content using state-of-the-art language models through the Inference API +Natural language processing: Process and analyze text with specialized NLP models +Deploy at scale: Host and serve models for production applications +Customize models: Fine-tune existing models for specific use cases + +In Sim, the HuggingFace integration enables your agents to programmatically generate completions using the HuggingFace Inference API. This allows for powerful automation scenarios such as content generation, text analysis, code completion, and creative writing. Your agents can generate completions with natural language prompts, access specialized models for different tasks, and integrate AI-generated content into workflows. This integration bridges the gap between your AI workflows and machine learning capabilities, enabling seamless AI-powered automation with one of the world's most comprehensive ML platforms. +{/* MANUAL-CONTENT-END */} + +## Usage Instructions + +Integrate Hugging Face into the workflow. Can generate completions using the Hugging Face Inference API. + +## Tools + +### `huggingface_chat` + +Generate completions using Hugging Face Inference API + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `systemPrompt` | string | No | System prompt to guide the model behavior | +| `content` | string | Yes | The user message content to send to the model | +| `provider` | string | Yes | The provider to use for the API request \(e.g., novita, cerebras, etc.\) | +| `model` | string | Yes | Model to use for chat completions \(e.g., deepseek/deepseek-v3-0324\) | +| `maxTokens` | number | No | Maximum number of tokens to generate | +| `temperature` | number | No | Sampling temperature \(0-2\). Higher values make output more random | +| `apiKey` | string | Yes | Hugging Face API token | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `success` | boolean | Operation success status | +| `output` | object | Chat completion results | + +## Notes + +- Category: `tools` +- Type: `huggingface` diff --git a/apps/docs/content/docs/ja/tools/knowledge.mdx b/apps/docs/content/docs/ja/tools/knowledge.mdx index fa3ae24c32..b784fb13cc 100644 --- a/apps/docs/content/docs/ja/tools/knowledge.mdx +++ b/apps/docs/content/docs/ja/tools/knowledge.mdx @@ -60,10 +60,10 @@ Simでは、ナレッジベースブロックによってエージェントが | パラメータ | 型 | 必須 | 説明 | | --------- | ---- | -------- | ----------- | -| `knowledgeBaseId` | string | はい | 検索対象のナレッジベースID | -| `query` | string | いいえ | 検索クエリテキスト(タグフィルターを使用する場合はオプション) | +| `knowledgeBaseId` | string | はい | 検索対象のナレッジベースのID | +| `query` | string | いいえ | 検索クエリテキスト(タグフィルターを使用する場合は省略可能) | | `topK` | number | いいえ | 返す最も類似した結果の数(1-100) | -| `tagFilters` | any | いいえ | tagNameとtagValueプロパティを持つタグフィルターの配列 | +| `tagFilters` | array | いいえ | tagNameとtagValueプロパティを持つタグフィルターの配列 | #### 出力 diff --git a/apps/docs/content/docs/ja/tools/stagehand.mdx b/apps/docs/content/docs/ja/tools/stagehand.mdx new file mode 100644 index 0000000000..07684b3069 --- /dev/null +++ b/apps/docs/content/docs/ja/tools/stagehand.mdx @@ -0,0 +1,219 @@ +--- +title: Stagehand Extract +description: Extract data from websites +--- + +import { BlockInfoCard } from "@/components/ui/block-info-card" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `} +/> + +{/* MANUAL-CONTENT-START:intro */} +[Stagehand](https://stagehand.com) is a tool that allows you to extract structured data from webpages using Browserbase and OpenAI. + +With Stagehand, you can: + +- **Extract structured data**: Extract structured data from webpages using Browserbase and OpenAI +- **Save data to a database**: Save the extracted data to a database +- **Automate workflows**: Automate workflows to extract data from webpages + +In Sim, the Stagehand integration enables your agents to extract structured data from webpages using Browserbase and OpenAI. This allows for powerful automation scenarios such as data extraction, data analysis, and data integration. Your agents can extract structured data from webpages, save the extracted data to a database, and automate workflows to extract data from webpages. This integration bridges the gap between your AI workflows and your data management system, enabling seamless data extraction and integration. By connecting Sim with Stagehand, you can automate data extraction processes, maintain up-to-date information repositories, generate reports, and organize information intelligently - all through your intelligent agents. +{/* MANUAL-CONTENT-END */} + +## Usage Instructions + +Integrate Stagehand into the workflow. Can extract structured data from webpages. + +## Tools + +### `stagehand_extract` + +Extract structured data from a webpage using Stagehand + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `url` | string | Yes | URL of the webpage to extract data from | +| `instruction` | string | Yes | Instructions for extraction | +| `apiKey` | string | Yes | OpenAI API key for extraction \(required by Stagehand\) | +| `schema` | json | Yes | JSON schema defining the structure of the data to extract | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `data` | object | Extracted structured data matching the provided schema | + +## Notes + +- Category: `tools` +- Type: `stagehand` diff --git a/apps/docs/content/docs/ja/tools/stagehand_agent.mdx b/apps/docs/content/docs/ja/tools/stagehand_agent.mdx new file mode 100644 index 0000000000..e5f659f819 --- /dev/null +++ b/apps/docs/content/docs/ja/tools/stagehand_agent.mdx @@ -0,0 +1,225 @@ +--- +title: Stagehand Agent +description: Autonomous web browsing agent +--- + +import { BlockInfoCard } from "@/components/ui/block-info-card" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `} +/> + +{/* MANUAL-CONTENT-START:intro */} +[Stagehand](https://www.stagehand.dev/) is an autonomous web agent platform that enables AI systems to navigate and interact with websites just like a human would. It provides a powerful solution for automating complex web tasks without requiring custom code or browser automation scripts. + +With Stagehand, you can: + +- **Automate web navigation**: Enable AI to browse websites, click links, fill forms, and interact with web elements +- **Extract structured data**: Collect specific information from websites in a structured, usable format +- **Complete complex workflows**: Perform multi-step tasks across different websites and web applications +- **Handle authentication**: Navigate login processes and maintain sessions across websites +- **Process dynamic content**: Interact with JavaScript-heavy sites and single-page applications +- **Maintain context awareness**: Keep track of the current state and history while navigating +- **Generate detailed reports**: Receive comprehensive logs of actions taken and data collected + +In Sim, the Stagehand integration enables your agents to seamlessly interact with web-based systems as part of their workflows. This allows for sophisticated automation scenarios that bridge the gap between your AI agents and the vast information and functionality available on the web. Your agents can search for information, interact with web applications, extract data from websites, and incorporate these capabilities into their decision-making processes. By connecting Sim with Stagehand, you can create agents that extend beyond API-based integrations to navigate the web just as a human would - filling forms, clicking buttons, reading content, and extracting valuable information to complete their tasks more effectively. +{/* MANUAL-CONTENT-END */} + +## Usage Instructions + +Integrate Stagehand Agent into the workflow. Can navigate the web and perform tasks. + +## Tools + +### `stagehand_agent` + +Run an autonomous web agent to complete tasks and extract structured data + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `startUrl` | string | Yes | URL of the webpage to start the agent on | +| `task` | string | Yes | The task to complete or goal to achieve on the website | +| `variables` | json | No | Optional variables to substitute in the task \(format: \{key: value\}\). Reference in task using %key% | +| `format` | string | No | No description | +| `apiKey` | string | Yes | OpenAI API key for agent execution \(required by Stagehand\) | +| `outputSchema` | json | No | Optional JSON schema defining the structure of data the agent should return | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `agentResult` | object | Result from the Stagehand agent execution | + +## Notes + +- Category: `tools` +- Type: `stagehand_agent` diff --git a/apps/docs/content/docs/ja/tools/supabase.mdx b/apps/docs/content/docs/ja/tools/supabase.mdx index 400503d5d6..12a5823f49 100644 --- a/apps/docs/content/docs/ja/tools/supabase.mdx +++ b/apps/docs/content/docs/ja/tools/supabase.mdx @@ -109,10 +109,10 @@ Supabaseテーブルにデータを挿入する | パラメータ | 型 | 必須 | 説明 | | --------- | ---- | -------- | ----------- | -| `projectId` | string | はい | SupabaseプロジェクトID(例:jdrkgepadsdopsntdlom) | +| `projectId` | string | はい | あなたのSupabaseプロジェクトID(例:jdrkgepadsdopsntdlom) | | `table` | string | はい | データを挿入するSupabaseテーブルの名前 | -| `data` | any | はい | 挿入するデータ | -| `apiKey` | string | はい | Supabaseサービスロールのシークレットキー | +| `data` | array | はい | 挿入するデータ(オブジェクトの配列または単一のオブジェクト) | +| `apiKey` | string | はい | あなたのSupabaseサービスロールシークレットキー | #### 出力 @@ -190,10 +190,10 @@ Supabaseテーブルにデータを挿入または更新する(アップサー | パラメータ | 型 | 必須 | 説明 | | --------- | ---- | -------- | ----------- | -| `projectId` | string | はい | SupabaseプロジェクトID(例:jdrkgepadsdopsntdlom) | +| `projectId` | string | はい | あなたのSupabaseプロジェクトID(例:jdrkgepadsdopsntdlom) | | `table` | string | はい | データをアップサートするSupabaseテーブルの名前 | -| `data` | any | はい | アップサート(挿入または更新)するデータ | -| `apiKey` | string | はい | Supabaseサービスロールのシークレットキー | +| `data` | array | はい | アップサート(挿入または更新)するデータ - オブジェクトの配列または単一のオブジェクト | +| `apiKey` | string | はい | あなたのSupabaseサービスロールシークレットキー | #### 出力 diff --git a/apps/docs/content/docs/ja/tools/telegram.mdx b/apps/docs/content/docs/ja/tools/telegram.mdx index 2fc267b8e6..8a48139d4a 100644 --- a/apps/docs/content/docs/ja/tools/telegram.mdx +++ b/apps/docs/content/docs/ja/tools/telegram.mdx @@ -86,12 +86,108 @@ Telegram Bot APIを通じてTelegramチャンネルまたはユーザーにメ | パラメータ | 型 | 説明 | | --------- | ---- | ----------- | -| `success` | boolean | Telegramメッセージ送信成功ステータス | -| `messageId` | number | 一意のTelegramメッセージ識別子 | -| `chatId` | string | メッセージが送信された対象チャットID | -| `text` | string | 送信されたメッセージのテキスト内容 | -| `timestamp` | number | メッセージが送信されたUnixタイムスタンプ | -| `from` | object | メッセージを送信したボットに関する情報 | +| `message` | string | 成功またはエラーメッセージ | +| `data` | object | Telegramメッセージデータ | + +## 注意事項 + +- カテゴリー: `tools` +- タイプ: `telegram` + +#### 入力 + +| パラメータ | 型 | 必須 | 説明 | +| --------- | ---- | -------- | ----------- | +| `botToken` | string | はい | あなたのTelegram Bot APIトークン | +| `chatId` | string | はい | 対象のTelegramチャットID | +| `messageId` | string | はい | 削除するメッセージID | + +#### 出力 + +| パラメータ | 型 | 説明 | +| --------- | ---- | ----------- | +| `message` | string | 成功またはエラーメッセージ | +| `data` | object | 削除操作の結果 | + +### `telegram_send_photo` + +Telegram Bot APIを通じてTelegramチャンネルまたはユーザーに写真を送信します。 + +#### 入力 + +| パラメータ | 型 | 必須 | 説明 | +| --------- | ---- | -------- | ----------- | +| `botToken` | string | はい | あなたのTelegram Bot APIトークン | +| `chatId` | string | はい | 対象のTelegramチャットID | +| `photo` | string | はい | 送信する写真。file_idまたはHTTP URLを指定 | +| `caption` | string | いいえ | 写真のキャプション(任意) | + +#### 出力 + +| パラメータ | 型 | 説明 | +| --------- | ---- | ----------- | +| `message` | string | 成功またはエラーメッセージ | +| `data` | object | 写真(任意)を含むTelegramメッセージデータ | + +### `telegram_send_video` + +Telegram Bot APIを通じてTelegramチャンネルまたはユーザーに動画を送信します。 + +#### 入力 + +| パラメータ | 型 | 必須 | 説明 | +| --------- | ---- | -------- | ----------- | +| `botToken` | string | はい | あなたのTelegram Bot APIトークン | +| `chatId` | string | はい | 対象のTelegramチャットID | +| `video` | string | はい | 送信する動画。file_idまたはHTTP URLを指定 | +| `caption` | string | いいえ | 動画のキャプション(任意) | + +#### 出力 + +| パラメータ | 型 | 説明 | +| --------- | ---- | ----------- | +| `message` | string | 成功またはエラーメッセージ | +| `data` | object | オプションのメディアを含むTelegramメッセージデータ | + +### `telegram_send_audio` + +Telegram Bot APIを通じてTelegramチャンネルまたはユーザーに音声ファイルを送信します。 + +#### 入力 + +| パラメータ | 型 | 必須 | 説明 | +| --------- | ---- | -------- | ----------- | +| `botToken` | string | はい | あなたのTelegram Bot APIトークン | +| `chatId` | string | はい | 対象のTelegramチャットID | +| `audio` | string | はい | 送信する音声ファイル。file_idまたはHTTP URLを渡してください | +| `caption` | string | いいえ | 音声のキャプション(オプション) | + +#### 出力 + +| パラメータ | 型 | 説明 | +| --------- | ---- | ----------- | +| `message` | string | 成功またはエラーメッセージ | +| `data` | object | 音声/オーディオ情報を含むTelegramメッセージデータ | + +### `telegram_send_animation` + +Telegram Bot APIを通じてTelegramチャンネルまたはユーザーにアニメーション(GIF)を送信します。 + +#### 入力 + +| パラメータ | 型 | 必須 | 説明 | +| --------- | ---- | -------- | ----------- | +| `botToken` | string | はい | あなたのTelegram Bot APIトークン | +| `chatId` | string | はい | 対象のTelegramチャットID | +| `animation` | string | はい | 送信するアニメーション。file_idまたはHTTP URLを渡してください | +| `caption` | string | いいえ | アニメーションのキャプション(オプション) | + +#### 出力 + +| パラメータ | 型 | 説明 | +| --------- | ---- | ----------- | +| `message` | string | 成功またはエラーメッセージ | +| `data` | object | オプションのメディアを含むTelegramメッセージデータ | ## 注意事項 diff --git a/apps/docs/content/docs/ja/tools/youtube.mdx b/apps/docs/content/docs/ja/tools/youtube.mdx index deed9bc357..16ebf06531 100644 --- a/apps/docs/content/docs/ja/tools/youtube.mdx +++ b/apps/docs/content/docs/ja/tools/youtube.mdx @@ -1,6 +1,6 @@ --- title: YouTube -description: YouTubeで動画を検索 +description: YouTubeの動画、チャンネル、プレイリストとやり取りする --- import { BlockInfoCard } from "@/components/ui/block-info-card" @@ -39,7 +39,7 @@ Simでは、YouTube統合によりエージェントがワークフローの一 ## 使用方法 -YouTubeをワークフローに統合します。動画を検索できます。APIキーが必要です。 +YouTubeをワークフローに統合します。動画の検索、動画の詳細取得、チャンネル情報の取得、プレイリスト項目の取得、動画コメントの取得が可能です。 ## ツール @@ -61,7 +61,100 @@ YouTube Data APIを使用してYouTubeで動画を検索します。 | --------- | ---- | ----------- | | `items` | array | 検索クエリに一致するYouTube動画の配列 | +### `youtube_video_details` + +特定のYouTube動画に関する詳細情報を取得します。 + +#### 入力 + +| パラメータ | 型 | 必須 | 説明 | +| --------- | ---- | -------- | ----------- | +| `videoId` | string | はい | YouTube動画ID | +| `apiKey` | string | はい | YouTube APIキー | + +#### 出力 + +| パラメータ | 型 | 説明 | +| --------- | ---- | ----------- | +| `videoId` | string | YouTube動画ID | +| `title` | string | 動画タイトル | +| `description` | string | 動画の説明 | +| `channelId` | string | チャンネルID | +| `channelTitle` | string | チャンネル名 | +| `publishedAt` | string | 公開日時 | +| `duration` | string | ISO 8601形式の動画の長さ | +| `viewCount` | number | 視聴回数 | +| `likeCount` | number | 高評価数 | +| `commentCount` | number | コメント数 | +| `thumbnail` | string | 動画サムネイルURL | +| `tags` | array | 動画タグ | + +### `youtube_channel_info` + +YouTubeチャンネルに関する詳細情報を取得します。 + +#### 入力 + +| パラメータ | 型 | 必須 | 説明 | +| --------- | ---- | -------- | ----------- | +| `channelId` | string | いいえ | YouTubeチャンネルID(channelIdまたはusernameのいずれかを使用) | +| `username` | string | いいえ | YouTubeチャンネルのユーザー名(channelIdまたはusernameのいずれかを使用) | +| `apiKey` | string | はい | YouTube APIキー | + +#### 出力 + +| パラメータ | 型 | 説明 | +| --------- | ---- | ----------- | +| `channelId` | string | YouTubeチャンネルID | +| `title` | string | チャンネル名 | +| `description` | string | チャンネルの説明 | +| `subscriberCount` | number | 登録者数 | +| `videoCount` | number | 動画数 | +| `viewCount` | number | チャンネル総再生回数 | +| `publishedAt` | string | チャンネル作成日 | +| `thumbnail` | string | チャンネルサムネイルURL | +| `customUrl` | string | チャンネルカスタムURL | + +### `youtube_playlist_items` + +YouTubeプレイリストから動画を取得します。 + +#### 入力 + +| パラメータ | 型 | 必須 | 説明 | +| --------- | ---- | -------- | ----------- | +| `playlistId` | string | はい | YouTubeプレイリストID | +| `maxResults` | number | いいえ | 返す動画の最大数 | +| `pageToken` | string | いいえ | ページネーション用のページトークン | +| `apiKey` | string | はい | YouTube APIキー | + +#### 出力 + +| パラメータ | 型 | 説明 | +| --------- | ---- | ----------- | +| `items` | array | プレイリスト内の動画の配列 | + +### `youtube_comments` + +YouTube動画からコメントを取得します。 + +#### 入力 + +| パラメータ | 型 | 必須 | 説明 | +| --------- | ---- | -------- | ----------- | +| `videoId` | string | はい | YouTube動画ID | +| `maxResults` | number | いいえ | 返すコメントの最大数 | +| `order` | string | いいえ | コメントの並び順:time(時間順)またはrelevance(関連性順) | +| `pageToken` | string | いいえ | ページネーション用のページトークン | +| `apiKey` | string | はい | YouTube APIキー | + +#### 出力 + +| パラメータ | 型 | 説明 | +| --------- | ---- | ----------- | +| `items` | array | 動画からのコメントの配列 | + ## 注意事項 -- カテゴリ: `tools` +- カテゴリー: `tools` - タイプ: `youtube` diff --git a/apps/docs/content/docs/ja/triggers/api.mdx b/apps/docs/content/docs/ja/triggers/api.mdx index 931d4da25f..56ab6a1397 100644 --- a/apps/docs/content/docs/ja/triggers/api.mdx +++ b/apps/docs/content/docs/ja/triggers/api.mdx @@ -128,3 +128,60 @@ data: {"blockId":"agent1-uuid","chunk":" complete"} ワークフローには1つのAPIトリガーのみ含めることができます。変更後は新しいデプロイメントを公開して、エンドポイントを最新の状態に保ってください。 + +### ファイルアップロードフォーマット + +APIは2つのフォーマットでファイルを受け付けます: + +**1. Base64エンコードされたファイル**(SDKでの使用推奨): + +```json +{ + "documents": [{ + "type": "file", + "data": "data:application/pdf;base64,JVBERi0xLjQK...", + "name": "document.pdf", + "mime": "application/pdf" + }] +} +``` + +- 最大ファイルサイズ:ファイルあたり20MB +- ファイルはクラウドストレージにアップロードされ、すべてのプロパティを持つUserFileオブジェクトに変換されます + +**2. 直接URLリファレンス**: + +```json +{ + "documents": [{ + "type": "url", + "data": "https://example.com/document.pdf", + "name": "document.pdf", + "mime": "application/pdf" + }] +} +``` + +- ファイルはアップロードされず、URLが直接渡されます +- 既存のファイルを参照する場合に便利です + +### ファイルプロパティ + +ファイルについては、すべてのプロパティにアクセスできます: + +| プロパティ | 説明 | 型 | +|----------|-------------|------| +| `` | 署名付きダウンロードURL | string | +| `` | 元のファイル名 | string | +| `` | ファイルサイズ(バイト) | number | +| `` | MIMEタイプ | string | +| `` | アップロードタイムスタンプ(ISO 8601) | string | +| `` | URL有効期限タイムスタンプ(ISO 8601) | string | + +URL参照ファイルの場合、ファイルは当社のストレージにアップロードされないため、`uploadedAt`と`expiresAt`を除く同じプロパティが利用可能です。 + +入力フォーマットが定義されていない場合、エグゼキューターは``でのみ生のJSONを公開します。 + + +ワークフローには1つのAPIトリガーしか含めることができません。変更後は新しいデプロイメントを公開して、エンドポイントを最新の状態に保ってください。 + diff --git a/apps/docs/content/docs/ja/triggers/chat.mdx b/apps/docs/content/docs/ja/triggers/chat.mdx index 8c9b6a4e45..1c6c5c2278 100644 --- a/apps/docs/content/docs/ja/triggers/chat.mdx +++ b/apps/docs/content/docs/ja/triggers/chat.mdx @@ -41,3 +41,11 @@ import { Image } from '@/components/ui/image' ビルダーは同じワークフロー内の複数のチャットトリガーブロックをブロックします。 + +1. ワークフローごとに1つのチャットトリガーブロックを追加します。 +2. チャットモードでワークフローをデプロイします。 +3. デプロイメントリンクを共有します—すべての返信は同じ会話IDを再利用するため、ワークフローはコンテキストを保持できます。 + + +ビルダーは同じワークフロー内に複数のチャットトリガーブロックを配置することを防止します。 + diff --git a/apps/docs/content/docs/ja/yaml/block-reference.mdx b/apps/docs/content/docs/ja/yaml/block-reference.mdx deleted file mode 100644 index 56ebdbb17b..0000000000 --- a/apps/docs/content/docs/ja/yaml/block-reference.mdx +++ /dev/null @@ -1,242 +0,0 @@ ---- -title: ブロック参照構文 -description: YAMLワークフローでブロック間のデータを参照する方法 ---- - -import { Callout } from 'fumadocs-ui/components/callout' -import { Tab, Tabs } from 'fumadocs-ui/components/tabs' - -ブロック参照はSimワークフローにおけるデータフローの基盤です。あるブロックの出力を別のブロックの入力として正しく参照する方法を理解することは、機能的なワークフローを構築するために不可欠です。 - -## 基本的な参照ルール - -### 1. ブロックIDではなくブロック名を使用する - - - - - ```yaml - # Block definition - email-sender: - type: agent - name: "Email Generator" - # ... configuration - - # Reference the block - next-block: - inputs: - userPrompt: "Process this: " - ``` - - - - - ```yaml - # Block definition - email-sender: - type: agent - name: "Email Generator" - # ... configuration - - # ❌ Don't reference by block ID - next-block: - inputs: - userPrompt: "Process this: " - ``` - - - - -### 2. 名前を参照形式に変換する - -ブロック参照を作成するには: - -1. **ブロック名を取得する**:「Email Generator」 -2. **小文字に変換する**:「email generator」 -3. **スペースと特殊文字を削除する**:「emailgenerator」 -4. **プロパティを追加する**:`` - -### 3. 正しいプロパティを使用する - -ブロックタイプによって異なるプロパティが公開されます: - -- **エージェントブロック**:`.content` (AI応答) -- **関数ブロック**:`.output` (戻り値) -- **APIブロック**:`.output` (レスポンスデータ) -- **ツールブロック**:`.output` (ツール結果) - -## 参照例 - -### 一般的なブロック参照 - -```yaml -# Agent block outputs - # Primary AI response - # Token usage information - # Estimated cost - # Tool execution details - -# Function block outputs - # Function return value - # Error information (if any) - -# API block outputs - # Response data - # HTTP status code - # Response headers - -# Tool block outputs - # Tool execution result -``` - -### 複数単語のブロック名 - -```yaml -# Block name: "Data Processor 2" - - -# Block name: "Email Validation Service" - - -# Block name: "Customer Info Agent" - -``` - -## 特殊な参照ケース - -### スタータブロック - - - スタータブロックは、実際の名前に関係なく、常に `` として参照されます。 - - -```yaml -# Starter block definition -my-custom-start: - type: starter - name: "Custom Workflow Start" - # ... configuration - -# Always reference as 'start' -agent-1: - inputs: - userPrompt: # ✅ Correct - # userPrompt: # ❌ Wrong -``` - -### ループ変数 - -ループブロック内では、特別な変数が利用できます: - -```yaml -# Available in loop child blocks - # Current iteration (0-based) - # Current item being processed (forEach loops) - # Full collection (forEach loops) -``` - -### 並列処理変数 - -並列ブロック内では、特別な変数が利用できます: - -```yaml -# Available in parallel child blocks - # Instance number (0-based) - # Item for this instance - # Full collection -``` - -## 複雑な参照例 - -### ネストされたデータアクセス - -複雑なオブジェクトを参照する場合は、ドット表記を使用します: - -```yaml -# If an agent returns structured data -data-analyzer: - type: agent - name: "Data Analyzer" - inputs: - responseFormat: | - { - "schema": { - "type": "object", - "properties": { - "analysis": {"type": "object"}, - "summary": {"type": "string"}, - "metrics": {"type": "object"} - } - } - } - -# Reference nested properties -next-step: - inputs: - userPrompt: | - Summary: - Score: - Full data: -``` - -### テキスト内の複数参照 - -```yaml -email-composer: - type: agent - inputs: - userPrompt: | - Create an email with the following information: - - Customer: - Order Details: - Support Ticket: - - Original request: -``` - -### コードブロック内の参照 - -関数ブロック内で参照を使用すると、JavaScript値として置き換えられます: - -```yaml -data-processor: - type: function - inputs: - code: | - // References are replaced with actual values - const customerData = ; - const orderInfo = ; - const originalInput = ; - - // Process the data - return { - customer: customerData.name, - orderId: orderInfo.id, - processed: true - }; -``` - -## 参照の検証 - -SimはYAMLをインポートする際にすべての参照を検証します: - -### 有効な参照 -- ブロックがワークフロー内に存在する -- プロパティがブロックタイプに適している -- 循環依存関係がない -- 適切な構文フォーマット - -### 一般的なエラー -- **ブロックが見つからない**:参照されたブロックが存在しない -- **プロパティの誤り**:関数ブロックで `.content` を使用 -- **タイプミス**:ブロック名やプロパティのスペルミス -- **循環参照**:ブロックが直接または間接的に自身を参照している - -## ベストプラクティス - -1. **説明的なブロック名を使用する**:参照をより読みやすくする -2. **一貫性を保つ**:同じ命名規則をすべてに適用する -3. **参照をチェックする**:参照されるすべてのブロックが存在することを確認する -4. **深いネストを避ける**:参照チェーンを管理しやすく保つ -5. **複雑なフローを文書化する**:参照関係を説明するコメントを追加する \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/blocks/agent.mdx b/apps/docs/content/docs/ja/yaml/blocks/agent.mdx deleted file mode 100644 index 89bfd17a94..0000000000 --- a/apps/docs/content/docs/ja/yaml/blocks/agent.mdx +++ /dev/null @@ -1,218 +0,0 @@ ---- -title: エージェントブロックYAMLスキーマ -description: エージェントブロックのYAML設定リファレンス ---- - -## スキーマ定義 - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [agent] - description: Block type identifier - name: - type: string - description: Display name for this agent block - inputs: - type: object - properties: - systemPrompt: - type: string - description: Instructions that define the agent's role and behavior - userPrompt: - type: string - description: Input content to process (can reference other blocks) - model: - type: string - description: AI model identifier (e.g., gpt-4o, gemini-2.5-pro, deepseek-chat) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Response creativity level (varies by model) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - memories: - type: string - description: Memory context from memory blocks - tools: - type: array - description: List of external tools the agent can use - items: - type: object - required: [type, title, toolId, operation, usageControl] - properties: - type: - type: string - description: Tool type identifier - title: - type: string - description: Human-readable display name - toolId: - type: string - description: Internal tool identifier - operation: - type: string - description: Tool operation/method name - usageControl: - type: string - enum: [auto, required, none] - description: When AI can use the tool - params: - type: object - description: Tool-specific configuration parameters - isExpanded: - type: boolean - description: UI state - default: false - responseFormat: - type: object - description: JSON Schema to enforce structured output - required: - - model - - apiKey - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful execution - error: - type: string - description: Target block ID for error handling -``` - -## ツール設定 - -ツールは以下の構造を持つ配列として定義されます: - -```yaml -tools: - - type: # Tool type identifier (exa, gmail, slack, etc.) - title: # Human-readable display name - toolId: # Internal tool identifier - operation: # Tool operation/method name - usageControl: # When AI can use it (auto | required | none) - params: # Tool-specific configuration parameters - isExpanded: # UI state (optional, default: false) -``` - -## 接続設定 - -接続は実行結果に基づいてワークフローの進行先を定義します: - -```yaml -connections: - success: # Target block ID for successful execution - error: # Target block ID for error handling (optional) -``` - -## 例 - -### 基本的なエージェント - -```yaml -content-agent: - type: agent - name: "Content Analyzer 1" - inputs: - systemPrompt: "You are a helpful content analyzer. Be concise and clear." - userPrompt: - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: summary-block - -summary-block: - type: agent - name: "Summary Generator" - inputs: - systemPrompt: "Create a brief summary of the analysis." - userPrompt: "Analyze this: " - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: final-step -``` - -### ツールを持つエージェント - -```yaml -research-agent: - type: agent - name: "Research Assistant" - inputs: - systemPrompt: "Research the topic and provide detailed information." - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - tools: - - type: exa - title: "Web Search" - toolId: exa_search - operation: exa_search - usageControl: auto - params: - apiKey: '{{EXA_API_KEY}}' - connections: - success: summary-block -``` - -### 構造化された出力 - -```yaml -data-extractor: - type: agent - name: "Extract Contact Info" - inputs: - systemPrompt: "Extract contact information from the text." - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - responseFormat: | - { - "name": "contact_extraction", - "schema": { - "type": "object", - "properties": { - "name": {"type": "string"}, - "email": {"type": "string"}, - "phone": {"type": "string"} - }, - "required": ["name"] - }, - "strict": true - } - connections: - success: save-contact -``` - -### Azure OpenAI - -```yaml -azure-agent: - type: agent - name: "Azure AI Assistant" - inputs: - systemPrompt: "You are a helpful assistant." - userPrompt: - model: gpt-4o - apiKey: '{{AZURE_OPENAI_API_KEY}}' - azureEndpoint: '{{AZURE_OPENAI_ENDPOINT}}' - azureApiVersion: "2024-07-01-preview" - connections: - success: response-block -``` \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/blocks/api.mdx b/apps/docs/content/docs/ja/yaml/blocks/api.mdx deleted file mode 100644 index 9c0be98871..0000000000 --- a/apps/docs/content/docs/ja/yaml/blocks/api.mdx +++ /dev/null @@ -1,429 +0,0 @@ ---- -title: API ブロック YAML スキーマ -description: API ブロックの YAML 設定リファレンス ---- - -## スキーマ定義 - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [api] - description: Block type identifier - name: - type: string - description: Display name for this API block - inputs: - type: object - required: - - url - - method - properties: - url: - type: string - description: The endpoint URL to send the request to - method: - type: string - enum: [GET, POST, PUT, DELETE, PATCH] - description: HTTP method for the request - default: GET - params: - type: array - description: Query parameters as table entries - items: - type: object - required: - - id - - cells - properties: - id: - type: string - description: Unique identifier for the parameter entry - cells: - type: object - required: - - Key - - Value - properties: - Key: - type: string - description: Parameter name - Value: - type: string - description: Parameter value - headers: - type: array - description: HTTP headers as table entries - items: - type: object - required: - - id - - cells - properties: - id: - type: string - description: Unique identifier for the header entry - cells: - type: object - required: - - Key - - Value - properties: - Key: - type: string - description: Header name - Value: - type: string - description: Header value - body: - type: string - description: Request body for POST/PUT/PATCH methods - timeout: - type: number - description: Request timeout in milliseconds - default: 30000 - minimum: 1000 - maximum: 300000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful requests - error: - type: string - description: Target block ID for error handling -``` - -## 接続設定 - -接続はリクエスト結果に基づいてワークフローの進行先を定義します: - -```yaml -connections: - success: # Target block ID for successful requests - error: # Target block ID for error handling (optional) -``` - -## 例 - -### シンプルな GET リクエスト - -```yaml -user-api: - type: api - name: "Fetch User Data" - inputs: - url: "https://api.example.com/users/123" - method: GET - headers: - - id: header-1-uuid-here - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" - - id: header-2-uuid-here - cells: - Key: "Content-Type" - Value: "application/json" - connections: - success: process-user-data - error: handle-api-error -``` - -### ボディを含む POST リクエスト - -```yaml -create-ticket: - type: api - name: "Create Support Ticket" - inputs: - url: "https://api.support.com/tickets" - method: POST - headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{SUPPORT_API_KEY}}" - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" - body: | - { - "title": "", - "description": "", - "priority": "high" - } - connections: - success: ticket-created - error: ticket-error -``` - -### 動的 URL とクエリパラメータ - -```yaml -search-api: - type: api - name: "Search Products" - inputs: - url: "https://api.store.com/products" - method: GET - params: - - id: search-param-uuid - cells: - Key: "q" - Value: - - id: limit-param-uuid - cells: - Key: "limit" - Value: "10" - - id: category-param-uuid - cells: - Key: "category" - Value: - headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{STORE_API_KEY}}" - connections: - success: display-results -``` - -## パラメータ形式 - -ヘッダーとパラメータ(クエリパラメータ)は以下の構造のテーブル形式を使用します: - -```yaml -headers: - - id: unique-identifier-here - cells: - Key: "Content-Type" - Value: "application/json" - - id: another-unique-identifier - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" - -params: - - id: param-identifier-here - cells: - Key: "limit" - Value: "10" -``` - -**構造の詳細:** -- `id`: テーブル行を追跡するための一意の識別子 -- `cells.Key`: パラメータ/ヘッダー名 -- `cells.Value`: パラメータ/ヘッダーの値 -- この形式により、適切なテーブル管理とUI状態の保持が可能になります - -## 出力参照 - -API ブロックが実行された後、後続のブロックでその出力を参照できます。API ブロックは主に3つの出力を提供します: - -### 利用可能な出力 - -| 出力 | 型 | 説明 | -|--------|------|-------------| -| `data` | any | API からのレスポンスボディ/ペイロード | -| `status` | number | HTTP ステータスコード(200、404、500など) | -| `headers` | object | サーバーから返されたレスポンスヘッダー | - -### 使用例 - -```yaml -# Reference API response data -process-data: - type: function - name: "Process API Data" - inputs: - code: | - const responseData = ; - const statusCode = ; - const responseHeaders = ; - - if (statusCode === 200) { - return { - success: true, - user: responseData, - contentType: responseHeaders['content-type'] - }; - } else { - return { - success: false, - error: `API call failed with status ${statusCode}` - }; - } - -# Use API data in an agent block -analyze-response: - type: agent - name: "Analyze Response" - inputs: - userPrompt: | - Analyze this API response: - - Status: - Data: - - Provide insights about the response. - -# Conditional logic based on status -check-status: - type: condition - name: "Check API Status" - inputs: - condition: === 200 - connections: - true: success-handler - false: error-handler -``` - -### 実用的な例 - -```yaml -user-api: - type: api - name: "Fetch User Data" - inputs: - url: "https://api.example.com/users/123" - method: GET - connections: - success: process-response - -process-response: - type: function - name: "Process Response" - inputs: - code: | - const user = ; - const status = ; - - console.log(`API returned status: ${status}`); - console.log(`User data:`, user); - - return { - userId: user.id, - email: user.email, - isActive: status === 200 - }; -``` - -### エラー処理 - -```yaml -api-with-error-handling: - type: api - name: "API Call" - inputs: - url: "https://api.example.com/data" - method: GET - connections: - success: check-response - error: handle-error - -check-response: - type: condition - name: "Check Response Status" - inputs: - condition: >= 200 && < 300 - connections: - true: process-success - false: handle-api-error - -process-success: - type: function - name: "Process Success" - inputs: - code: | - return { - success: true, - data: , - message: "API call successful" - }; - -handle-api-error: - type: function - name: "Handle API Error" - inputs: - code: | - return { - success: false, - status: , - error: "API call failed", - data: - }; -``` - -## YAMLの文字列エスケープ - -YAMLを記述する際、適切に解析されるために引用符で囲む必要がある文字列があります: - -### 引用符で囲む必要がある文字列 - -```yaml -# URLs with hyphens, colons, special characters -url: "https://api.example.com/users/123" -url: "https://my-api.example.com/data" - -# Header values with hyphens or special characters -headers: - - id: header-uuid - cells: - Key: "User-Agent" - Value: "My-Application/1.0" - - id: auth-uuid - cells: - Key: "Authorization" - Value: "Bearer my-token-123" - -# Parameter values with hyphens -params: - - id: param-uuid - cells: - Key: "sort-by" - Value: "created-at" -``` - -### 引用符を使用するタイミング - -- ✅ **常に引用符で囲む**: URL、トークン、ハイフン、コロン、特殊文字を含む値 -- ✅ **常に引用符で囲む**: 文字列として扱うべき数字で始まる値 -- ✅ **常に引用符で囲む**: 文字列として維持すべきブール値のように見える文字列 -- ❌ **引用符で囲まない**: 特殊文字を含まない単純な英数字の文字列 - -### 例 - -```yaml -# ✅ Correct -url: "https://api.stripe.com/v1/charges" -headers: - - id: auth-header - cells: - Key: "Authorization" - Value: "Bearer sk-test-123456789" - -# ❌ Incorrect (may cause parsing errors) -url: https://api.stripe.com/v1/charges -headers: - - id: auth-header - cells: - Key: Authorization - Value: Bearer sk-test-123456789 -``` - -## ベストプラクティス - -- APIキーには環境変数を使用する: `{{API_KEY_NAME}}` -- エラー接続でエラー処理を含める -- ユースケースに適したタイムアウトを設定する -- 後続のブロックでレスポンスステータスコードを検証する -- 参照しやすいように意味のあるブロック名を使用する -- **特殊文字、URL、トークンを含む文字列は常に引用符で囲む** \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/blocks/condition.mdx b/apps/docs/content/docs/ja/yaml/blocks/condition.mdx deleted file mode 100644 index 90b16f7a3e..0000000000 --- a/apps/docs/content/docs/ja/yaml/blocks/condition.mdx +++ /dev/null @@ -1,165 +0,0 @@ ---- -title: 条件ブロックYAMLスキーマ -description: 条件ブロックのYAML設定リファレンス ---- - -## スキーマ定義 - -```yaml -type: object -required: - - type - - name - - inputs - - connections -properties: - type: - type: string - enum: [condition] - description: Block type identifier - name: - type: string - description: Display name for this condition block - inputs: - type: object - required: - - conditions - properties: - conditions: - type: object - description: Conditional expressions and their logic - properties: - if: - type: string - description: Primary condition expression (boolean) - else-if: - type: string - description: Secondary condition expression (optional) - else-if-2: - type: string - description: Third condition expression (optional) - else-if-3: - type: string - description: Fourth condition expression (optional) - # Additional else-if-N conditions can be added as needed - else: - type: boolean - description: Default fallback condition (optional) - default: true - connections: - type: object - required: - - conditions - properties: - conditions: - type: object - description: Target blocks for each condition outcome - properties: - if: - type: string - description: Target block ID when 'if' condition is true - else-if: - type: string - description: Target block ID when 'else-if' condition is true - else-if-2: - type: string - description: Target block ID when 'else-if-2' condition is true - else-if-3: - type: string - description: Target block ID when 'else-if-3' condition is true - # Additional else-if-N connections can be added as needed - else: - type: string - description: Target block ID when no conditions match -``` - -## 接続設定 - -他のブロックとは異なり、条件ブロックは条件の結果に基づいて分岐する接続を使用します: - -```yaml -connections: - conditions: - if: # Target block ID when primary condition is true - else-if: # Target block ID when secondary condition is true (optional) - else-if-2: # Target block ID when third condition is true (optional) - else-if-3: # Target block ID when fourth condition is true (optional) - # Additional else-if-N connections can be added as needed - else: # Target block ID when no conditions match (optional) -``` - -## 例 - -### 単純なIf-Else - -```yaml -status-check: - type: condition - name: "Status Check" - inputs: - conditions: - if: === "approved" - else: true - connections: - conditions: - if: send-approval-email - else: send-rejection-email -``` - -### 複数の条件 - -```yaml -user-routing: - type: condition - name: "User Type Router" - inputs: - conditions: - if: === "admin" - else-if: === "premium" - else-if-2: === "basic" - else: true - connections: - conditions: - if: admin-dashboard - else-if: premium-features - else-if-2: basic-features - else: registration-flow -``` - -### 数値比較 - -```yaml -score-evaluation: - type: condition - name: "Score Evaluation" - inputs: - conditions: - if: >= 90 - else-if: >= 70 - else-if-2: >= 50 - else: true - connections: - conditions: - if: excellent-response - else-if: good-response - else-if-2: average-response - else: poor-response -``` - -### 複雑なロジック - -```yaml -eligibility-check: - type: condition - name: "Eligibility Check" - inputs: - conditions: - if: >= 18 && === true - else-if: >= 16 && === true - else: true - connections: - conditions: - if: full-access - else-if: limited-access - else: access-denied -``` \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/blocks/evaluator.mdx b/apps/docs/content/docs/ja/yaml/blocks/evaluator.mdx deleted file mode 100644 index b13e566acf..0000000000 --- a/apps/docs/content/docs/ja/yaml/blocks/evaluator.mdx +++ /dev/null @@ -1,255 +0,0 @@ ---- -title: 評価ブロックYAMLスキーマ -description: 評価ブロックのYAML設定リファレンス ---- - -## スキーマ定義 - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [evaluator] - description: Block type identifier - name: - type: string - description: Display name for this evaluator block - inputs: - type: object - required: - - content - - metrics - - model - - apiKey - properties: - content: - type: string - description: Content to evaluate (can reference other blocks) - metrics: - type: array - description: Evaluation criteria and scoring ranges - items: - type: object - properties: - name: - type: string - description: Metric identifier - description: - type: string - description: Detailed explanation of what the metric measures - range: - type: object - properties: - min: - type: number - description: Minimum score value - max: - type: number - description: Maximum score value - required: [min, max] - description: Scoring range with numeric bounds - model: - type: string - description: AI model identifier (e.g., gpt-4o, claude-3-5-sonnet-20241022) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Model temperature for evaluation - default: 0.3 - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful evaluation - error: - type: string - description: Target block ID for error handling -``` - -## 接続設定 - -接続は評価結果に基づいてワークフローの進行先を定義します: - -```yaml -connections: - success: # Target block ID for successful evaluation - error: # Target block ID for error handling (optional) -``` - -## 例 - -### コンテンツ品質評価 - -```yaml -content-evaluator: - type: evaluator - name: "Content Quality Evaluator" - inputs: - content: - metrics: - - name: "accuracy" - description: "How factually accurate is the content?" - range: - min: 1 - max: 5 - - name: "clarity" - description: "How clear and understandable is the content?" - range: - min: 1 - max: 5 - - name: "relevance" - description: "How relevant is the content to the original query?" - range: - min: 1 - max: 5 - - name: "completeness" - description: "How complete and comprehensive is the content?" - range: - min: 1 - max: 5 - model: gpt-4o - temperature: 0.2 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: quality-report - error: evaluation-error -``` - -### カスタマーレスポンス評価 - -```yaml -response-evaluator: - type: evaluator - name: "Customer Response Evaluator" - inputs: - content: - metrics: - - name: "helpfulness" - description: "How helpful is the response in addressing the customer's needs?" - range: - min: 1 - max: 10 - - name: "tone" - description: "How appropriate and professional is the tone?" - range: - min: 1 - max: 10 - - name: "completeness" - description: "Does the response fully address all aspects of the inquiry?" - range: - min: 1 - max: 10 - model: claude-3-5-sonnet-20241022 - apiKey: '{{ANTHROPIC_API_KEY}}' - connections: - success: response-processor -``` - -### A/Bテスト評価 - -```yaml -ab-test-evaluator: - type: evaluator - name: "A/B Test Evaluator" - inputs: - content: | - Version A: - Version B: - - Compare these two versions for the following criteria. - metrics: - - name: "engagement" - description: "Which version is more likely to engage users?" - range: "A, B, or Tie" - - name: "clarity" - description: "Which version communicates more clearly?" - range: "A, B, or Tie" - - name: "persuasiveness" - description: "Which version is more persuasive?" - range: "A, B, or Tie" - model: gpt-4o - temperature: 0.1 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: test-results -``` - -### 多次元コンテンツスコアリング - -```yaml -comprehensive-evaluator: - type: evaluator - name: "Comprehensive Content Evaluator" - inputs: - content: - metrics: - - name: "technical_accuracy" - description: "How technically accurate and correct is the information?" - range: - min: 0 - max: 100 - - name: "readability" - description: "How easy is the content to read and understand?" - range: - min: 0 - max: 100 - - name: "seo_optimization" - description: "How well optimized is the content for search engines?" - range: - min: 0 - max: 100 - - name: "user_engagement" - description: "How likely is this content to engage and retain readers?" - range: - min: 0 - max: 100 - - name: "brand_alignment" - description: "How well does the content align with brand voice and values?" - range: - min: 0 - max: 100 - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: content-optimization -``` - -## 出力リファレンス - -評価ブロックが実行された後、その出力を参照できます: - -```yaml -# In subsequent blocks -next-block: - inputs: - evaluation: # Evaluation summary - scores: # Individual metric scores - overall: # Overall assessment -``` - -## ベストプラクティス - -- 明確で具体的な評価基準を定義する -- ユースケースに適したスコアリング範囲を使用する -- 強力な推論能力を持つモデルを選択する -- 一貫したスコアリングのために低い温度設定を使用する -- 詳細な評価指標の説明を含める -- 多様なコンテンツタイプでテストする -- 複雑な評価には複数の評価者を検討する \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/blocks/function.mdx b/apps/docs/content/docs/ja/yaml/blocks/function.mdx deleted file mode 100644 index cd90b4e320..0000000000 --- a/apps/docs/content/docs/ja/yaml/blocks/function.mdx +++ /dev/null @@ -1,162 +0,0 @@ ---- -title: ファンクションブロックYAMLスキーマ -description: ファンクションブロックのYAML設定リファレンス ---- - -## スキーマ定義 - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [function] - description: Block type identifier - name: - type: string - description: Display name for this function block - inputs: - type: object - required: - - code - properties: - code: - type: string - description: JavaScript/TypeScript code to execute (multiline string) - timeout: - type: number - description: Maximum execution time in milliseconds - default: 30000 - minimum: 1000 - maximum: 300000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful execution - error: - type: string - description: Target block ID for error handling -``` - -## 接続設定 - -接続は実行結果に基づいてワークフローの進行先を定義します: - -```yaml -connections: - success: # Target block ID for successful execution - error: # Target block ID for error handling (optional) -``` - -## 例 - -### 単純な検証 - -```yaml -input-validator: - type: function - name: "Input Validator" - inputs: - code: |- - // Check if input number is greater than 5 - const inputValue = parseInt(, 10); - - if (inputValue > 5) { - return { - valid: true, - value: inputValue, - message: "Input is valid" - }; - } else { - return { - valid: false, - value: inputValue, - message: "Input must be greater than 5" - }; - } - connections: - success: next-step - error: handle-error -``` - -### データ処理 - -```yaml -data-processor: - type: function - name: "Data Transformer" - inputs: - code: | - // Transform the input data - const rawData = ; - - // Process and clean the data - const processed = rawData - .filter(item => item.status === 'active') - .map(item => ({ - id: item.id, - name: item.name.trim(), - date: new Date(item.created).toISOString() - })); - - return processed; - connections: - success: api-save - error: error-handler -``` - -### API連携 - -```yaml -api-formatter: - type: function - name: "Format API Request" - inputs: - code: | - // Prepare data for API submission - const userData = ; - - const apiPayload = { - timestamp: new Date().toISOString(), - data: userData, - source: "workflow-automation", - version: "1.0" - }; - - return apiPayload; - connections: - success: api-call -``` - -### 計算処理 - -```yaml -calculator: - type: function - name: "Calculate Results" - inputs: - code: | - // Perform calculations on input data - const numbers = ; - - const sum = numbers.reduce((a, b) => a + b, 0); - const average = sum / numbers.length; - const max = Math.max(...numbers); - const min = Math.min(...numbers); - - return { - sum, - average, - max, - min, - count: numbers.length - }; - connections: - success: results-display -``` \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/blocks/index.mdx b/apps/docs/content/docs/ja/yaml/blocks/index.mdx deleted file mode 100644 index 0bf4ddf356..0000000000 --- a/apps/docs/content/docs/ja/yaml/blocks/index.mdx +++ /dev/null @@ -1,151 +0,0 @@ ---- -title: ブロックスキーマ -description: すべてのSimブロックの完全なYAMLスキーマリファレンス ---- - -import { Card, Cards } from "fumadocs-ui/components/card"; - -このセクションには、Simで利用可能なすべてのブロックタイプの完全なYAMLスキーマ定義が含まれています。各ブロックタイプには特定の設定要件と出力形式があります。 - -## コアブロック - -これらはワークフローを作成するための基本的な構成要素です: - - - - 手動トリガー、ウェブフック、スケジュールをサポートするワークフローのエントリーポイント - - - LLM統合とツールサポートを備えたAI駆動の処理 - - - カスタムJavaScript/TypeScriptコード実行環境 - - - 最終的なワークフロー結果のフォーマットと返却 - - - -## ロジック&制御フロー - -条件付きロジックと制御フローを実装するためのブロック: - - - - ブール式に基づく条件分岐 - - - AI駆動の複数パスへのインテリジェントルーティング - - - forとforEachループによる反復処理 - - - 複数インスタンスでの並行実行 - - - -## 統合ブロック - -外部サービスやシステムに接続するためのブロック: - - - - 外部REST APIへのHTTPリクエスト - - - 外部統合用のウェブフックトリガー - - - -## 高度なブロック - -複雑なワークフローパターン用の特殊ブロック: - - - - 定義された基準とメトリクスに対して出力を検証 - - - 他のワークフローを再利用可能なコンポーネントとして実行 - - - -## 共通スキーマ要素 - -すべてのブロックが共有する共通要素: - -### 基本構造 - -```yaml -block-id: - type: - name: - inputs: - # Block-specific configuration - connections: - # Connection definitions -``` - -### 接続タイプ - -- **success**: 正常実行時のターゲットブロック -- **error**: エラー処理用のターゲットブロック(オプション) -- **conditions**: 条件付きブロック用の複数パス - -### 環境変数 - -環境変数には二重中括弧を使用します: - -```yaml -inputs: - apiKey: '{{API_KEY_NAME}}' - endpoint: '{{SERVICE_ENDPOINT}}' -``` - -### ブロック参照 - -他のブロックの出力を参照するには、ブロック名を小文字で使用します: - -```yaml -inputs: - userPrompt: - data: - originalInput: -``` - -## 検証ルール - -すべてのYAMLブロックはそのスキーマに対して検証されます: - -1. **必須フィールド**:存在する必要があります -2. **型検証**:値は期待される型と一致する必要があります -3. **列挙型検証**:文字列値は許可されたリストから選ばれる必要があります -4. **範囲検証**:数値は指定された範囲内である必要があります -5. **パターン検証**:文字列は正規表現パターンと一致する必要があります(該当する場合) - -## クイックリファレンス - -### ブロックタイプとプロパティ - -| ブロックタイプ | 主な出力 | 一般的な使用例 | -|------------|----------------|------------------| -| starter | `.input` | ワークフローのエントリーポイント | -| agent | `.content` | AI処理、テキスト生成 | -| function | `.output` | データ変換、計算 | -| api | `.output` | 外部サービス連携 | -| condition | N/A (分岐) | 条件付きロジック | -| router | N/A (分岐) | インテリジェントルーティング | -| response | N/A (終端) | 最終出力フォーマット | -| loop | `.results` | 反復処理 | -| parallel | `.results` | 並行処理 | -| webhook | `.payload` | 外部トリガー | -| evaluator | `.score` | 出力検証、品質評価 | -| workflow | `.output` | サブワークフロー実行、モジュール性 | - -### 必須 vs オプション - -- **常に必須**: `type`, `name` -- **通常必須**: `inputs`, `connections` -- **コンテキスト依存**: 特定の入力フィールドはブロックタイプによって異なります -- **常にオプション**: `error`接続、UI固有のフィールド \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/blocks/parallel.mdx b/apps/docs/content/docs/ja/yaml/blocks/parallel.mdx deleted file mode 100644 index cda4a09028..0000000000 --- a/apps/docs/content/docs/ja/yaml/blocks/parallel.mdx +++ /dev/null @@ -1,312 +0,0 @@ ---- -title: パラレルブロックYAMLスキーマ -description: パラレルブロックのYAML設定リファレンス ---- - -## スキーマ定義 - -```yaml -type: object -required: - - type - - name - - inputs - - connections -properties: - type: - type: string - enum: [parallel] - description: Block type identifier - name: - type: string - description: Display name for this parallel block - inputs: - type: object - required: - - parallelType - properties: - parallelType: - type: string - enum: [count, collection] - description: Type of parallel execution - count: - type: number - description: Number of parallel instances (for 'count' type) - minimum: 1 - maximum: 100 - collection: - type: string - description: Collection to distribute across instances (for 'collection' type) - maxConcurrency: - type: number - description: Maximum concurrent executions - default: 10 - minimum: 1 - maximum: 50 - connections: - type: object - required: - - parallel - properties: - parallel: - type: object - required: - - start - properties: - start: - type: string - description: Target block ID to execute inside each parallel instance - end: - type: string - description: Target block ID after all parallel instances complete (optional) - error: - type: string - description: Target block ID for error handling -``` - -## 接続設定 - -パラレルブロックは `parallel` セクションを持つ特別な接続形式を使用します: - -```yaml -connections: - parallel: - start: # Target block ID to execute inside each parallel instance - end: # Target block ID after all instances complete (optional) - error: # Target block ID for error handling (optional) -``` - -## 子ブロック設定 - -パラレルブロック内のブロックは、その `parentId` をパラレルブロックIDに設定する必要があります: - -```yaml -parallel-1: - type: parallel - name: "Process Items" - inputs: - parallelType: collection - collection: - connections: - parallel: - start: process-item - end: aggregate-results - -# Child block inside the parallel -process-item: - type: agent - name: "Process Item" - parentId: parallel-1 # References the parallel block - inputs: - systemPrompt: "Process this item" - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## 例 - -### カウントベースの並列処理 - -```yaml -worker-parallel: - type: parallel - name: "Worker Parallel" - inputs: - parallelType: count - count: 5 - maxConcurrency: 3 - connections: - parallel: - start: worker-task - end: collect-worker-results - -worker-task: - type: api - name: "Worker Task" - parentId: worker-parallel - inputs: - url: "https://api.worker.com/process" - method: POST - headers: - - key: "Authorization" - value: "Bearer {{WORKER_API_KEY}}" - body: | - { - "instanceId": , - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: worker-complete -``` - -### コレクションベースの並列処理 - -```yaml -api-parallel: - type: parallel - name: "API Parallel" - inputs: - parallelType: collection - collection: - maxConcurrency: 10 - connections: - parallel: - start: call-api - end: merge-api-results - -call-api: - type: api - name: "Call API" - parentId: api-parallel - inputs: - url: - method: - headers: - - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - connections: - success: api-complete -``` - -### 複雑な並列処理パイプライン - -```yaml -data-processing-parallel: - type: parallel - name: "Data Processing Parallel" - inputs: - parallelType: collection - collection: - maxConcurrency: 8 - connections: - parallel: - start: validate-data - end: final-aggregation - error: parallel-error-handler - -validate-data: - type: function - name: "Validate Data" - parentId: data-processing-parallel - inputs: - code: | - const record = ; - const index = ; - - // Validate record structure - if (!record.id || !record.content) { - throw new Error(`Invalid record at index ${index}`); - } - - return { - valid: true, - recordId: record.id, - validatedAt: new Date().toISOString() - }; - connections: - success: process-data - error: validation-error - -process-data: - type: agent - name: "Process Data" - parentId: data-processing-parallel - inputs: - systemPrompt: "Process and analyze this data record" - userPrompt: | - Record ID: - Content: - Instance: - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: store-result - -store-result: - type: function - name: "Store Result" - parentId: data-processing-parallel - inputs: - code: | - const processed = ; - const recordId = ; - - return { - recordId, - processed, - completedAt: new Date().toISOString(), - instanceIndex: - }; -``` - -### 同時AI分析 - -```yaml -multi-model-parallel: - type: parallel - name: "Multi-Model Analysis" - inputs: - parallelType: collection - collection: | - [ - {"model": "gpt-4o", "focus": "technical accuracy"}, - {"model": "claude-3-5-sonnet-20241022", "focus": "creative quality"}, - {"model": "gemini-2.0-flash-exp", "focus": "factual verification"} - ] - maxConcurrency: 3 - connections: - parallel: - start: analyze-content - end: combine-analyses - -analyze-content: - type: agent - name: "Analyze Content" - parentId: multi-model-parallel - inputs: - systemPrompt: | - You are analyzing content with a focus on . - Provide detailed analysis from this perspective. - userPrompt: | - Content to analyze: - Analysis focus: - model: - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: analysis-complete -``` - -## パラレル変数 - -パラレル子ブロック内では、以下の特殊変数が利用可能です: - -```yaml -# Available in all child blocks of the parallel - # Instance number (0-based) - # Item for this instance (collection type) - # Full collection (collection type) -``` - -## 出力参照 - -パラレルブロックが完了した後、その集約された結果を参照できます: - -```yaml -# In blocks after the parallel -final-processor: - inputs: - all-results: # Array of all instance results - total-count: # Number of instances completed -``` - -## ベストプラクティス - -- APIに過度な負荷をかけないよう適切なmaxConcurrencyを使用する -- 操作が独立していて互いに依存しないようにする -- 堅牢な並列実行のためにエラー処理を含める -- 最初に小さなコレクションでテストする -- 外部APIのレート制限を監視する -- 作業を分散するにはコレクション型を、固定インスタンスにはカウント型を使用する -- 大きなコレクションではメモリ使用量を考慮する \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/blocks/response.mdx b/apps/docs/content/docs/ja/yaml/blocks/response.mdx deleted file mode 100644 index d801d8af43..0000000000 --- a/apps/docs/content/docs/ja/yaml/blocks/response.mdx +++ /dev/null @@ -1,239 +0,0 @@ ---- -title: レスポンスブロックYAMLスキーマ -description: レスポンスブロックのYAML設定リファレンス ---- - -## スキーマ定義 - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [response] - description: Block type identifier - name: - type: string - description: Display name for this response block - inputs: - type: object - properties: - dataMode: - type: string - enum: [structured, json] - description: Mode for defining response data structure - default: structured - builderData: - type: object - description: Structured response data (when dataMode is 'structured') - data: - type: object - description: JSON response data (when dataMode is 'json') - status: - type: number - description: HTTP status code - default: 200 - minimum: 100 - maximum: 599 - headers: - type: array - description: Response headers as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column -``` - -## 接続設定 - -レスポンスブロックは終端ブロック(送信接続なし)であり、最終出力を定義します: - -```yaml -# No connections object needed - Response blocks are always terminal -``` - -## 例 - -### シンプルなレスポンス - -```yaml -simple-response: - type: response - name: "Simple Response" - inputs: - data: - message: "Hello World" - timestamp: - status: 200 -``` - -### 成功レスポンス - -```yaml -success-response: - type: response - name: "Success Response" - inputs: - data: - success: true - user: - id: - name: - email: - created_at: - status: 201 - headers: - - key: "Location" - value: "/api/users/" - - key: "X-Created-By" - value: "workflow-engine" -``` - -### 完全なテーブルヘッダー形式を持つレスポンス - -ヘッダーがUIテーブルインターフェースを通じて作成される場合、YAMLには追加のメタデータが含まれます: - -```yaml -api-response: - type: response - name: "API Response" - inputs: - data: - message: "Request processed successfully" - id: - status: 200 - headers: - - id: header-1-uuid-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - - id: header-2-uuid-here - key: "Cache-Control" - value: "no-cache" - cells: - Key: "Cache-Control" - Value: "no-cache" - - id: header-3-uuid-here - key: "X-API-Version" - value: "2.1" - cells: - Key: "X-API-Version" - Value: "2.1" -``` - -### エラーレスポンス - -```yaml -error-response: - type: response - name: "Error Response" - inputs: - data: - error: true - message: - code: "VALIDATION_FAILED" - details: - status: 400 - headers: - - key: "X-Error-Code" - value: "VALIDATION_FAILED" -``` - -### ページネーションレスポンス - -```yaml -paginated-response: - type: response - name: "Paginated Response" - inputs: - data: - data: - pagination: - page: - per_page: - total: - total_pages: - status: 200 - headers: - - key: "X-Total-Count" - value: - - key: "Cache-Control" - value: "public, max-age=300" - - key: "Content-Type" - value: "application/json" -``` - -## テーブルパラメータ形式 - -レスポンスブロックは、ヘッダーに対して2つの形式をサポートしています: - -### 簡略化された形式(手動YAML) - -YAMLを手動で記述する場合、簡略化された形式を使用できます: - -```yaml -headers: - - key: "Content-Type" - value: "application/json" - - key: "Cache-Control" - value: "no-cache" -``` - -### 完全なテーブル形式(UI生成) - -UIテーブルインターフェースを通じてヘッダーが作成される場合、YAMLには追加のメタデータが含まれます: - -```yaml -headers: - - id: unique-identifier-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" -``` - -**主な違い:** -- `id`:テーブル行を追跡するための一意の識別子 -- `cells`:UIテーブルインターフェースで使用される表示値 -- どちらの形式もワークフロー実行において機能的に同等です -- 完全な形式はワークフローのインポート/エクスポート時にUI状態を保持します - -**重要:** 特殊文字を含むヘッダー名と値は常に引用符で囲んでください: - -```yaml -headers: - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" - - id: cache-control-uuid - cells: - Key: "Cache-Control" - Value: "no-cache" -``` - -``` \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/blocks/router.mdx b/apps/docs/content/docs/ja/yaml/blocks/router.mdx deleted file mode 100644 index 16fd43a184..0000000000 --- a/apps/docs/content/docs/ja/yaml/blocks/router.mdx +++ /dev/null @@ -1,200 +0,0 @@ ---- -title: ルーターブロックYAMLスキーマ -description: ルーターブロックのYAML設定リファレンス ---- - -## スキーマ定義 - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [router] - description: Block type identifier - name: - type: string - description: Display name for this router block - inputs: - type: object - required: - - prompt - - model - - apiKey - properties: - prompt: - type: string - description: Instructions for routing decisions and criteria - model: - type: string - description: AI model identifier (e.g., gpt-4o, gemini-2.5-pro, deepseek-chat) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Model temperature for routing decisions - default: 0.3 - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - connections: - type: object - description: Multiple connection paths for different routing outcomes - properties: - success: - type: array - items: - type: string - description: Array of target block IDs for routing destinations -``` - -## 接続設定 - -ルーターブロックは、可能なすべてのルーティング先を含むsuccessアレイを使用します: - -```yaml -connections: - success: - - # Target block ID option 1 - - # Target block ID option 2 - - # Target block ID option 3 - # Additional target block IDs as needed -``` - -## 例 - -### コンテンツタイプルーター - -```yaml -content-router: - type: router - name: "Content Type Router" - inputs: - prompt: | - Route this content based on its type: - - If it's a question, route to question-handler - - If it's a complaint, route to complaint-handler - - If it's feedback, route to feedback-handler - - If it's a request, route to request-handler - - Content: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - question-handler - - complaint-handler - - feedback-handler - - request-handler -``` - -### 優先度ルーター - -```yaml -priority-router: - type: router - name: "Priority Router" - inputs: - prompt: | - Analyze the urgency and route accordingly: - - urgent-queue: High priority, needs immediate attention - - standard-queue: Normal priority, standard processing - - low-queue: Low priority, can be delayed - - Email content: - - Route based on urgency indicators, deadlines, and tone. - model: gpt-4o - temperature: 0.2 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - urgent-queue - - standard-queue - - low-queue -``` - -### 部門ルーター - -```yaml -department-router: - type: router - name: "Department Router" - inputs: - prompt: | - Route this customer inquiry to the appropriate department: - - - sales-team: Sales questions, pricing, demos - - support-team: Technical issues, bug reports, how-to questions - - billing-team: Payment issues, subscription changes, invoices - - general-team: General inquiries, feedback, other topics - - Customer message: - Customer type: - model: claude-3-5-sonnet-20241022 - apiKey: '{{ANTHROPIC_API_KEY}}' - connections: - success: - - sales-team - - support-team - - billing-team - - general-team -``` - -## 高度な設定 - -### 複数モデルルーター - -```yaml -model-selector-router: - type: router - name: "Model Selection Router" - inputs: - prompt: | - Based on the task complexity, route to the appropriate model: - - simple-gpt35: Simple questions, basic tasks - - advanced-gpt4: Complex analysis, detailed reasoning - - specialized-claude: Creative writing, nuanced analysis - - Task: - Complexity indicators: - model: gpt-4o-mini - temperature: 0.1 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - simple-gpt35 - - advanced-gpt4 - - specialized-claude -``` - -## 出力リファレンス - -ルーターブロックは直接出力を生成せず、ワークフローパスを制御します: - -```yaml -# Router decisions affect which subsequent blocks execute -# Access the routed block's outputs normally: -final-step: - inputs: - routed-result: -``` - -## ベストプラクティス - -- プロンプトに明確なルーティング基準を提供する -- 具体的で説明的なターゲットブロック名を使用する -- 各ルーティングパスのコンテンツ例を含める -- 一貫したルーティングのために低い温度値を使用する -- 正確なルーティングを確保するために多様な入力タイプでテストする -- エッジケース用のフォールバックパスを検討する \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/blocks/starter.mdx b/apps/docs/content/docs/ja/yaml/blocks/starter.mdx deleted file mode 100644 index bcff537015..0000000000 --- a/apps/docs/content/docs/ja/yaml/blocks/starter.mdx +++ /dev/null @@ -1,183 +0,0 @@ ---- -title: スターターブロックYAMLスキーマ -description: スターターブロック用のYAML設定リファレンス ---- - -## スキーマ定義 - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [starter] - description: Block type identifier - name: - type: string - description: Display name for this starter block - inputs: - type: object - properties: - startWorkflow: - type: string - enum: [manual, webhook, schedule] - description: How the workflow should be triggered - default: manual - inputFormat: - type: array - description: Expected input structure for API calls (manual workflows) - items: - type: object - properties: - name: - type: string - description: Field name - type: - type: string - enum: [string, number, boolean, object, array] - description: Field type - scheduleType: - type: string - enum: [hourly, daily, weekly, monthly] - description: Schedule frequency (schedule workflows only) - hourlyMinute: - type: number - minimum: 0 - maximum: 59 - description: Minute of the hour to run (hourly schedules) - dailyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (daily schedules) - weeklyDay: - type: string - enum: [MON, TUE, WED, THU, FRI, SAT, SUN] - description: Day of week to run (weekly schedules) - weeklyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (weekly schedules) - monthlyDay: - type: number - minimum: 1 - maximum: 28 - description: Day of month to run (monthly schedules) - monthlyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (monthly schedules) - timezone: - type: string - description: Timezone for scheduled workflows - default: UTC - webhookProvider: - type: string - enum: [slack, gmail, airtable, telegram, generic, whatsapp, github, discord, stripe] - description: Provider for webhook integration (webhook workflows only) - webhookConfig: - type: object - description: Provider-specific webhook configuration - connections: - type: object - properties: - success: - type: string - description: Target block ID to execute when workflow starts -``` - -## 接続設定 - -スターターブロックは開始点であるため、成功接続のみを持ちます: - -```yaml -connections: - success: # Target block ID to execute when workflow starts -``` - -## 例 - -### 手動開始 - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: next-block -``` - -### 入力フォーマット付きの手動開始 - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: manual - inputFormat: - - name: query - type: string - - name: email - type: string - - name: age - type: number - - name: isActive - type: boolean - - name: preferences - type: object - - name: tags - type: array - connections: - success: agent-1 -``` - -### 日次スケジュール - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: schedule - scheduleType: daily - dailyTime: "09:00" - timezone: "America/New_York" - connections: - success: daily-task -``` - -### 週次スケジュール - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: schedule - scheduleType: weekly - weeklyDay: MON - weeklyTime: "08:30" - timezone: UTC - connections: - success: weekly-report -``` - -### Webhookトリガー - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: webhook - webhookProvider: slack - webhookConfig: - # Provider-specific configuration - connections: - success: process-webhook -``` \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/blocks/webhook.mdx b/apps/docs/content/docs/ja/yaml/blocks/webhook.mdx deleted file mode 100644 index a2d00346ad..0000000000 --- a/apps/docs/content/docs/ja/yaml/blocks/webhook.mdx +++ /dev/null @@ -1,403 +0,0 @@ ---- -title: Webhookブロック YAMLスキーマ -description: Webhookブロックの YAML設定リファレンス ---- - -## スキーマ定義 - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [webhook] - description: Block type identifier - name: - type: string - description: Display name for this webhook block - inputs: - type: object - properties: - webhookConfig: - type: object - description: Webhook configuration settings - properties: - enabled: - type: boolean - description: Whether the webhook is active - default: true - secret: - type: string - description: Secret key for webhook verification - headers: - type: array - description: Expected headers for validation as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Expected header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column - methods: - type: array - description: Allowed HTTP methods - items: - type: string - enum: [GET, POST, PUT, DELETE, PATCH] - default: [POST] - responseConfig: - type: object - description: Response configuration for the webhook - properties: - status: - type: number - description: HTTP status code to return - default: 200 - minimum: 100 - maximum: 599 - headers: - type: array - description: Response headers as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column - body: - type: string - description: Response body content - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful webhook processing - error: - type: string - description: Target block ID for error handling -``` - -## 接続設定 - -接続はwebhook処理に基づいてワークフローの進行先を定義します: - -```yaml -connections: - success: # Target block ID for successful processing - error: # Target block ID for error handling (optional) -``` - -## 例 - -### 基本的なWebhookトリガー - -```yaml -github-webhook: - type: webhook - name: "GitHub Webhook" - inputs: - webhookConfig: - enabled: true - secret: "{{GITHUB_WEBHOOK_SECRET}}" - methods: [POST] - headers: - - key: "X-GitHub-Event" - value: "push" - responseConfig: - status: 200 - body: | - { - "message": "Webhook received successfully", - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: process-github-event - error: webhook-error-handler -``` - -### Slackイベントウェブフック - -```yaml -slack-events: - type: webhook - name: "Slack Events" - inputs: - webhookConfig: - enabled: true - secret: "{{SLACK_SIGNING_SECRET}}" - methods: [POST] - headers: - - key: "Content-Type" - value: "application/json" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "challenge": "" - } - connections: - success: handle-slack-event -``` - -### 決済Webhook(Stripe) - -```yaml -stripe-webhook: - type: webhook - name: "Stripe Payment Webhook" - inputs: - webhookConfig: - enabled: true - secret: "{{STRIPE_WEBHOOK_SECRET}}" - methods: [POST] - headers: - - key: "Stripe-Signature" - value: "*" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "received": true - } - connections: - success: process-payment-event - error: payment-webhook-error -``` - -### 完全なテーブルヘッダー形式を持つWebhook - -ヘッダーがUIテーブルインターフェースを通じて作成される場合、YAMLには追加のメタデータが含まれます: - -```yaml -api-webhook-complete: - type: webhook - name: "API Webhook with Table Headers" - inputs: - webhookConfig: - enabled: true - methods: [POST] - headers: - - id: header-1-uuid-here - key: "Authorization" - value: "Bearer {{WEBHOOK_API_KEY}}" - cells: - Key: "Authorization" - Value: "Bearer {{WEBHOOK_API_KEY}}" - - id: header-2-uuid-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - responseConfig: - status: 200 - headers: - - id: response-header-1-uuid - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - - id: response-header-2-uuid - key: "X-Webhook-Response" - value: "processed" - cells: - Key: "X-Webhook-Response" - Value: "processed" - body: | - { - "status": "received", - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: process-webhook-complete -``` - -### 汎用APIウェブフック - -```yaml -api-webhook: - type: webhook - name: "API Webhook" - inputs: - webhookConfig: - enabled: true - methods: [POST, PUT] - headers: - - key: "Authorization" - value: "Bearer {{WEBHOOK_API_KEY}}" - - key: "Content-Type" - value: "application/json" - responseConfig: - status: 202 - headers: - - key: "Content-Type" - value: "application/json" - - key: "X-Processed-By" - value: "Sim" - body: | - { - "status": "accepted", - "id": "{{Math.random().toString(36).substr(2, 9)}}", - "received_at": "{{new Date().toISOString()}}" - } - connections: - success: process-webhook-data -``` - -### 複数メソッドWebhook - -```yaml -crud-webhook: - type: webhook - name: "CRUD Webhook" - inputs: - webhookConfig: - enabled: true - methods: [GET, POST, PUT, DELETE] - headers: - - key: "X-API-Key" - value: "{{CRUD_API_KEY}}" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "method": "", - "processed": true, - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: route-by-method -``` - -## テーブルパラメータ形式 - -Webhookブロックは、ヘッダー(検証ヘッダーとレスポンスヘッダーの両方)に対して2つの形式をサポートしています: - -### 簡易形式(手動YAML) - -YAMLを手動で記述する場合、簡易形式を使用できます: - -```yaml -headers: - - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - - key: "Content-Type" - value: "application/json" -``` - -### 完全なテーブル形式(UI生成) - -ヘッダーがUIテーブルインターフェースを通じて作成される場合、YAMLには追加のメタデータが含まれます: - -```yaml -headers: - - id: unique-identifier-here - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" -``` - -**主な違い:** -- `id`:テーブル行を追跡するための一意の識別子 -- `cells`:UIテーブルインターフェースで使用される表示値 -- 両方の形式はウェブフック処理において機能的に同等です -- 完全な形式はワークフローのインポート/エクスポート時にUI状態を保持します - -**重要:** 特殊文字を含むヘッダー名と値は常に引用符で囲んでください: - -```yaml -headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{WEBHOOK_API_KEY}}" - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" -``` - -## ウェブフック変数 - -ウェブフックでトリガーされるワークフロー内では、以下の特別な変数が利用可能です: - -```yaml -# Available in blocks after the webhook - # Full request payload/body - # Request headers - # HTTP method used - # Query parameters - # Request path - # Challenge parameter (for verification) -``` - -## 出力参照 - -ウェブフックがリクエストを処理した後、そのデータを参照できます: - -```yaml -# In subsequent blocks -process-webhook: - inputs: - payload: # Request payload - headers: # Request headers - method: # HTTP method -``` - -## セキュリティのベストプラクティス - -- 検証にはウェブフックシークレットを常に使用する -- 予想されるヘッダーとメソッドを検証する -- 適切なエラー処理を実装する -- 本番環境ではHTTPSエンドポイントを使用する -- ウェブフックのアクティビティと失敗を監視する -- 適切な応答タイムアウトを設定する -- 処理前にペイロード構造を検証する \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/blocks/workflow.mdx b/apps/docs/content/docs/ja/yaml/blocks/workflow.mdx deleted file mode 100644 index 38371b7c2d..0000000000 --- a/apps/docs/content/docs/ja/yaml/blocks/workflow.mdx +++ /dev/null @@ -1,299 +0,0 @@ ---- -title: ワークフローブロックYAMLスキーマ -description: ワークフローブロックのYAML設定リファレンス ---- - -## スキーマ定義 - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [workflow] - description: Block type identifier - name: - type: string - description: Display name for this workflow block - inputs: - type: object - required: - - workflowId - properties: - workflowId: - type: string - description: ID of the workflow to execute - inputMapping: - type: object - description: Map current workflow data to sub-workflow inputs - additionalProperties: - type: string - description: Input value or reference to parent workflow data - environmentVariables: - type: object - description: Environment variables to pass to sub-workflow - additionalProperties: - type: string - description: Environment variable value - timeout: - type: number - description: Maximum execution time in milliseconds - default: 300000 - minimum: 1000 - maximum: 1800000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful workflow completion - error: - type: string - description: Target block ID for error handling -``` - -## 接続設定 - -接続はサブワークフローの結果に基づいてワークフローの進行先を定義します: - -```yaml -connections: - success: # Target block ID for successful completion - error: # Target block ID for error handling (optional) -``` - -## 例 - -### シンプルなワークフロー実行 - -```yaml -data-processor: - type: workflow - name: "Data Processing Workflow" - inputs: - workflowId: "data-processing-v2" - inputMapping: - rawData: - userId: - environmentVariables: - PROCESSING_MODE: "production" - LOG_LEVEL: "info" - connections: - success: process-results - error: workflow-error-handler -``` - -### コンテンツ生成パイプライン - -```yaml -content-generator: - type: workflow - name: "Content Generation Pipeline" - inputs: - workflowId: "content-generation-v3" - inputMapping: - topic: - style: - targetAudience: - brandGuidelines: - environmentVariables: - CONTENT_API_KEY: "{{CONTENT_API_KEY}}" - QUALITY_THRESHOLD: "high" - timeout: 120000 - connections: - success: review-content - error: content-generation-failed -``` - -### 複数ステップ分析ワークフロー - -```yaml -analysis-workflow: - type: workflow - name: "Analysis Workflow" - inputs: - workflowId: "comprehensive-analysis" - inputMapping: - document: - analysisType: "comprehensive" - includeMetrics: true - outputFormat: "structured" - environmentVariables: - ANALYSIS_MODEL: "gpt-4o" - OPENAI_API_KEY: "{{OPENAI_API_KEY}}" - CLAUDE_API_KEY: "{{CLAUDE_API_KEY}}" - connections: - success: compile-analysis-report - error: analysis-workflow-error -``` - -### 条件付きワークフロー実行 - -```yaml -customer-workflow-router: - type: condition - name: "Customer Workflow Router" - inputs: - conditions: - if: === "enterprise" - else-if: === "premium" - else: true - connections: - conditions: - if: enterprise-workflow - else-if: premium-workflow - else: standard-workflow - -enterprise-workflow: - type: workflow - name: "Enterprise Customer Workflow" - inputs: - workflowId: "enterprise-customer-processing" - inputMapping: - customerData: - accountManager: - tier: "enterprise" - environmentVariables: - PRIORITY_LEVEL: "high" - SLA_REQUIREMENTS: "strict" - connections: - success: enterprise-complete - -premium-workflow: - type: workflow - name: "Premium Customer Workflow" - inputs: - workflowId: "premium-customer-processing" - inputMapping: - customerData: - supportLevel: "premium" - environmentVariables: - PRIORITY_LEVEL: "medium" - connections: - success: premium-complete - -standard-workflow: - type: workflow - name: "Standard Customer Workflow" - inputs: - workflowId: "standard-customer-processing" - inputMapping: - customerData: - environmentVariables: - PRIORITY_LEVEL: "standard" - connections: - success: standard-complete -``` - -### 並列ワークフロー実行 - -```yaml -parallel-workflows: - type: parallel - name: "Parallel Workflow Processing" - inputs: - parallelType: collection - collection: | - [ - {"workflowId": "sentiment-analysis", "focus": "sentiment"}, - {"workflowId": "topic-extraction", "focus": "topics"}, - {"workflowId": "entity-recognition", "focus": "entities"} - ] - connections: - success: merge-workflow-results - -execute-analysis-workflow: - type: workflow - name: "Execute Analysis Workflow" - parentId: parallel-workflows - inputs: - workflowId: - inputMapping: - content: - analysisType: - environmentVariables: - ANALYSIS_API_KEY: "{{ANALYSIS_API_KEY}}" - connections: - success: workflow-complete -``` - -### エラー処理ワークフロー - -```yaml -main-workflow: - type: workflow - name: "Main Processing Workflow" - inputs: - workflowId: "main-processing-v1" - inputMapping: - data: - timeout: 180000 - connections: - success: main-complete - error: error-recovery-workflow - -error-recovery-workflow: - type: workflow - name: "Error Recovery Workflow" - inputs: - workflowId: "error-recovery-v1" - inputMapping: - originalInput: - errorDetails: - failureTimestamp: "{{new Date().toISOString()}}" - environmentVariables: - RECOVERY_MODE: "automatic" - FALLBACK_ENABLED: "true" - connections: - success: recovery-complete - error: manual-intervention-required -``` - -## 入力マッピング - -親ワークフローからサブワークフローへデータをマッピングします: - -```yaml -inputMapping: - # Static values - mode: "production" - version: "1.0" - - # References to parent workflow data - userData: - settings: - - # Complex object mapping - requestData: - id: - timestamp: "{{new Date().toISOString()}}" - source: "parent-workflow" -``` - -## 出力参照 - -ワークフローブロックが完了した後、その出力を参照できます: - -```yaml -# In subsequent blocks -next-block: - inputs: - workflowResult: # Sub-workflow output - executionTime: # Execution duration - status: # Execution status -``` - -## ベストプラクティス - -- 明確さのために説明的なワークフローIDを使用する -- サブワークフローには必要なデータのみをマッピングする -- ワークフローの複雑さに応じて適切なタイムアウトを設定する -- 堅牢な実行のためにエラー処理を含める -- 環境変数を安全に渡す -- サブワークフローを最初に個別にテストする -- ネストされたワークフローのパフォーマンスを監視する -- 安定性のためにバージョン管理されたワークフローIDを使用する \ No newline at end of file diff --git a/apps/docs/content/docs/ja/yaml/examples.mdx b/apps/docs/content/docs/ja/yaml/examples.mdx deleted file mode 100644 index d92ed5bda0..0000000000 --- a/apps/docs/content/docs/ja/yaml/examples.mdx +++ /dev/null @@ -1,273 +0,0 @@ ---- -title: YAMLワークフローの例 -description: 完全なYAMLワークフローの例 ---- - -import { Tab, Tabs } from 'fumadocs-ui/components/tabs' - -## マルチエージェントチェーンワークフロー - -複数のAIエージェントが順番に情報を処理するワークフロー: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: agent-1-initiator - - agent-1-initiator: - type: agent - name: Agent 1 Initiator - inputs: - systemPrompt: You are the first agent in a chain. Your role is to analyze the input and create an initial response that will be passed to the next agent. - userPrompt: |- - Welcome! I'm the first agent in our chain. - - Input to process: - - Please create an initial analysis or greeting that the next agent can build upon. Be creative and set a positive tone for the chain! - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-2-enhancer - - agent-2-enhancer: - type: agent - name: Agent 2 Enhancer - inputs: - systemPrompt: You are the second agent in a chain. Take the output from Agent 1 and enhance it with additional insights or improvements. - userPrompt: |- - I'm the second agent! Here's what Agent 1 provided: - - - - Now I'll enhance this with additional details, insights, or improvements. Let me build upon their work! - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-3-refiner - - agent-3-refiner: - type: agent - name: Agent 3 Refiner - inputs: - systemPrompt: You are the third agent in a chain. Take the enhanced output from Agent 2 and refine it further, adding structure or organization. - userPrompt: |- - I'm the third agent in our chain! Here's the enhanced work from Agent 2: - - - - My job is to refine and organize this content. I'll add structure, clarity, and polish to make it even better! - model: gpt-4o - temperature: 0.6 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-4-finalizer - - agent-4-finalizer: - type: agent - name: Agent 4 Finalizer - inputs: - systemPrompt: You are the final agent in a chain of 4. Create a comprehensive summary and conclusion based on all the previous agents' work. - userPrompt: |- - I'm the final agent! Here's the refined work from Agent 3: - - - - As the last agent in our chain, I'll create a final, polished summary that brings together all the work from our team of 4 agents. Let me conclude this beautifully! - model: gpt-4o - temperature: 0.5 - apiKey: '{{OPENAI_API_KEY}}' -``` - -## ルーターベースの条件付きワークフロー - -条件に基づいてデータを異なるエージェントに送信するルーティングロジックを使用するワークフロー: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: router-1 - - router-1: - type: router - name: Router 1 - inputs: - prompt: go to agent 1 if is greater than 5. else agent 2 if greater than 10. else agent 3 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - agent-1 - - agent-2 - - agent-3 - - agent-1: - type: agent - name: Agent 1 - inputs: - systemPrompt: say 1 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - - agent-2: - type: agent - name: Agent 2 - inputs: - systemPrompt: say 2 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - - agent-3: - type: agent - name: Agent 3 - inputs: - systemPrompt: say 3 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## 構造化出力を伴うウェブ検索 - -ツールを使用してウェブを検索し、構造化データを返すワークフロー: - -```yaml -version: '1.0' -blocks: - 59eb07c1-1411-4b28-a274-fa78f55daf72: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: d77c2c98-56c4-432d-9338-9bac54a2d42f - d77c2c98-56c4-432d-9338-9bac54a2d42f: - type: agent - name: Agent 1 - inputs: - systemPrompt: look up the user input. use structured output - userPrompt: - model: claude-sonnet-4-0 - apiKey: '{{ANTHROPIC_API_KEY}}' - tools: - - type: exa - title: Exa - params: - type: auto - apiKey: '{{EXA_API_KEY}}' - numResults: '' - toolId: exa_search - operation: exa_search - isExpanded: true - usageControl: auto - responseFormat: |- - { - "name": "output_schema", - "description": "Defines the structure for an output object.", - "strict": true, - "schema": { - "type": "object", - "properties": { - "output": { - "type": "string", - "description": "The output value" - } - }, - "additionalProperties": false, - "required": ["output"] - } - } -``` - -## コレクションを使用したループ処理 - -ループを使用してコレクション内の各アイテムを処理するワークフロー: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: food-analysis-loop - food-analysis-loop: - type: loop - name: Food Analysis Loop - inputs: - count: 5 - loopType: forEach - collection: '["apple", "banana", "carrot"]' - connections: - loop: - start: calorie-agent - calorie-agent: - type: agent - name: Calorie Analyzer - inputs: - systemPrompt: Return the number of calories in the food - userPrompt: - model: claude-sonnet-4-0 - apiKey: '{{ANTHROPIC_API_KEY}}' - parentId: food-analysis-loop -``` - -## メール分類と応答 - -メールを分類し、適切な応答を生成するワークフロー: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: email-classifier - - email-classifier: - type: agent - name: Email Classifier - inputs: - systemPrompt: Classify emails into categories and extract key information. - userPrompt: | - Classify this email: - - Categories: support, billing, sales, feedback - Extract: urgency level, customer sentiment, main request - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: response-generator - - response-generator: - type: agent - name: Response Generator - inputs: - systemPrompt: Generate appropriate responses based on email classification. - userPrompt: | - Email classification: - Original email: - - Generate a professional, helpful response addressing the customer's needs. - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' -``` diff --git a/apps/docs/content/docs/ja/yaml/index.mdx b/apps/docs/content/docs/ja/yaml/index.mdx deleted file mode 100644 index 8c2d9d8dd1..0000000000 --- a/apps/docs/content/docs/ja/yaml/index.mdx +++ /dev/null @@ -1,159 +0,0 @@ ---- -title: YAMLワークフローリファレンス -description: Simでのヤムルワークフロー作成の完全ガイド ---- - -import { Card, Cards } from "fumadocs-ui/components/card"; -import { Step, Steps } from "fumadocs-ui/components/steps"; -import { Tab, Tabs } from "fumadocs-ui/components/tabs"; - -YAMLワークフローは、Simでワークフロー設定を定義、バージョン管理、共有するための強力な方法を提供します。このリファレンスガイドでは、完全なYAML構文、ブロックスキーマ、堅牢なワークフローを作成するためのベストプラクティスについて説明します。 - -## クイックスタート - -すべてのSimワークフローは、この基本構造に従います: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: agent-1 - - agent-1: - type: agent - name: "AI Assistant" - inputs: - systemPrompt: "You are a helpful assistant." - userPrompt: 'Hi' - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## 基本概念 - - - - バージョン宣言: 必ず `version: '1.0'` (引用符付き)と記述 - - - ブロック構造: すべてのワークフローブロックは `blocks` キーの下で定義 - - - ブロック参照: ブロック名は小文字でスペースを削除して使用(例:``) - - - 環境変数: 二重中括弧 `{{VARIABLE_NAME}}` で参照 - - - -## ブロックタイプ - -Simは、それぞれ特定のYAMLスキーマを持つ複数のコアブロックタイプをサポートしています: - - - - 手動、ウェブフック、スケジュールトリガーをサポートするワークフローのエントリーポイント - - - ツールと構造化出力をサポートするAI駆動の処理 - - - カスタムJavaScript/TypeScriptコードの実行 - - - 外部サービスへのHTTPリクエスト - - - ブール式に基づく条件分岐 - - - AI駆動の複数パスへのインテリジェントルーティング - - - forとforEachループによる反復処理 - - - 複数インスタンスでの並行実行 - - - 外部連携用のウェブフックトリガー - - - 定義された基準とメトリクスに対する出力の検証 - - - 再利用可能なコンポーネントとして他のワークフローを実行 - - - 最終的なワークフロー出力のフォーマット - - - -## ブロック参照構文 - -YAMLワークフローの最も重要な側面は、ブロック間でデータを参照する方法を理解することです: - -### 基本ルール - -1. **ブロック名を使用する**(ブロックIDではなく)小文字に変換し、スペースを削除 -2. **適切なプロパティを追加する**(エージェントには.content、ツールには.output) -3. **チャットを使用する場合、スターターブロックを参照する** as `` - -### 例 - -```yaml -# Block definitions -email-processor: - type: agent - name: "Email Agent" - # ... configuration - -data-formatter: - type: function - name: "Data Agent" - # ... configuration - -# Referencing their outputs -next-block: - type: agent - name: "Next Step" - inputs: - userPrompt: | - Process this email: - Use this formatted data: - Original input: -``` - -### 特殊なケース - -- **ループ変数**: ``, ``, `` -- **並列変数**: ``, `` - -## 環境変数 - -APIキーなどの機密データには環境変数を使用してください: - -```yaml -inputs: - apiKey: '{{OPENAI_API_KEY}}' - database: '{{DATABASE_URL}}' - token: '{{SLACK_BOT_TOKEN}}' -``` - -## ベストプラクティス - -- **ブロック名は読みやすくする**: UI表示用に「Email Processor」など -- **環境変数を参照する**: APIキーをハードコードしない -- **読みやすさのための構造化**: 関連するブロックを論理的にグループ化する -- **段階的にテストする**: ワークフローを一歩ずつ構築する - -## 次のステップ - -- [ブロック参照構文](/yaml/block-reference) - 詳細な参照ルール -- [完全なブロックスキーマ](/yaml/blocks) - 利用可能なすべてのブロックタイプ -- [ワークフロー例](/yaml/examples) - 実世界のワークフローパターン \ No newline at end of file diff --git a/apps/docs/content/docs/zh/blocks/guardrails.mdx b/apps/docs/content/docs/zh/blocks/guardrails.mdx new file mode 100644 index 0000000000..f2d6a95f8f --- /dev/null +++ b/apps/docs/content/docs/zh/blocks/guardrails.mdx @@ -0,0 +1,251 @@ +--- +title: Guardrails +--- + +import { Callout } from 'fumadocs-ui/components/callout' +import { Step, Steps } from 'fumadocs-ui/components/steps' +import { Tab, Tabs } from 'fumadocs-ui/components/tabs' +import { Image } from '@/components/ui/image' +import { Video } from '@/components/ui/video' + +The Guardrails block validates and protects your AI workflows by checking content against multiple validation types. Ensure data quality, prevent hallucinations, detect PII, and enforce format requirements before content moves through your workflow. + +
+ Guardrails Block +
+ +## Overview + +The Guardrails block enables you to: + + + + Validate JSON Structure: Ensure LLM outputs are valid JSON before parsing + + + Match Regex Patterns: Verify content matches specific formats (emails, phone numbers, URLs, etc.) + + + Detect Hallucinations: Use RAG + LLM scoring to validate AI outputs against knowledge base content + + + Detect PII: Identify and optionally mask personally identifiable information across 40+ entity types + + + +## Validation Types + +### JSON Validation + +Validates that content is properly formatted JSON. Perfect for ensuring structured LLM outputs can be safely parsed. + +**Use Cases:** +- Validate JSON responses from Agent blocks before parsing +- Ensure API payloads are properly formatted +- Check structured data integrity + +**Output:** +- `passed`: `true` if valid JSON, `false` otherwise +- `error`: Error message if validation fails (e.g., "Invalid JSON: Unexpected token...") + +### Regex Validation + +Checks if content matches a specified regular expression pattern. + +**Use Cases:** +- Validate email addresses +- Check phone number formats +- Verify URLs or custom identifiers +- Enforce specific text patterns + +**Configuration:** +- **Regex Pattern**: The regular expression to match against (e.g., `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` for emails) + +**Output:** +- `passed`: `true` if content matches pattern, `false` otherwise +- `error`: Error message if validation fails + +### Hallucination Detection + +Uses Retrieval-Augmented Generation (RAG) with LLM scoring to detect when AI-generated content contradicts or isn't grounded in your knowledge base. + +**How It Works:** +1. Queries your knowledge base for relevant context +2. Sends both the AI output and retrieved context to an LLM +3. LLM assigns a confidence score (0-10 scale) + - **0** = Full hallucination (completely ungrounded) + - **10** = Fully grounded (completely supported by knowledge base) +4. Validation passes if score ≥ threshold (default: 3) + +**Configuration:** +- **Knowledge Base**: Select from your existing knowledge bases +- **Model**: Choose LLM for scoring (requires strong reasoning - GPT-4o, Claude 3.7 Sonnet recommended) +- **API Key**: Authentication for selected LLM provider (auto-hidden for hosted/Ollama models) +- **Confidence Threshold**: Minimum score to pass (0-10, default: 3) +- **Top K** (Advanced): Number of knowledge base chunks to retrieve (default: 10) + +**Output:** +- `passed`: `true` if confidence score ≥ threshold +- `score`: Confidence score (0-10) +- `reasoning`: LLM's explanation for the score +- `error`: Error message if validation fails + +**Use Cases:** +- Validate Agent responses against documentation +- Ensure customer support answers are factually accurate +- Verify generated content matches source material +- Quality control for RAG applications + +### PII Detection + +Detects personally identifiable information using Microsoft Presidio. Supports 40+ entity types across multiple countries and languages. + +
+
+ +**How It Works:** +1. Scans content for PII entities using pattern matching and NLP +2. Returns detected entities with locations and confidence scores +3. Optionally masks detected PII in the output + +**Configuration:** +- **PII Types to Detect**: Select from grouped categories via modal selector + - **Common**: Person name, Email, Phone, Credit card, IP address, etc. + - **USA**: SSN, Driver's license, Passport, etc. + - **UK**: NHS number, National insurance number + - **Spain**: NIF, NIE, CIF + - **Italy**: Fiscal code, Driver's license, VAT code + - **Poland**: PESEL, NIP, REGON + - **Singapore**: NRIC/FIN, UEN + - **Australia**: ABN, ACN, TFN, Medicare + - **India**: Aadhaar, PAN, Passport, Voter number +- **Mode**: + - **Detect**: Only identify PII (default) + - **Mask**: Replace detected PII with masked values +- **Language**: Detection language (default: English) + +**Output:** +- `passed`: `false` if any selected PII types are detected +- `detectedEntities`: Array of detected PII with type, location, and confidence +- `maskedText`: Content with PII masked (only if mode = "Mask") +- `error`: Error message if validation fails + +**Use Cases:** +- Block content containing sensitive personal information +- Mask PII before logging or storing data +- Compliance with GDPR, HIPAA, and other privacy regulations +- Sanitize user inputs before processing + +## Configuration + +### Content to Validate + +The input content to validate. This typically comes from: +- Agent block outputs: `` +- Function block results: `` +- API responses: `` +- Any other block output + +### Validation Type + +Choose from four validation types: +- **Valid JSON**: Check if content is properly formatted JSON +- **Regex Match**: Verify content matches a regex pattern +- **Hallucination Check**: Validate against knowledge base with LLM scoring +- **PII Detection**: Detect and optionally mask personally identifiable information + +## Outputs + +All validation types return: + +- **``**: Boolean indicating if validation passed +- **``**: The type of validation performed +- **``**: The original input that was validated +- **``**: Error message if validation failed (optional) + +Additional outputs by type: + +**Hallucination Check:** +- **``**: Confidence score (0-10) +- **``**: LLM's explanation + +**PII Detection:** +- **``**: Array of detected PII entities +- **``**: Content with PII masked (if mode = "Mask") + +## Example Use Cases + +### Validate JSON Before Parsing + +
+

Scenario: Ensure Agent output is valid JSON

+
    +
  1. Agent generates structured JSON response
  2. +
  3. Guardrails validates JSON format
  4. +
  5. Condition block checks ``
  6. +
  7. If passed → Parse and use data, If failed → Retry or handle error
  8. +
+
+ +### Prevent Hallucinations + +
+

Scenario: Validate customer support responses

+
    +
  1. Agent generates response to customer question
  2. +
  3. Guardrails checks against support documentation knowledge base
  4. +
  5. If confidence score ≥ 3 → Send response
  6. +
  7. If confidence score \< 3 → Flag for human review
  8. +
+
+ +### Block PII in User Inputs + +
+

Scenario: Sanitize user-submitted content

+
    +
  1. User submits form with text content
  2. +
  3. Guardrails detects PII (emails, phone numbers, SSN, etc.)
  4. +
  5. If PII detected → Reject submission or mask sensitive data
  6. +
  7. If no PII → Process normally
  8. +
+
+ +
+
+ +### Validate Email Format + +
+

Scenario: Check email address format

+
    +
  1. Agent extracts email from text
  2. +
  3. Guardrails validates with regex pattern
  4. +
  5. If valid → Use email for notification
  6. +
  7. If invalid → Request correction
  8. +
+
+ +## Best Practices + +- **Chain with Condition blocks**: Use `` to branch workflow logic based on validation results +- **Use JSON validation before parsing**: Always validate JSON structure before attempting to parse LLM outputs +- **Choose appropriate PII types**: Only select the PII entity types relevant to your use case for better performance +- **Set reasonable confidence thresholds**: For hallucination detection, adjust threshold based on your accuracy requirements (higher = stricter) +- **Use strong models for hallucination detection**: GPT-4o or Claude 3.7 Sonnet provide more accurate confidence scoring +- **Mask PII for logging**: Use "Mask" mode when you need to log or store content that may contain PII +- **Test regex patterns**: Validate your regex patterns thoroughly before deploying to production +- **Monitor validation failures**: Track `` messages to identify common validation issues + + + Guardrails validation happens synchronously in your workflow. For hallucination detection, choose faster models (like GPT-4o-mini) if latency is critical. + + diff --git a/apps/docs/content/docs/zh/execution/costs.mdx b/apps/docs/content/docs/zh/execution/costs.mdx index 4ada972604..e4133ac0c8 100644 --- a/apps/docs/content/docs/zh/execution/costs.mdx +++ b/apps/docs/content/docs/zh/execution/costs.mdx @@ -180,6 +180,41 @@ curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" htt ## 下一步 +- 在 [设置 → 订阅](https://sim.ai/settings/subscription) 中查看您当前的使用情况 +- 了解 [日志记录](/execution/logging) 以跟踪执行详情 +- 探索 [外部 API](/execution/api) 以实现程序化成本监控 +- 查看 [工作流优化技术](/blocks) 以降低成本 + +**团队计划($40/每席位/月):** +- 团队成员共享使用量 +- 超额使用根据团队总使用量计算 +- 组织所有者收到一张账单 + +**企业计划:** +- 固定月费,无超额费用 +- 根据协议定制使用限制 + +### 阈值计费 + +当未结算的超额费用达到 $50 时,Sim 会自动结算全部未结算金额。 + +**示例:** +- 第 10 天:$70 超额 → 立即结算 $70 +- 第 15 天:额外使用 $35(总计 $105)→ 已结算,无需操作 +- 第 20 天:再使用 $50(总计 $155,未结算 $85)→ 立即结算 $85 + +这将大额超额费用分散到整个月,而不是在周期结束时一次性结算。 + +## 成本管理最佳实践 + +1. **定期监控**:经常检查您的使用仪表板,避免意外 +2. **设定预算**:使用计划限制作为支出控制的参考 +3. **优化工作流程**:审查高成本执行,优化提示或模型选择 +4. **使用合适的模型**:根据任务需求匹配模型复杂度 +5. **批量处理相似任务**:尽可能合并多个请求以减少开销 + +## 下一步 + - 在 [设置 → 订阅](https://sim.ai/settings/subscription) 中查看您当前的使用情况 - 了解 [日志记录](/execution/logging) 以跟踪执行详情 - 探索 [外部 API](/execution/api) 以实现程序化成本监控 diff --git a/apps/docs/content/docs/zh/sdks/typescript.mdx b/apps/docs/content/docs/zh/sdks/typescript.mdx index ba56120459..914499074f 100644 --- a/apps/docs/content/docs/zh/sdks/typescript.mdx +++ b/apps/docs/content/docs/zh/sdks/typescript.mdx @@ -957,34 +957,6 @@ function StreamingWorkflow() { - Node.js 16+ - TypeScript 5.0+ (for TypeScript projects) -## TypeScript Support - -The SDK is written in TypeScript and provides full type safety: - -```typescript -import { - SimStudioClient, - WorkflowExecutionResult, - WorkflowStatus, - SimStudioError -} from 'simstudio-ts-sdk'; - -// 类型安全的客户端初始化 -const client: SimStudioClient = new SimStudioClient({ - apiKey: process.env.SIM_API_KEY! -}); - -// 类型安全的工作流执行 -const result: WorkflowExecutionResult = await client.executeWorkflow('workflow-id', { - input: { - message: '你好,TypeScript!' - } -}); - -// 类型安全的状态检查 -const status: WorkflowStatus = await client.getWorkflowStatus('workflow-id'); -``` - ## 许可证 Apache-2.0 diff --git a/apps/docs/content/docs/zh/tools/knowledge.mdx b/apps/docs/content/docs/zh/tools/knowledge.mdx index 6f3e5be5c4..953ff30035 100644 --- a/apps/docs/content/docs/zh/tools/knowledge.mdx +++ b/apps/docs/content/docs/zh/tools/knowledge.mdx @@ -61,9 +61,9 @@ Sim 的知识库是一项强大的原生功能,能够让您直接在平台内 | 参数 | 类型 | 必需 | 描述 | | --------- | ---- | -------- | ----------- | | `knowledgeBaseId` | string | 是 | 要搜索的知识库的 ID | -| `query` | string | 否 | 搜索查询文本(使用标签过滤时可选) | -| `topK` | number | 否 | 返回最相似结果的数量(1-100) | -| `tagFilters` | any | 否 | 包含 tagName 和 tagValue 属性的标签过滤器数组 | +| `query` | string | 否 | 搜索查询文本(使用标签过滤器时可选) | +| `topK` | number | 否 | 要返回的最相似结果的数量(1-100) | +| `tagFilters` | array | 否 | 包含 tagName 和 tagValue 属性的标签过滤器数组 | #### 输出 diff --git a/apps/docs/content/docs/zh/tools/supabase.mdx b/apps/docs/content/docs/zh/tools/supabase.mdx index b762915baa..417304c54a 100644 --- a/apps/docs/content/docs/zh/tools/supabase.mdx +++ b/apps/docs/content/docs/zh/tools/supabase.mdx @@ -111,7 +111,7 @@ Sim 的 Supabase 集成使您能够轻松地将代理工作流连接到您的 Su | --------- | ---- | -------- | ----------- | | `projectId` | string | 是 | 您的 Supabase 项目 ID \(例如:jdrkgepadsdopsntdlom\) | | `table` | string | 是 | 要插入数据的 Supabase 表名 | -| `data` | any | 是 | 要插入的数据 | +| `data` | array | 是 | 要插入的数据 \(对象数组或单个对象\) | | `apiKey` | string | 是 | 您的 Supabase 服务角色密钥 | #### 输出 @@ -191,8 +191,8 @@ Sim 的 Supabase 集成使您能够轻松地将代理工作流连接到您的 Su | 参数 | 类型 | 必需 | 描述 | | --------- | ---- | -------- | ----------- | | `projectId` | string | 是 | 您的 Supabase 项目 ID \(例如:jdrkgepadsdopsntdlom\) | -| `table` | string | 是 | 要进行 upsert 数据操作的 Supabase 表名 | -| `data` | any | 是 | 要 upsert(插入或更新)的数据 | +| `table` | string | 是 | 要插入或更新数据的 Supabase 表名 | +| `data` | array | 是 | 要插入或更新的数据 \(插入或更新\) - 对象数组或单个对象 | | `apiKey` | string | 是 | 您的 Supabase 服务角色密钥 | #### 输出 diff --git a/apps/docs/content/docs/zh/tools/telegram.mdx b/apps/docs/content/docs/zh/tools/telegram.mdx index ec4e776dd7..f4b8cedcb5 100644 --- a/apps/docs/content/docs/zh/tools/telegram.mdx +++ b/apps/docs/content/docs/zh/tools/telegram.mdx @@ -86,12 +86,108 @@ Telegram 的主要功能包括: | 参数 | 类型 | 描述 | | --------- | ---- | ----------- | -| `success` | boolean | Telegram 消息发送成功状态 | -| `messageId` | number | 唯一的 Telegram 消息标识符 | -| `chatId` | string | 发送消息的目标聊天 ID | -| `text` | string | 已发送消息的文本内容 | -| `timestamp` | number | 消息发送时的 Unix 时间戳 | -| `from` | object | 关于发送消息的机器人信息 | +| `message` | 字符串 | 成功或错误消息 | +| `data` | 对象 | Telegram 消息数据 | + +## 注意 + +- 类别:`tools` +- 类型:`telegram` + +#### 输入 + +| 参数 | 类型 | 必需 | 描述 | +| --------- | ---- | -------- | ----------- | +| `botToken` | 字符串 | 是 | 您的 Telegram Bot API 令牌 | +| `chatId` | 字符串 | 是 | 目标 Telegram 聊天 ID | +| `messageId` | 字符串 | 是 | 要删除的消息 ID | + +#### 输出 + +| 参数 | 类型 | 描述 | +| --------- | ---- | ----------- | +| `message` | 字符串 | 成功或错误信息 | +| `data` | 对象 | 删除操作结果 | + +### `telegram_send_photo` + +通过 Telegram Bot API 向 Telegram 频道或用户发送照片。 + +#### 输入 + +| 参数 | 类型 | 必需 | 描述 | +| --------- | ---- | -------- | ----------- | +| `botToken` | 字符串 | 是 | 您的 Telegram Bot API 令牌 | +| `chatId` | 字符串 | 是 | 目标 Telegram 聊天 ID | +| `photo` | 字符串 | 是 | 要发送的照片。传递 file_id 或 HTTP URL | +| `caption` | 字符串 | 否 | 照片标题(可选) | + +#### 输出 + +| 参数 | 类型 | 描述 | +| --------- | ---- | ----------- | +| `message` | 字符串 | 成功或错误信息 | +| `data` | 对象 | 包含可选照片的 Telegram 消息数据 | + +### `telegram_send_video` + +通过 Telegram Bot API 向 Telegram 频道或用户发送视频。 + +#### 输入 + +| 参数 | 类型 | 必需 | 描述 | +| --------- | ---- | -------- | ----------- | +| `botToken` | 字符串 | 是 | 您的 Telegram Bot API 令牌 | +| `chatId` | 字符串 | 是 | 目标 Telegram 聊天 ID | +| `video` | 字符串 | 是 | 要发送的视频。传递 file_id 或 HTTP URL | +| `caption` | 字符串 | 否 | 视频标题(可选) | + +#### 输出 + +| 参数 | 类型 | 描述 | +| --------- | ---- | ----------- | +| `message` | string | 成功或错误消息 | +| `data` | object | 包含可选媒体的 Telegram 消息数据 | + +### `telegram_send_audio` + +通过 Telegram Bot API 向 Telegram 频道或用户发送音频文件。 + +#### 输入 + +| 参数 | 类型 | 必需 | 描述 | +| --------- | ---- | -------- | ----------- | +| `botToken` | string | 是 | 您的 Telegram Bot API 令牌 | +| `chatId` | string | 是 | 目标 Telegram 聊天 ID | +| `audio` | string | 是 | 要发送的音频文件。传递 file_id 或 HTTP URL | +| `caption` | string | 否 | 音频标题(可选) | + +#### 输出 + +| 参数 | 类型 | 描述 | +| --------- | ---- | ----------- | +| `message` | string | 成功或错误消息 | +| `data` | object | 包含语音/音频信息的 Telegram 消息数据 | + +### `telegram_send_animation` + +通过 Telegram Bot API 向 Telegram 频道或用户发送动画(GIF)。 + +#### 输入 + +| 参数 | 类型 | 必需 | 描述 | +| --------- | ---- | -------- | ----------- | +| `botToken` | string | 是 | 您的 Telegram Bot API 令牌 | +| `chatId` | string | 是 | 目标 Telegram 聊天 ID | +| `animation` | string | 是 | 要发送的动画。传递 file_id 或 HTTP URL | +| `caption` | string | 否 | 动画标题(可选) | + +#### 输出 + +| 参数 | 类型 | 描述 | +| --------- | ---- | ----------- | +| `message` | 字符串 | 成功或错误消息 | +| `data` | 对象 | 包含可选媒体的 Telegram 消息数据 | ## 注意 diff --git a/apps/docs/content/docs/zh/tools/youtube.mdx b/apps/docs/content/docs/zh/tools/youtube.mdx index 5b6f212323..6b02548765 100644 --- a/apps/docs/content/docs/zh/tools/youtube.mdx +++ b/apps/docs/content/docs/zh/tools/youtube.mdx @@ -1,6 +1,6 @@ --- title: YouTube -description: 在 YouTube 上搜索视频 +description: 与 YouTube 视频、频道和播放列表互动 --- import { BlockInfoCard } from "@/components/ui/block-info-card" @@ -39,7 +39,7 @@ import { BlockInfoCard } from "@/components/ui/block-info-card" ## 使用说明 -将 YouTube 集成到工作流程中。可以搜索视频。需要 API 密钥。 +将 YouTube 集成到工作流程中。可以搜索视频、获取视频详情、获取频道信息、获取播放列表项目以及获取视频评论。 ## 工具 @@ -61,6 +61,99 @@ import { BlockInfoCard } from "@/components/ui/block-info-card" | --------- | ---- | ----------- | | `items` | 数组 | 匹配搜索查询的 YouTube 视频数组 | +### `youtube_video_details` + +获取特定 YouTube 视频的详细信息。 + +#### 输入 + +| 参数 | 类型 | 必需 | 描述 | +| --------- | ---- | -------- | ----------- | +| `videoId` | 字符串 | 是 | YouTube 视频 ID | +| `apiKey` | 字符串 | 是 | YouTube API 密钥 | + +#### 输出 + +| 参数 | 类型 | 描述 | +| --------- | ---- | ----------- | +| `videoId` | 字符串 | YouTube 视频 ID | +| `title` | 字符串 | 视频标题 | +| `description` | 字符串 | 视频描述 | +| `channelId` | 字符串 | 频道 ID | +| `channelTitle` | 字符串 | 频道名称 | +| `publishedAt` | 字符串 | 发布日期和时间 | +| `duration` | 字符串 | 视频时长(ISO 8601 格式) | +| `viewCount` | 数字 | 查看次数 | +| `likeCount` | 数字 | 点赞次数 | +| `commentCount` | 数字 | 评论数量 | +| `thumbnail` | 字符串 | 视频缩略图 URL | +| `tags` | 数组 | 视频标签 | + +### `youtube_channel_info` + +获取 YouTube 频道的详细信息。 + +#### 输入 + +| 参数 | 类型 | 必需 | 描述 | +| --------- | ---- | -------- | ----------- | +| `channelId` | 字符串 | 否 | YouTube 频道 ID \(使用 channelId 或 username\) | +| `username` | 字符串 | 否 | YouTube 频道用户名 \(使用 channelId 或 username\) | +| `apiKey` | 字符串 | 是 | YouTube API 密钥 | + +#### 输出 + +| 参数 | 类型 | 描述 | +| --------- | ---- | ----------- | +| `channelId` | 字符串 | YouTube 频道 ID | +| `title` | 字符串 | 频道名称 | +| `description` | 字符串 | 频道描述 | +| `subscriberCount` | 数字 | 订阅者数量 | +| `videoCount` | 数字 | 视频数量 | +| `viewCount` | 数字 | 频道总观看次数 | +| `publishedAt` | 字符串 | 频道创建日期 | +| `thumbnail` | 字符串 | 频道缩略图 URL | +| `customUrl` | 字符串 | 频道自定义 URL | + +### `youtube_playlist_items` + +从 YouTube 播放列表中获取视频。 + +#### 输入 + +| 参数 | 类型 | 必需 | 描述 | +| --------- | ---- | -------- | ----------- | +| `playlistId` | 字符串 | 是 | YouTube 播放列表 ID | +| `maxResults` | 数字 | 否 | 返回视频的最大数量 | +| `pageToken` | 字符串 | 否 | 分页的页面令牌 | +| `apiKey` | 字符串 | 是 | YouTube API 密钥 | + +#### 输出 + +| 参数 | 类型 | 描述 | +| --------- | ---- | ----------- | +| `items` | 数组 | 播放列表中的视频数组 | + +### `youtube_comments` + +从 YouTube 视频中获取评论。 + +#### 输入 + +| 参数 | 类型 | 必需 | 描述 | +| --------- | ---- | -------- | ----------- | +| `videoId` | 字符串 | 是 | YouTube 视频 ID | +| `maxResults` | 数字 | 否 | 返回评论的最大数量 | +| `order` | 字符串 | 否 | 评论排序方式:时间或相关性 | +| `pageToken` | 字符串 | 否 | 分页的页面令牌 | +| `apiKey` | 字符串 | 是 | YouTube API 密钥 | + +#### 输出 + +| 参数 | 类型 | 描述 | +| --------- | ---- | ----------- | +| `items` | 数组 | 视频评论的数组 | + ## 注意事项 - 类别:`tools` diff --git a/apps/docs/content/docs/zh/triggers/api.mdx b/apps/docs/content/docs/zh/triggers/api.mdx index e5f6ef72ef..0d74f7495d 100644 --- a/apps/docs/content/docs/zh/triggers/api.mdx +++ b/apps/docs/content/docs/zh/triggers/api.mdx @@ -128,3 +128,60 @@ data: {"blockId":"agent1-uuid","chunk":" complete"} 一个工作流只能包含一个 API 触发器。更改后发布新部署,以确保端点保持最新。 + +### 文件上传格式 + +API 接受两种格式的文件: + +**1. Base64 编码文件**(推荐用于 SDK): + +```json +{ + "documents": [{ + "type": "file", + "data": "data:application/pdf;base64,JVBERi0xLjQK...", + "name": "document.pdf", + "mime": "application/pdf" + }] +} +``` + +- 单个文件的最大大小:20MB +- 文件会上传到云存储,并转换为具有所有属性的 UserFile 对象 + +**2. 直接 URL 引用**: + +```json +{ + "documents": [{ + "type": "url", + "data": "https://example.com/document.pdf", + "name": "document.pdf", + "mime": "application/pdf" + }] +} +``` + +- 文件不会上传,URL 会直接传递 +- 适用于引用现有文件 + +### 文件属性 + +对于文件,可以访问所有属性: + +| 属性 | 描述 | 类型 | +|----------|-------------|------| +| `` | 签名下载 URL | string | +| `` | 原始文件名 | string | +| `` | 文件大小(字节) | number | +| `` | MIME 类型 | string | +| `` | 上传时间戳(ISO 8601) | string | +| `` | URL 过期时间戳(ISO 8601) | string | + +对于 URL 引用的文件,除了 `uploadedAt` 和 `expiresAt` 外,其他属性均可用,因为文件未上传到我们的存储中。 + +如果未定义输入格式,执行器将仅在 `` 处暴露原始 JSON。 + + +一个工作流只能包含一个 API 触发器。更改后发布新的部署,以确保端点保持最新。 + diff --git a/apps/docs/content/docs/zh/triggers/chat.mdx b/apps/docs/content/docs/zh/triggers/chat.mdx index d48b75b97d..ddcb90ef28 100644 --- a/apps/docs/content/docs/zh/triggers/chat.mdx +++ b/apps/docs/content/docs/zh/triggers/chat.mdx @@ -41,3 +41,11 @@ import { Image } from '@/components/ui/image' 构建器会阻止在同一工作流中添加多个聊天触发器模块。 + +1. 为每个工作流添加一个聊天触发器模块。 +2. 以聊天模式部署工作流。 +3. 分享部署链接——每次回复都会重用会话 ID,因此工作流可以保持上下文。 + + +构建器会阻止在同一工作流中使用多个聊天触发器模块。 + diff --git a/apps/docs/content/docs/zh/yaml/block-reference.mdx b/apps/docs/content/docs/zh/yaml/block-reference.mdx deleted file mode 100644 index 2f2219872a..0000000000 --- a/apps/docs/content/docs/zh/yaml/block-reference.mdx +++ /dev/null @@ -1,242 +0,0 @@ ---- -title: 块引用语法 -description: 如何在 YAML 工作流中引用块之间的数据 ---- - -import { Callout } from 'fumadocs-ui/components/callout' -import { Tab, Tabs } from 'fumadocs-ui/components/tabs' - -块引用是 Sim 工作流中数据流的基础。了解如何正确地将一个块的输出作为另一个块的输入进行引用,对于构建功能性工作流至关重要。 - -## 基本引用规则 - -### 1. 使用块名称,而非块 ID - - - - - ```yaml - # Block definition - email-sender: - type: agent - name: "Email Generator" - # ... configuration - - # Reference the block - next-block: - inputs: - userPrompt: "Process this: " - ``` - - - - - ```yaml - # Block definition - email-sender: - type: agent - name: "Email Generator" - # ... configuration - - # ❌ Don't reference by block ID - next-block: - inputs: - userPrompt: "Process this: " - ``` - - - - -### 2. 将名称转换为引用格式 - -创建块引用的方法: - -1. **获取块名称**:"Email Generator" -2. **转换为小写**:"email generator" -3. **移除空格和特殊字符**:"emailgenerator" -4. **添加属性**:`` - -### 3. 使用正确的属性 - -不同的块类型会暴露不同的属性: - -- **Agent 块**:`.content`(AI 响应) -- **Function 块**:`.output`(返回值) -- **API 块**:`.output`(响应数据) -- **Tool 块**:`.output`(工具结果) - -## 引用示例 - -### 常见块引用 - -```yaml -# Agent block outputs - # Primary AI response - # Token usage information - # Estimated cost - # Tool execution details - -# Function block outputs - # Function return value - # Error information (if any) - -# API block outputs - # Response data - # HTTP status code - # Response headers - -# Tool block outputs - # Tool execution result -``` - -### 多词块名称 - -```yaml -# Block name: "Data Processor 2" - - -# Block name: "Email Validation Service" - - -# Block name: "Customer Info Agent" - -``` - -## 特殊引用情况 - -### 起始块 - - - 起始块始终被引用为 ``,无论其实际名称为何。 - - -```yaml -# Starter block definition -my-custom-start: - type: starter - name: "Custom Workflow Start" - # ... configuration - -# Always reference as 'start' -agent-1: - inputs: - userPrompt: # ✅ Correct - # userPrompt: # ❌ Wrong -``` - -### 循环变量 - -在循环块中,可以使用特殊变量: - -```yaml -# Available in loop child blocks - # Current iteration (0-based) - # Current item being processed (forEach loops) - # Full collection (forEach loops) -``` - -### 并行变量 - -在并行块中,可以使用特殊变量: - -```yaml -# Available in parallel child blocks - # Instance number (0-based) - # Item for this instance - # Full collection -``` - -## 复杂引用示例 - -### 嵌套数据访问 - -引用复杂对象时,请使用点符号: - -```yaml -# If an agent returns structured data -data-analyzer: - type: agent - name: "Data Analyzer" - inputs: - responseFormat: | - { - "schema": { - "type": "object", - "properties": { - "analysis": {"type": "object"}, - "summary": {"type": "string"}, - "metrics": {"type": "object"} - } - } - } - -# Reference nested properties -next-step: - inputs: - userPrompt: | - Summary: - Score: - Full data: -``` - -### 文本中的多个引用 - -```yaml -email-composer: - type: agent - inputs: - userPrompt: | - Create an email with the following information: - - Customer: - Order Details: - Support Ticket: - - Original request: -``` - -### 代码块中的引用 - -在函数块中使用引用时,它们会被替换为 JavaScript 值: - -```yaml -data-processor: - type: function - inputs: - code: | - // References are replaced with actual values - const customerData = ; - const orderInfo = ; - const originalInput = ; - - // Process the data - return { - customer: customerData.name, - orderId: orderInfo.id, - processed: true - }; -``` - -## 引用验证 - -Sim 在导入 YAML 时会验证所有引用: - -### 有效引用 -- 工作流中存在块 -- 属性适合块类型 -- 无循环依赖 -- 语法格式正确 - -### 常见错误 -- **未找到块**:引用的块不存在 -- **错误的属性**:在函数块中使用 `.content` -- **拼写错误**:块名称或属性拼写错误 -- **循环引用**:块直接或间接引用自身 - -## 最佳实践 - -1. **使用描述性块名称**:使引用更易读 -2. **保持一致性**:在整个过程中使用相同的命名约定 -3. **检查引用**:确保所有引用的块都存在 -4. **避免深度嵌套**:保持引用链可管理 -5. **记录复杂流程**:添加注释以解释引用关系 \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/blocks/agent.mdx b/apps/docs/content/docs/zh/yaml/blocks/agent.mdx deleted file mode 100644 index 03c9d792c1..0000000000 --- a/apps/docs/content/docs/zh/yaml/blocks/agent.mdx +++ /dev/null @@ -1,218 +0,0 @@ ---- -title: Agent Block YAML 架构 -description: Agent Block 的 YAML 配置参考 ---- - -## 架构定义 - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [agent] - description: Block type identifier - name: - type: string - description: Display name for this agent block - inputs: - type: object - properties: - systemPrompt: - type: string - description: Instructions that define the agent's role and behavior - userPrompt: - type: string - description: Input content to process (can reference other blocks) - model: - type: string - description: AI model identifier (e.g., gpt-4o, gemini-2.5-pro, deepseek-chat) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Response creativity level (varies by model) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - memories: - type: string - description: Memory context from memory blocks - tools: - type: array - description: List of external tools the agent can use - items: - type: object - required: [type, title, toolId, operation, usageControl] - properties: - type: - type: string - description: Tool type identifier - title: - type: string - description: Human-readable display name - toolId: - type: string - description: Internal tool identifier - operation: - type: string - description: Tool operation/method name - usageControl: - type: string - enum: [auto, required, none] - description: When AI can use the tool - params: - type: object - description: Tool-specific configuration parameters - isExpanded: - type: boolean - description: UI state - default: false - responseFormat: - type: object - description: JSON Schema to enforce structured output - required: - - model - - apiKey - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful execution - error: - type: string - description: Target block ID for error handling -``` - -## 工具配置 - -工具被定义为一个数组,其中每个工具具有以下结构: - -```yaml -tools: - - type: # Tool type identifier (exa, gmail, slack, etc.) - title: # Human-readable display name - toolId: # Internal tool identifier - operation: # Tool operation/method name - usageControl: # When AI can use it (auto | required | none) - params: # Tool-specific configuration parameters - isExpanded: # UI state (optional, default: false) -``` - -## 连接配置 - -连接定义了根据执行结果工作流的走向: - -```yaml -connections: - success: # Target block ID for successful execution - error: # Target block ID for error handling (optional) -``` - -## 示例 - -### 基本 Agent - -```yaml -content-agent: - type: agent - name: "Content Analyzer 1" - inputs: - systemPrompt: "You are a helpful content analyzer. Be concise and clear." - userPrompt: - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: summary-block - -summary-block: - type: agent - name: "Summary Generator" - inputs: - systemPrompt: "Create a brief summary of the analysis." - userPrompt: "Analyze this: " - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: final-step -``` - -### 带工具的 Agent - -```yaml -research-agent: - type: agent - name: "Research Assistant" - inputs: - systemPrompt: "Research the topic and provide detailed information." - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - tools: - - type: exa - title: "Web Search" - toolId: exa_search - operation: exa_search - usageControl: auto - params: - apiKey: '{{EXA_API_KEY}}' - connections: - success: summary-block -``` - -### 结构化输出 - -```yaml -data-extractor: - type: agent - name: "Extract Contact Info" - inputs: - systemPrompt: "Extract contact information from the text." - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - responseFormat: | - { - "name": "contact_extraction", - "schema": { - "type": "object", - "properties": { - "name": {"type": "string"}, - "email": {"type": "string"}, - "phone": {"type": "string"} - }, - "required": ["name"] - }, - "strict": true - } - connections: - success: save-contact -``` - -### Azure OpenAI - -```yaml -azure-agent: - type: agent - name: "Azure AI Assistant" - inputs: - systemPrompt: "You are a helpful assistant." - userPrompt: - model: gpt-4o - apiKey: '{{AZURE_OPENAI_API_KEY}}' - azureEndpoint: '{{AZURE_OPENAI_ENDPOINT}}' - azureApiVersion: "2024-07-01-preview" - connections: - success: response-block -``` \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/blocks/api.mdx b/apps/docs/content/docs/zh/yaml/blocks/api.mdx deleted file mode 100644 index 5a415c0266..0000000000 --- a/apps/docs/content/docs/zh/yaml/blocks/api.mdx +++ /dev/null @@ -1,429 +0,0 @@ ---- -title: API 块 YAML 模式 -description: API 块的 YAML 配置参考 ---- - -## 模式定义 - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [api] - description: Block type identifier - name: - type: string - description: Display name for this API block - inputs: - type: object - required: - - url - - method - properties: - url: - type: string - description: The endpoint URL to send the request to - method: - type: string - enum: [GET, POST, PUT, DELETE, PATCH] - description: HTTP method for the request - default: GET - params: - type: array - description: Query parameters as table entries - items: - type: object - required: - - id - - cells - properties: - id: - type: string - description: Unique identifier for the parameter entry - cells: - type: object - required: - - Key - - Value - properties: - Key: - type: string - description: Parameter name - Value: - type: string - description: Parameter value - headers: - type: array - description: HTTP headers as table entries - items: - type: object - required: - - id - - cells - properties: - id: - type: string - description: Unique identifier for the header entry - cells: - type: object - required: - - Key - - Value - properties: - Key: - type: string - description: Header name - Value: - type: string - description: Header value - body: - type: string - description: Request body for POST/PUT/PATCH methods - timeout: - type: number - description: Request timeout in milliseconds - default: 30000 - minimum: 1000 - maximum: 300000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful requests - error: - type: string - description: Target block ID for error handling -``` - -## 连接配置 - -连接定义了根据请求结果工作流的走向: - -```yaml -connections: - success: # Target block ID for successful requests - error: # Target block ID for error handling (optional) -``` - -## 示例 - -### 简单的 GET 请求 - -```yaml -user-api: - type: api - name: "Fetch User Data" - inputs: - url: "https://api.example.com/users/123" - method: GET - headers: - - id: header-1-uuid-here - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" - - id: header-2-uuid-here - cells: - Key: "Content-Type" - Value: "application/json" - connections: - success: process-user-data - error: handle-api-error -``` - -### 带有正文的 POST 请求 - -```yaml -create-ticket: - type: api - name: "Create Support Ticket" - inputs: - url: "https://api.support.com/tickets" - method: POST - headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{SUPPORT_API_KEY}}" - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" - body: | - { - "title": "", - "description": "", - "priority": "high" - } - connections: - success: ticket-created - error: ticket-error -``` - -### 带查询参数的动态 URL - -```yaml -search-api: - type: api - name: "Search Products" - inputs: - url: "https://api.store.com/products" - method: GET - params: - - id: search-param-uuid - cells: - Key: "q" - Value: - - id: limit-param-uuid - cells: - Key: "limit" - Value: "10" - - id: category-param-uuid - cells: - Key: "category" - Value: - headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{STORE_API_KEY}}" - connections: - success: display-results -``` - -## 参数格式 - -Headers 和 params(查询参数)使用以下结构的表格格式: - -```yaml -headers: - - id: unique-identifier-here - cells: - Key: "Content-Type" - Value: "application/json" - - id: another-unique-identifier - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" - -params: - - id: param-identifier-here - cells: - Key: "limit" - Value: "10" -``` - -**结构详情:** -- `id`:用于跟踪表格行的唯一标识符 -- `cells.Key`:参数/头部名称 -- `cells.Value`:参数/头部值 -- 此格式允许正确的表格管理和 UI 状态的保存 - -## 输出参考 - -在 API 块执行后,可以在后续块中引用其输出。API 块提供三个主要输出: - -### 可用输出 - -| 输出 | 类型 | 描述 | -|--------|------|-------------| -| `data` | any | API 的响应正文/负载 | -| `status` | number | HTTP 状态码(200、404、500 等)| -| `headers` | object | 服务器返回的响应头 | - -### 使用示例 - -```yaml -# Reference API response data -process-data: - type: function - name: "Process API Data" - inputs: - code: | - const responseData = ; - const statusCode = ; - const responseHeaders = ; - - if (statusCode === 200) { - return { - success: true, - user: responseData, - contentType: responseHeaders['content-type'] - }; - } else { - return { - success: false, - error: `API call failed with status ${statusCode}` - }; - } - -# Use API data in an agent block -analyze-response: - type: agent - name: "Analyze Response" - inputs: - userPrompt: | - Analyze this API response: - - Status: - Data: - - Provide insights about the response. - -# Conditional logic based on status -check-status: - type: condition - name: "Check API Status" - inputs: - condition: === 200 - connections: - true: success-handler - false: error-handler -``` - -### 实际示例 - -```yaml -user-api: - type: api - name: "Fetch User Data" - inputs: - url: "https://api.example.com/users/123" - method: GET - connections: - success: process-response - -process-response: - type: function - name: "Process Response" - inputs: - code: | - const user = ; - const status = ; - - console.log(`API returned status: ${status}`); - console.log(`User data:`, user); - - return { - userId: user.id, - email: user.email, - isActive: status === 200 - }; -``` - -### 错误处理 - -```yaml -api-with-error-handling: - type: api - name: "API Call" - inputs: - url: "https://api.example.com/data" - method: GET - connections: - success: check-response - error: handle-error - -check-response: - type: condition - name: "Check Response Status" - inputs: - condition: >= 200 && < 300 - connections: - true: process-success - false: handle-api-error - -process-success: - type: function - name: "Process Success" - inputs: - code: | - return { - success: true, - data: , - message: "API call successful" - }; - -handle-api-error: - type: function - name: "Handle API Error" - inputs: - code: | - return { - success: false, - status: , - error: "API call failed", - data: - }; -``` - -## YAML 字符串转义 - -在编写 YAML 时,某些字符串必须加引号才能被正确解析: - -### 必须加引号的字符串 - -```yaml -# URLs with hyphens, colons, special characters -url: "https://api.example.com/users/123" -url: "https://my-api.example.com/data" - -# Header values with hyphens or special characters -headers: - - id: header-uuid - cells: - Key: "User-Agent" - Value: "My-Application/1.0" - - id: auth-uuid - cells: - Key: "Authorization" - Value: "Bearer my-token-123" - -# Parameter values with hyphens -params: - - id: param-uuid - cells: - Key: "sort-by" - Value: "created-at" -``` - -### 何时使用引号 - -- ✅ **始终加引号**:URL、令牌、包含连字符、冒号或特殊字符的值 -- ✅ **始终加引号**:以数字开头但应为字符串的值 -- ✅ **始终加引号**:看似布尔值但应保持为字符串的值 -- ❌ **不要加引号**:不含特殊字符的简单字母数字字符串 - -### 示例 - -```yaml -# ✅ Correct -url: "https://api.stripe.com/v1/charges" -headers: - - id: auth-header - cells: - Key: "Authorization" - Value: "Bearer sk-test-123456789" - -# ❌ Incorrect (may cause parsing errors) -url: https://api.stripe.com/v1/charges -headers: - - id: auth-header - cells: - Key: Authorization - Value: Bearer sk-test-123456789 -``` - -## 最佳实践 - -- 使用环境变量存储 API 密钥:`{{API_KEY_NAME}}` -- 包含错误连接的错误处理 -- 为您的用例设置适当的超时时间 -- 在后续块中验证响应状态码 -- 使用有意义的块名称以便于参考 -- **始终为包含特殊字符、URL 和令牌的字符串加引号** \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/blocks/condition.mdx b/apps/docs/content/docs/zh/yaml/blocks/condition.mdx deleted file mode 100644 index 98e12d5fdd..0000000000 --- a/apps/docs/content/docs/zh/yaml/blocks/condition.mdx +++ /dev/null @@ -1,165 +0,0 @@ ---- -title: 条件块 YAML 模式 -description: 条件块的 YAML 配置参考 ---- - -## 模式定义 - -```yaml -type: object -required: - - type - - name - - inputs - - connections -properties: - type: - type: string - enum: [condition] - description: Block type identifier - name: - type: string - description: Display name for this condition block - inputs: - type: object - required: - - conditions - properties: - conditions: - type: object - description: Conditional expressions and their logic - properties: - if: - type: string - description: Primary condition expression (boolean) - else-if: - type: string - description: Secondary condition expression (optional) - else-if-2: - type: string - description: Third condition expression (optional) - else-if-3: - type: string - description: Fourth condition expression (optional) - # Additional else-if-N conditions can be added as needed - else: - type: boolean - description: Default fallback condition (optional) - default: true - connections: - type: object - required: - - conditions - properties: - conditions: - type: object - description: Target blocks for each condition outcome - properties: - if: - type: string - description: Target block ID when 'if' condition is true - else-if: - type: string - description: Target block ID when 'else-if' condition is true - else-if-2: - type: string - description: Target block ID when 'else-if-2' condition is true - else-if-3: - type: string - description: Target block ID when 'else-if-3' condition is true - # Additional else-if-N connections can be added as needed - else: - type: string - description: Target block ID when no conditions match -``` - -## 连接配置 - -与其他块不同,条件块使用基于条件结果的分支连接: - -```yaml -connections: - conditions: - if: # Target block ID when primary condition is true - else-if: # Target block ID when secondary condition is true (optional) - else-if-2: # Target block ID when third condition is true (optional) - else-if-3: # Target block ID when fourth condition is true (optional) - # Additional else-if-N connections can be added as needed - else: # Target block ID when no conditions match (optional) -``` - -## 示例 - -### 简单的 If-Else - -```yaml -status-check: - type: condition - name: "Status Check" - inputs: - conditions: - if: === "approved" - else: true - connections: - conditions: - if: send-approval-email - else: send-rejection-email -``` - -### 多条件 - -```yaml -user-routing: - type: condition - name: "User Type Router" - inputs: - conditions: - if: === "admin" - else-if: === "premium" - else-if-2: === "basic" - else: true - connections: - conditions: - if: admin-dashboard - else-if: premium-features - else-if-2: basic-features - else: registration-flow -``` - -### 数值比较 - -```yaml -score-evaluation: - type: condition - name: "Score Evaluation" - inputs: - conditions: - if: >= 90 - else-if: >= 70 - else-if-2: >= 50 - else: true - connections: - conditions: - if: excellent-response - else-if: good-response - else-if-2: average-response - else: poor-response -``` - -### 复杂逻辑 - -```yaml -eligibility-check: - type: condition - name: "Eligibility Check" - inputs: - conditions: - if: >= 18 && === true - else-if: >= 16 && === true - else: true - connections: - conditions: - if: full-access - else-if: limited-access - else: access-denied -``` \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/blocks/evaluator.mdx b/apps/docs/content/docs/zh/yaml/blocks/evaluator.mdx deleted file mode 100644 index ea23dab5f9..0000000000 --- a/apps/docs/content/docs/zh/yaml/blocks/evaluator.mdx +++ /dev/null @@ -1,255 +0,0 @@ ---- -title: Evaluator Block YAML 架构 -description: Evaluator Block 的 YAML 配置参考 ---- - -## 架构定义 - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [evaluator] - description: Block type identifier - name: - type: string - description: Display name for this evaluator block - inputs: - type: object - required: - - content - - metrics - - model - - apiKey - properties: - content: - type: string - description: Content to evaluate (can reference other blocks) - metrics: - type: array - description: Evaluation criteria and scoring ranges - items: - type: object - properties: - name: - type: string - description: Metric identifier - description: - type: string - description: Detailed explanation of what the metric measures - range: - type: object - properties: - min: - type: number - description: Minimum score value - max: - type: number - description: Maximum score value - required: [min, max] - description: Scoring range with numeric bounds - model: - type: string - description: AI model identifier (e.g., gpt-4o, claude-3-5-sonnet-20241022) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Model temperature for evaluation - default: 0.3 - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful evaluation - error: - type: string - description: Target block ID for error handling -``` - -## 连接配置 - -连接定义了根据评估结果工作流的走向: - -```yaml -connections: - success: # Target block ID for successful evaluation - error: # Target block ID for error handling (optional) -``` - -## 示例 - -### 内容质量评估 - -```yaml -content-evaluator: - type: evaluator - name: "Content Quality Evaluator" - inputs: - content: - metrics: - - name: "accuracy" - description: "How factually accurate is the content?" - range: - min: 1 - max: 5 - - name: "clarity" - description: "How clear and understandable is the content?" - range: - min: 1 - max: 5 - - name: "relevance" - description: "How relevant is the content to the original query?" - range: - min: 1 - max: 5 - - name: "completeness" - description: "How complete and comprehensive is the content?" - range: - min: 1 - max: 5 - model: gpt-4o - temperature: 0.2 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: quality-report - error: evaluation-error -``` - -### 客户反馈评估 - -```yaml -response-evaluator: - type: evaluator - name: "Customer Response Evaluator" - inputs: - content: - metrics: - - name: "helpfulness" - description: "How helpful is the response in addressing the customer's needs?" - range: - min: 1 - max: 10 - - name: "tone" - description: "How appropriate and professional is the tone?" - range: - min: 1 - max: 10 - - name: "completeness" - description: "Does the response fully address all aspects of the inquiry?" - range: - min: 1 - max: 10 - model: claude-3-5-sonnet-20241022 - apiKey: '{{ANTHROPIC_API_KEY}}' - connections: - success: response-processor -``` - -### A/B 测试评估 - -```yaml -ab-test-evaluator: - type: evaluator - name: "A/B Test Evaluator" - inputs: - content: | - Version A: - Version B: - - Compare these two versions for the following criteria. - metrics: - - name: "engagement" - description: "Which version is more likely to engage users?" - range: "A, B, or Tie" - - name: "clarity" - description: "Which version communicates more clearly?" - range: "A, B, or Tie" - - name: "persuasiveness" - description: "Which version is more persuasive?" - range: "A, B, or Tie" - model: gpt-4o - temperature: 0.1 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: test-results -``` - -### 多维内容评分 - -```yaml -comprehensive-evaluator: - type: evaluator - name: "Comprehensive Content Evaluator" - inputs: - content: - metrics: - - name: "technical_accuracy" - description: "How technically accurate and correct is the information?" - range: - min: 0 - max: 100 - - name: "readability" - description: "How easy is the content to read and understand?" - range: - min: 0 - max: 100 - - name: "seo_optimization" - description: "How well optimized is the content for search engines?" - range: - min: 0 - max: 100 - - name: "user_engagement" - description: "How likely is this content to engage and retain readers?" - range: - min: 0 - max: 100 - - name: "brand_alignment" - description: "How well does the content align with brand voice and values?" - range: - min: 0 - max: 100 - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: content-optimization -``` - -## 输出参考 - -在 Evaluator Block 执行后,您可以引用其输出: - -```yaml -# In subsequent blocks -next-block: - inputs: - evaluation: # Evaluation summary - scores: # Individual metric scores - overall: # Overall assessment -``` - -## 最佳实践 - -- 定义清晰、具体的评估标准 -- 根据您的使用场景选择适当的评分范围 -- 选择具有强大推理能力的模型 -- 使用较低的温度以获得一致的评分 -- 包含详细的指标描述 -- 使用多样化的内容类型进行测试 -- 对于复杂的评估,考虑使用多个评估器 \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/blocks/function.mdx b/apps/docs/content/docs/zh/yaml/blocks/function.mdx deleted file mode 100644 index e59ef9872c..0000000000 --- a/apps/docs/content/docs/zh/yaml/blocks/function.mdx +++ /dev/null @@ -1,162 +0,0 @@ ---- -title: 功能块 YAML 模式 -description: 功能块的 YAML 配置参考 ---- - -## 模式定义 - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [function] - description: Block type identifier - name: - type: string - description: Display name for this function block - inputs: - type: object - required: - - code - properties: - code: - type: string - description: JavaScript/TypeScript code to execute (multiline string) - timeout: - type: number - description: Maximum execution time in milliseconds - default: 30000 - minimum: 1000 - maximum: 300000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful execution - error: - type: string - description: Target block ID for error handling -``` - -## 连接配置 - -连接定义了根据执行结果工作流的走向: - -```yaml -connections: - success: # Target block ID for successful execution - error: # Target block ID for error handling (optional) -``` - -## 示例 - -### 简单验证 - -```yaml -input-validator: - type: function - name: "Input Validator" - inputs: - code: |- - // Check if input number is greater than 5 - const inputValue = parseInt(, 10); - - if (inputValue > 5) { - return { - valid: true, - value: inputValue, - message: "Input is valid" - }; - } else { - return { - valid: false, - value: inputValue, - message: "Input must be greater than 5" - }; - } - connections: - success: next-step - error: handle-error -``` - -### 数据处理 - -```yaml -data-processor: - type: function - name: "Data Transformer" - inputs: - code: | - // Transform the input data - const rawData = ; - - // Process and clean the data - const processed = rawData - .filter(item => item.status === 'active') - .map(item => ({ - id: item.id, - name: item.name.trim(), - date: new Date(item.created).toISOString() - })); - - return processed; - connections: - success: api-save - error: error-handler -``` - -### API 集成 - -```yaml -api-formatter: - type: function - name: "Format API Request" - inputs: - code: | - // Prepare data for API submission - const userData = ; - - const apiPayload = { - timestamp: new Date().toISOString(), - data: userData, - source: "workflow-automation", - version: "1.0" - }; - - return apiPayload; - connections: - success: api-call -``` - -### 计算 - -```yaml -calculator: - type: function - name: "Calculate Results" - inputs: - code: | - // Perform calculations on input data - const numbers = ; - - const sum = numbers.reduce((a, b) => a + b, 0); - const average = sum / numbers.length; - const max = Math.max(...numbers); - const min = Math.min(...numbers); - - return { - sum, - average, - max, - min, - count: numbers.length - }; - connections: - success: results-display -``` \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/blocks/index.mdx b/apps/docs/content/docs/zh/yaml/blocks/index.mdx deleted file mode 100644 index 69cd35f399..0000000000 --- a/apps/docs/content/docs/zh/yaml/blocks/index.mdx +++ /dev/null @@ -1,151 +0,0 @@ ---- -title: 块模式 -description: 所有 Sim 块的完整 YAML 模式参考 ---- - -import { Card, Cards } from "fumadocs-ui/components/card"; - -本节包含 Sim 中所有可用块类型的完整 YAML 模式定义。每种块类型都有特定的配置要求和输出格式。 - -## 核心块 - -这些是创建工作流的基本构建块: - - - - 支持手动触发、Webhook 和计划任务的工作流入口点 - - - 支持 LLM 集成和工具支持的 AI 驱动处理 - - - 自定义 JavaScript/TypeScript 代码执行环境 - - - 格式化并返回最终工作流结果 - - - -## 逻辑与控制流 - -用于实现条件逻辑和控制流的块: - - - - 基于布尔表达式的条件分支 - - - AI 驱动的智能路由到多个路径 - - - 使用 for 和 forEach 循环的迭代处理 - - - 跨多个实例的并发执行 - - - -## 集成块 - -用于连接外部服务和系统的块: - - - - 对外部 REST API 的 HTTP 请求 - - - 用于外部集成的 Webhook 触发器 - - - -## 高级块 - -用于复杂工作流模式的专用块: - - - - 根据定义的标准和指标验证输出 - - - 将其他工作流作为可重用组件执行 - - - -## 通用模式元素 - -所有块共享以下通用元素: - -### 基本结构 - -```yaml -block-id: - type: - name: - inputs: - # Block-specific configuration - connections: - # Connection definitions -``` - -### 连接类型 - -- **success**: 成功执行的目标块 -- **error**: 错误处理的目标块(可选) -- **conditions**: 条件块的多条路径 - -### 环境变量 - -使用双花括号表示环境变量: - -```yaml -inputs: - apiKey: '{{API_KEY_NAME}}' - endpoint: '{{SERVICE_ENDPOINT}}' -``` - -### 块引用 - -使用小写的块名称引用其他块的输出: - -```yaml -inputs: - userPrompt: - data: - originalInput: -``` - -## 验证规则 - -所有 YAML 块都会根据其模式进行验证: - -1. **必填字段**:必须存在 -2. **类型验证**:值必须与预期类型匹配 -3. **枚举验证**:字符串值必须来自允许的列表 -4. **范围验证**:数字必须在指定范围内 -5. **模式验证**:字符串必须匹配正则表达式模式(如适用) - -## 快速参考 - -### 块类型和属性 - -| 块类型 | 主要输出 | 常见用例 | -|------------|----------------|------------------| -| starter | `.input` | 工作流入口点 | -| agent | `.content` | AI 处理、文本生成 | -| function | `.output` | 数据转换、计算 | -| api | `.output` | 外部服务集成 | -| condition | N/A(分支) | 条件逻辑 | -| router | N/A(分支) | 智能路由 | -| response | N/A(终端) | 最终输出格式化 | -| loop | `.results` | 迭代处理 | -| parallel | `.results` | 并发处理 | -| webhook | `.payload` | 外部触发器 | -| evaluator | `.score` | 输出验证、质量评估 | -| workflow | `.output` | 子工作流执行、模块化 | - -### 必需与可选 - -- **始终必需**:`type`, `name` -- **通常必需**:`inputs`, `connections` -- **上下文相关**:具体输入字段因块类型而异 -- **始终可选**:`error` 连接、UI 特定字段 \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/blocks/parallel.mdx b/apps/docs/content/docs/zh/yaml/blocks/parallel.mdx deleted file mode 100644 index fab2a3df8a..0000000000 --- a/apps/docs/content/docs/zh/yaml/blocks/parallel.mdx +++ /dev/null @@ -1,312 +0,0 @@ ---- -title: 并行块 YAML 模式 -description: 并行块的 YAML 配置参考 ---- - -## 模式定义 - -```yaml -type: object -required: - - type - - name - - inputs - - connections -properties: - type: - type: string - enum: [parallel] - description: Block type identifier - name: - type: string - description: Display name for this parallel block - inputs: - type: object - required: - - parallelType - properties: - parallelType: - type: string - enum: [count, collection] - description: Type of parallel execution - count: - type: number - description: Number of parallel instances (for 'count' type) - minimum: 1 - maximum: 100 - collection: - type: string - description: Collection to distribute across instances (for 'collection' type) - maxConcurrency: - type: number - description: Maximum concurrent executions - default: 10 - minimum: 1 - maximum: 50 - connections: - type: object - required: - - parallel - properties: - parallel: - type: object - required: - - start - properties: - start: - type: string - description: Target block ID to execute inside each parallel instance - end: - type: string - description: Target block ID after all parallel instances complete (optional) - error: - type: string - description: Target block ID for error handling -``` - -## 连接配置 - -并行块使用一种特殊的连接格式,其中包含一个 `parallel` 部分: - -```yaml -connections: - parallel: - start: # Target block ID to execute inside each parallel instance - end: # Target block ID after all instances complete (optional) - error: # Target block ID for error handling (optional) -``` - -## 子块配置 - -并行块中的子块必须将其 `parentId` 设置为并行块的 ID: - -```yaml -parallel-1: - type: parallel - name: "Process Items" - inputs: - parallelType: collection - collection: - connections: - parallel: - start: process-item - end: aggregate-results - -# Child block inside the parallel -process-item: - type: agent - name: "Process Item" - parentId: parallel-1 # References the parallel block - inputs: - systemPrompt: "Process this item" - userPrompt: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## 示例 - -### 基于计数的并行处理 - -```yaml -worker-parallel: - type: parallel - name: "Worker Parallel" - inputs: - parallelType: count - count: 5 - maxConcurrency: 3 - connections: - parallel: - start: worker-task - end: collect-worker-results - -worker-task: - type: api - name: "Worker Task" - parentId: worker-parallel - inputs: - url: "https://api.worker.com/process" - method: POST - headers: - - key: "Authorization" - value: "Bearer {{WORKER_API_KEY}}" - body: | - { - "instanceId": , - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: worker-complete -``` - -### 基于集合的并行处理 - -```yaml -api-parallel: - type: parallel - name: "API Parallel" - inputs: - parallelType: collection - collection: - maxConcurrency: 10 - connections: - parallel: - start: call-api - end: merge-api-results - -call-api: - type: api - name: "Call API" - parentId: api-parallel - inputs: - url: - method: - headers: - - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - connections: - success: api-complete -``` - -### 复杂的并行处理管道 - -```yaml -data-processing-parallel: - type: parallel - name: "Data Processing Parallel" - inputs: - parallelType: collection - collection: - maxConcurrency: 8 - connections: - parallel: - start: validate-data - end: final-aggregation - error: parallel-error-handler - -validate-data: - type: function - name: "Validate Data" - parentId: data-processing-parallel - inputs: - code: | - const record = ; - const index = ; - - // Validate record structure - if (!record.id || !record.content) { - throw new Error(`Invalid record at index ${index}`); - } - - return { - valid: true, - recordId: record.id, - validatedAt: new Date().toISOString() - }; - connections: - success: process-data - error: validation-error - -process-data: - type: agent - name: "Process Data" - parentId: data-processing-parallel - inputs: - systemPrompt: "Process and analyze this data record" - userPrompt: | - Record ID: - Content: - Instance: - model: gpt-4o - temperature: 0.3 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: store-result - -store-result: - type: function - name: "Store Result" - parentId: data-processing-parallel - inputs: - code: | - const processed = ; - const recordId = ; - - return { - recordId, - processed, - completedAt: new Date().toISOString(), - instanceIndex: - }; -``` - -### 并发 AI 分析 - -```yaml -multi-model-parallel: - type: parallel - name: "Multi-Model Analysis" - inputs: - parallelType: collection - collection: | - [ - {"model": "gpt-4o", "focus": "technical accuracy"}, - {"model": "claude-3-5-sonnet-20241022", "focus": "creative quality"}, - {"model": "gemini-2.0-flash-exp", "focus": "factual verification"} - ] - maxConcurrency: 3 - connections: - parallel: - start: analyze-content - end: combine-analyses - -analyze-content: - type: agent - name: "Analyze Content" - parentId: multi-model-parallel - inputs: - systemPrompt: | - You are analyzing content with a focus on . - Provide detailed analysis from this perspective. - userPrompt: | - Content to analyze: - Analysis focus: - model: - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: analysis-complete -``` - -## 并行变量 - -在并行子块中,可以使用以下特殊变量: - -```yaml -# Available in all child blocks of the parallel - # Instance number (0-based) - # Item for this instance (collection type) - # Full collection (collection type) -``` - -## 输出引用 - -并行块完成后,您可以引用其聚合结果: - -```yaml -# In blocks after the parallel -final-processor: - inputs: - all-results: # Array of all instance results - total-count: # Number of instances completed -``` - -## 最佳实践 - -- 使用适当的 maxConcurrency 以避免对 API 造成过载 -- 确保操作是独立的,且不相互依赖 -- 包含错误处理以实现稳健的并行执行 -- 先用小型集合进行测试 -- 监控外部 API 的速率限制 -- 使用集合类型分配工作,使用计数类型处理固定实例 -- 考虑大规模集合的内存使用情况 \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/blocks/response.mdx b/apps/docs/content/docs/zh/yaml/blocks/response.mdx deleted file mode 100644 index 409ce8d8b2..0000000000 --- a/apps/docs/content/docs/zh/yaml/blocks/response.mdx +++ /dev/null @@ -1,239 +0,0 @@ ---- -title: 响应块 YAML 模式 -description: 响应块的 YAML 配置参考 ---- - -## 模式定义 - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [response] - description: Block type identifier - name: - type: string - description: Display name for this response block - inputs: - type: object - properties: - dataMode: - type: string - enum: [structured, json] - description: Mode for defining response data structure - default: structured - builderData: - type: object - description: Structured response data (when dataMode is 'structured') - data: - type: object - description: JSON response data (when dataMode is 'json') - status: - type: number - description: HTTP status code - default: 200 - minimum: 100 - maximum: 599 - headers: - type: array - description: Response headers as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column -``` - -## 连接配置 - -响应块是终端块(无出站连接),用于定义最终输出: - -```yaml -# No connections object needed - Response blocks are always terminal -``` - -## 示例 - -### 简单响应 - -```yaml -simple-response: - type: response - name: "Simple Response" - inputs: - data: - message: "Hello World" - timestamp: - status: 200 -``` - -### 成功响应 - -```yaml -success-response: - type: response - name: "Success Response" - inputs: - data: - success: true - user: - id: - name: - email: - created_at: - status: 201 - headers: - - key: "Location" - value: "/api/users/" - - key: "X-Created-By" - value: "workflow-engine" -``` - -### 带完整表头格式的响应 - -当通过 UI 表格界面创建表头时,YAML 包含额外的元数据: - -```yaml -api-response: - type: response - name: "API Response" - inputs: - data: - message: "Request processed successfully" - id: - status: 200 - headers: - - id: header-1-uuid-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - - id: header-2-uuid-here - key: "Cache-Control" - value: "no-cache" - cells: - Key: "Cache-Control" - Value: "no-cache" - - id: header-3-uuid-here - key: "X-API-Version" - value: "2.1" - cells: - Key: "X-API-Version" - Value: "2.1" -``` - -### 错误响应 - -```yaml -error-response: - type: response - name: "Error Response" - inputs: - data: - error: true - message: - code: "VALIDATION_FAILED" - details: - status: 400 - headers: - - key: "X-Error-Code" - value: "VALIDATION_FAILED" -``` - -### 分页响应 - -```yaml -paginated-response: - type: response - name: "Paginated Response" - inputs: - data: - data: - pagination: - page: - per_page: - total: - total_pages: - status: 200 - headers: - - key: "X-Total-Count" - value: - - key: "Cache-Control" - value: "public, max-age=300" - - key: "Content-Type" - value: "application/json" -``` - -## 表格参数格式 - -响应块支持两种表头格式: - -### 简化格式(手动 YAML) - -在手动编写 YAML 时,可以使用简化格式: - -```yaml -headers: - - key: "Content-Type" - value: "application/json" - - key: "Cache-Control" - value: "no-cache" -``` - -### 完整表格格式(UI 生成) - -当通过 UI 表格界面创建标题时,YAML 会包含额外的元数据: - -```yaml -headers: - - id: unique-identifier-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" -``` - -**关键区别:** -- `id`:用于跟踪表格行的唯一标识符 -- `cells`:UI 表格界面使用的显示值 -- 两种格式在工作流执行中功能等效 -- 完整格式在导入/导出工作流时保留 UI 状态 - -**重要提示:** 始终为包含特殊字符的标题名称和值加上引号: - -```yaml -headers: - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" - - id: cache-control-uuid - cells: - Key: "Cache-Control" - Value: "no-cache" -``` - -``` \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/blocks/router.mdx b/apps/docs/content/docs/zh/yaml/blocks/router.mdx deleted file mode 100644 index 54f33f9814..0000000000 --- a/apps/docs/content/docs/zh/yaml/blocks/router.mdx +++ /dev/null @@ -1,200 +0,0 @@ ---- -title: 路由器块 YAML 模式 -description: 路由器块的 YAML 配置参考 ---- - -## 模式定义 - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [router] - description: Block type identifier - name: - type: string - description: Display name for this router block - inputs: - type: object - required: - - prompt - - model - - apiKey - properties: - prompt: - type: string - description: Instructions for routing decisions and criteria - model: - type: string - description: AI model identifier (e.g., gpt-4o, gemini-2.5-pro, deepseek-chat) - apiKey: - type: string - description: API key for the model provider (use {{ENV_VAR}} format) - temperature: - type: number - minimum: 0 - maximum: 2 - description: Model temperature for routing decisions - default: 0.3 - azureEndpoint: - type: string - description: Azure OpenAI endpoint URL (required for Azure models) - azureApiVersion: - type: string - description: Azure API version (required for Azure models) - connections: - type: object - description: Multiple connection paths for different routing outcomes - properties: - success: - type: array - items: - type: string - description: Array of target block IDs for routing destinations -``` - -## 连接配置 - -路由器块使用一个包含所有可能路由目标的成功数组: - -```yaml -connections: - success: - - # Target block ID option 1 - - # Target block ID option 2 - - # Target block ID option 3 - # Additional target block IDs as needed -``` - -## 示例 - -### 内容类型路由器 - -```yaml -content-router: - type: router - name: "Content Type Router" - inputs: - prompt: | - Route this content based on its type: - - If it's a question, route to question-handler - - If it's a complaint, route to complaint-handler - - If it's feedback, route to feedback-handler - - If it's a request, route to request-handler - - Content: - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - question-handler - - complaint-handler - - feedback-handler - - request-handler -``` - -### 优先级路由器 - -```yaml -priority-router: - type: router - name: "Priority Router" - inputs: - prompt: | - Analyze the urgency and route accordingly: - - urgent-queue: High priority, needs immediate attention - - standard-queue: Normal priority, standard processing - - low-queue: Low priority, can be delayed - - Email content: - - Route based on urgency indicators, deadlines, and tone. - model: gpt-4o - temperature: 0.2 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - urgent-queue - - standard-queue - - low-queue -``` - -### 部门路由器 - -```yaml -department-router: - type: router - name: "Department Router" - inputs: - prompt: | - Route this customer inquiry to the appropriate department: - - - sales-team: Sales questions, pricing, demos - - support-team: Technical issues, bug reports, how-to questions - - billing-team: Payment issues, subscription changes, invoices - - general-team: General inquiries, feedback, other topics - - Customer message: - Customer type: - model: claude-3-5-sonnet-20241022 - apiKey: '{{ANTHROPIC_API_KEY}}' - connections: - success: - - sales-team - - support-team - - billing-team - - general-team -``` - -## 高级配置 - -### 多模型路由器 - -```yaml -model-selector-router: - type: router - name: "Model Selection Router" - inputs: - prompt: | - Based on the task complexity, route to the appropriate model: - - simple-gpt35: Simple questions, basic tasks - - advanced-gpt4: Complex analysis, detailed reasoning - - specialized-claude: Creative writing, nuanced analysis - - Task: - Complexity indicators: - model: gpt-4o-mini - temperature: 0.1 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - simple-gpt35 - - advanced-gpt4 - - specialized-claude -``` - -## 输出参考 - -路由器块不会直接生成输出,而是控制工作流路径: - -```yaml -# Router decisions affect which subsequent blocks execute -# Access the routed block's outputs normally: -final-step: - inputs: - routed-result: -``` - -## 最佳实践 - -- 在提示中提供明确的路由标准 -- 使用具体且描述性的目标块名称 -- 为每个路由路径包含内容示例 -- 使用较低的温度值以确保路由一致性 -- 使用多样化的输入类型进行测试以确保路由准确性 -- 为边缘情况考虑备用路径 \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/blocks/starter.mdx b/apps/docs/content/docs/zh/yaml/blocks/starter.mdx deleted file mode 100644 index 1174a20b59..0000000000 --- a/apps/docs/content/docs/zh/yaml/blocks/starter.mdx +++ /dev/null @@ -1,183 +0,0 @@ ---- -title: Starter Block YAML 架构 -description: Starter Block 的 YAML 配置参考 ---- - -## 架构定义 - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [starter] - description: Block type identifier - name: - type: string - description: Display name for this starter block - inputs: - type: object - properties: - startWorkflow: - type: string - enum: [manual, webhook, schedule] - description: How the workflow should be triggered - default: manual - inputFormat: - type: array - description: Expected input structure for API calls (manual workflows) - items: - type: object - properties: - name: - type: string - description: Field name - type: - type: string - enum: [string, number, boolean, object, array] - description: Field type - scheduleType: - type: string - enum: [hourly, daily, weekly, monthly] - description: Schedule frequency (schedule workflows only) - hourlyMinute: - type: number - minimum: 0 - maximum: 59 - description: Minute of the hour to run (hourly schedules) - dailyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (daily schedules) - weeklyDay: - type: string - enum: [MON, TUE, WED, THU, FRI, SAT, SUN] - description: Day of week to run (weekly schedules) - weeklyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (weekly schedules) - monthlyDay: - type: number - minimum: 1 - maximum: 28 - description: Day of month to run (monthly schedules) - monthlyTime: - type: string - pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$" - description: Time of day to run in HH:MM format (monthly schedules) - timezone: - type: string - description: Timezone for scheduled workflows - default: UTC - webhookProvider: - type: string - enum: [slack, gmail, airtable, telegram, generic, whatsapp, github, discord, stripe] - description: Provider for webhook integration (webhook workflows only) - webhookConfig: - type: object - description: Provider-specific webhook configuration - connections: - type: object - properties: - success: - type: string - description: Target block ID to execute when workflow starts -``` - -## 连接配置 - -Starter Block 只有一个成功连接,因为它是入口点: - -```yaml -connections: - success: # Target block ID to execute when workflow starts -``` - -## 示例 - -### 手动启动 - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: next-block -``` - -### 带输入格式的手动启动 - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: manual - inputFormat: - - name: query - type: string - - name: email - type: string - - name: age - type: number - - name: isActive - type: boolean - - name: preferences - type: object - - name: tags - type: array - connections: - success: agent-1 -``` - -### 每日计划 - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: schedule - scheduleType: daily - dailyTime: "09:00" - timezone: "America/New_York" - connections: - success: daily-task -``` - -### 每周计划 - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: schedule - scheduleType: weekly - weeklyDay: MON - weeklyTime: "08:30" - timezone: UTC - connections: - success: weekly-report -``` - -### Webhook 触发器 - -```yaml -start: - type: starter - name: Start - inputs: - startWorkflow: webhook - webhookProvider: slack - webhookConfig: - # Provider-specific configuration - connections: - success: process-webhook -``` \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/blocks/webhook.mdx b/apps/docs/content/docs/zh/yaml/blocks/webhook.mdx deleted file mode 100644 index 161ae25432..0000000000 --- a/apps/docs/content/docs/zh/yaml/blocks/webhook.mdx +++ /dev/null @@ -1,403 +0,0 @@ ---- -title: Webhook 块 YAML 模式 -description: Webhook 块的 YAML 配置参考 ---- - -## 模式定义 - -```yaml -type: object -required: - - type - - name -properties: - type: - type: string - enum: [webhook] - description: Block type identifier - name: - type: string - description: Display name for this webhook block - inputs: - type: object - properties: - webhookConfig: - type: object - description: Webhook configuration settings - properties: - enabled: - type: boolean - description: Whether the webhook is active - default: true - secret: - type: string - description: Secret key for webhook verification - headers: - type: array - description: Expected headers for validation as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Expected header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column - methods: - type: array - description: Allowed HTTP methods - items: - type: string - enum: [GET, POST, PUT, DELETE, PATCH] - default: [POST] - responseConfig: - type: object - description: Response configuration for the webhook - properties: - status: - type: number - description: HTTP status code to return - default: 200 - minimum: 100 - maximum: 599 - headers: - type: array - description: Response headers as table entries - items: - type: object - properties: - id: - type: string - description: Unique identifier for the header entry - key: - type: string - description: Header name - value: - type: string - description: Header value - cells: - type: object - description: Cell display values for the table interface - properties: - Key: - type: string - description: Display value for the key column - Value: - type: string - description: Display value for the value column - body: - type: string - description: Response body content - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful webhook processing - error: - type: string - description: Target block ID for error handling -``` - -## 连接配置 - -连接定义了基于 Webhook 处理的工作流走向: - -```yaml -connections: - success: # Target block ID for successful processing - error: # Target block ID for error handling (optional) -``` - -## 示例 - -### 基本 Webhook 触发器 - -```yaml -github-webhook: - type: webhook - name: "GitHub Webhook" - inputs: - webhookConfig: - enabled: true - secret: "{{GITHUB_WEBHOOK_SECRET}}" - methods: [POST] - headers: - - key: "X-GitHub-Event" - value: "push" - responseConfig: - status: 200 - body: | - { - "message": "Webhook received successfully", - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: process-github-event - error: webhook-error-handler -``` - -### Slack 事件 Webhook - -```yaml -slack-events: - type: webhook - name: "Slack Events" - inputs: - webhookConfig: - enabled: true - secret: "{{SLACK_SIGNING_SECRET}}" - methods: [POST] - headers: - - key: "Content-Type" - value: "application/json" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "challenge": "" - } - connections: - success: handle-slack-event -``` - -### 支付 Webhook (Stripe) - -```yaml -stripe-webhook: - type: webhook - name: "Stripe Payment Webhook" - inputs: - webhookConfig: - enabled: true - secret: "{{STRIPE_WEBHOOK_SECRET}}" - methods: [POST] - headers: - - key: "Stripe-Signature" - value: "*" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "received": true - } - connections: - success: process-payment-event - error: payment-webhook-error -``` - -### 带完整表头格式的 Webhook - -当通过 UI 表格界面创建表头时,YAML 包含额外的元数据: - -```yaml -api-webhook-complete: - type: webhook - name: "API Webhook with Table Headers" - inputs: - webhookConfig: - enabled: true - methods: [POST] - headers: - - id: header-1-uuid-here - key: "Authorization" - value: "Bearer {{WEBHOOK_API_KEY}}" - cells: - Key: "Authorization" - Value: "Bearer {{WEBHOOK_API_KEY}}" - - id: header-2-uuid-here - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - responseConfig: - status: 200 - headers: - - id: response-header-1-uuid - key: "Content-Type" - value: "application/json" - cells: - Key: "Content-Type" - Value: "application/json" - - id: response-header-2-uuid - key: "X-Webhook-Response" - value: "processed" - cells: - Key: "X-Webhook-Response" - Value: "processed" - body: | - { - "status": "received", - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: process-webhook-complete -``` - -### 通用 API Webhook - -```yaml -api-webhook: - type: webhook - name: "API Webhook" - inputs: - webhookConfig: - enabled: true - methods: [POST, PUT] - headers: - - key: "Authorization" - value: "Bearer {{WEBHOOK_API_KEY}}" - - key: "Content-Type" - value: "application/json" - responseConfig: - status: 202 - headers: - - key: "Content-Type" - value: "application/json" - - key: "X-Processed-By" - value: "Sim" - body: | - { - "status": "accepted", - "id": "{{Math.random().toString(36).substr(2, 9)}}", - "received_at": "{{new Date().toISOString()}}" - } - connections: - success: process-webhook-data -``` - -### 多方法 Webhook - -```yaml -crud-webhook: - type: webhook - name: "CRUD Webhook" - inputs: - webhookConfig: - enabled: true - methods: [GET, POST, PUT, DELETE] - headers: - - key: "X-API-Key" - value: "{{CRUD_API_KEY}}" - responseConfig: - status: 200 - headers: - - key: "Content-Type" - value: "application/json" - body: | - { - "method": "", - "processed": true, - "timestamp": "{{new Date().toISOString()}}" - } - connections: - success: route-by-method -``` - -## 表格参数格式 - -Webhook 块支持两种表头格式(包括验证表头和响应表头): - -### 简化格式(手动 YAML) - -在手动编写 YAML 时,可以使用简化格式: - -```yaml -headers: - - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - - key: "Content-Type" - value: "application/json" -``` - -### 完整表格格式(由 UI 生成) - -当通过 UI 表格界面创建表头时,YAML 包含额外的元数据: - -```yaml -headers: - - id: unique-identifier-here - key: "Authorization" - value: "Bearer {{API_TOKEN}}" - cells: - Key: "Authorization" - Value: "Bearer {{API_TOKEN}}" -``` - -**主要区别:** -- `id`:用于跟踪表格行的唯一标识符 -- `cells`:UI 表格界面使用的显示值 -- 两种格式在 webhook 处理方面功能等效 -- 完整格式在导入/导出工作流时保留 UI 状态 - -**重要提示:** 始终为包含特殊字符的表头名称和值加上引号: - -```yaml -headers: - - id: auth-header-uuid - cells: - Key: "Authorization" - Value: "Bearer {{WEBHOOK_API_KEY}}" - - id: content-type-uuid - cells: - Key: "Content-Type" - Value: "application/json" -``` - -## Webhook 变量 - -在 webhook 触发的工作流中,可用以下特殊变量: - -```yaml -# Available in blocks after the webhook - # Full request payload/body - # Request headers - # HTTP method used - # Query parameters - # Request path - # Challenge parameter (for verification) -``` - -## 输出引用 - -在 webhook 处理请求后,您可以引用其数据: - -```yaml -# In subsequent blocks -process-webhook: - inputs: - payload: # Request payload - headers: # Request headers - method: # HTTP method -``` - -## 安全最佳实践 - -- 始终使用 webhook 密钥进行验证 -- 验证预期的表头和方法 -- 实现适当的错误处理 -- 在生产环境中使用 HTTPS 端点 -- 监控 webhook 活动和失败情况 -- 设置适当的响应超时时间 -- 在处理之前验证有效负载结构 \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/blocks/workflow.mdx b/apps/docs/content/docs/zh/yaml/blocks/workflow.mdx deleted file mode 100644 index 223c4818af..0000000000 --- a/apps/docs/content/docs/zh/yaml/blocks/workflow.mdx +++ /dev/null @@ -1,299 +0,0 @@ ---- -title: 工作流块 YAML 模式 -description: 工作流块的 YAML 配置参考 ---- - -## 模式定义 - -```yaml -type: object -required: - - type - - name - - inputs -properties: - type: - type: string - enum: [workflow] - description: Block type identifier - name: - type: string - description: Display name for this workflow block - inputs: - type: object - required: - - workflowId - properties: - workflowId: - type: string - description: ID of the workflow to execute - inputMapping: - type: object - description: Map current workflow data to sub-workflow inputs - additionalProperties: - type: string - description: Input value or reference to parent workflow data - environmentVariables: - type: object - description: Environment variables to pass to sub-workflow - additionalProperties: - type: string - description: Environment variable value - timeout: - type: number - description: Maximum execution time in milliseconds - default: 300000 - minimum: 1000 - maximum: 1800000 - connections: - type: object - properties: - success: - type: string - description: Target block ID for successful workflow completion - error: - type: string - description: Target block ID for error handling -``` - -## 连接配置 - -连接定义了根据子工作流结果工作流的走向: - -```yaml -connections: - success: # Target block ID for successful completion - error: # Target block ID for error handling (optional) -``` - -## 示例 - -### 简单工作流执行 - -```yaml -data-processor: - type: workflow - name: "Data Processing Workflow" - inputs: - workflowId: "data-processing-v2" - inputMapping: - rawData: - userId: - environmentVariables: - PROCESSING_MODE: "production" - LOG_LEVEL: "info" - connections: - success: process-results - error: workflow-error-handler -``` - -### 内容生成管道 - -```yaml -content-generator: - type: workflow - name: "Content Generation Pipeline" - inputs: - workflowId: "content-generation-v3" - inputMapping: - topic: - style: - targetAudience: - brandGuidelines: - environmentVariables: - CONTENT_API_KEY: "{{CONTENT_API_KEY}}" - QUALITY_THRESHOLD: "high" - timeout: 120000 - connections: - success: review-content - error: content-generation-failed -``` - -### 多步骤分析工作流 - -```yaml -analysis-workflow: - type: workflow - name: "Analysis Workflow" - inputs: - workflowId: "comprehensive-analysis" - inputMapping: - document: - analysisType: "comprehensive" - includeMetrics: true - outputFormat: "structured" - environmentVariables: - ANALYSIS_MODEL: "gpt-4o" - OPENAI_API_KEY: "{{OPENAI_API_KEY}}" - CLAUDE_API_KEY: "{{CLAUDE_API_KEY}}" - connections: - success: compile-analysis-report - error: analysis-workflow-error -``` - -### 条件工作流执行 - -```yaml -customer-workflow-router: - type: condition - name: "Customer Workflow Router" - inputs: - conditions: - if: === "enterprise" - else-if: === "premium" - else: true - connections: - conditions: - if: enterprise-workflow - else-if: premium-workflow - else: standard-workflow - -enterprise-workflow: - type: workflow - name: "Enterprise Customer Workflow" - inputs: - workflowId: "enterprise-customer-processing" - inputMapping: - customerData: - accountManager: - tier: "enterprise" - environmentVariables: - PRIORITY_LEVEL: "high" - SLA_REQUIREMENTS: "strict" - connections: - success: enterprise-complete - -premium-workflow: - type: workflow - name: "Premium Customer Workflow" - inputs: - workflowId: "premium-customer-processing" - inputMapping: - customerData: - supportLevel: "premium" - environmentVariables: - PRIORITY_LEVEL: "medium" - connections: - success: premium-complete - -standard-workflow: - type: workflow - name: "Standard Customer Workflow" - inputs: - workflowId: "standard-customer-processing" - inputMapping: - customerData: - environmentVariables: - PRIORITY_LEVEL: "standard" - connections: - success: standard-complete -``` - -### 并行工作流执行 - -```yaml -parallel-workflows: - type: parallel - name: "Parallel Workflow Processing" - inputs: - parallelType: collection - collection: | - [ - {"workflowId": "sentiment-analysis", "focus": "sentiment"}, - {"workflowId": "topic-extraction", "focus": "topics"}, - {"workflowId": "entity-recognition", "focus": "entities"} - ] - connections: - success: merge-workflow-results - -execute-analysis-workflow: - type: workflow - name: "Execute Analysis Workflow" - parentId: parallel-workflows - inputs: - workflowId: - inputMapping: - content: - analysisType: - environmentVariables: - ANALYSIS_API_KEY: "{{ANALYSIS_API_KEY}}" - connections: - success: workflow-complete -``` - -### 错误处理工作流 - -```yaml -main-workflow: - type: workflow - name: "Main Processing Workflow" - inputs: - workflowId: "main-processing-v1" - inputMapping: - data: - timeout: 180000 - connections: - success: main-complete - error: error-recovery-workflow - -error-recovery-workflow: - type: workflow - name: "Error Recovery Workflow" - inputs: - workflowId: "error-recovery-v1" - inputMapping: - originalInput: - errorDetails: - failureTimestamp: "{{new Date().toISOString()}}" - environmentVariables: - RECOVERY_MODE: "automatic" - FALLBACK_ENABLED: "true" - connections: - success: recovery-complete - error: manual-intervention-required -``` - -## 输入映射 - -将数据从父工作流映射到子工作流: - -```yaml -inputMapping: - # Static values - mode: "production" - version: "1.0" - - # References to parent workflow data - userData: - settings: - - # Complex object mapping - requestData: - id: - timestamp: "{{new Date().toISOString()}}" - source: "parent-workflow" -``` - -## 输出引用 - -在工作流块完成后,您可以引用其输出: - -```yaml -# In subsequent blocks -next-block: - inputs: - workflowResult: # Sub-workflow output - executionTime: # Execution duration - status: # Execution status -``` - -## 最佳实践 - -- 使用描述性工作流 ID 以提高清晰度 -- 仅映射必要的数据到子工作流 -- 根据工作流的复杂性设置适当的超时时间 -- 包含错误处理以确保执行的稳健性 -- 安全地传递环境变量 -- 先独立测试子工作流 -- 监控嵌套工作流的性能 -- 使用版本化的工作流 ID 以确保稳定性 \ No newline at end of file diff --git a/apps/docs/content/docs/zh/yaml/examples.mdx b/apps/docs/content/docs/zh/yaml/examples.mdx deleted file mode 100644 index 25c4f572da..0000000000 --- a/apps/docs/content/docs/zh/yaml/examples.mdx +++ /dev/null @@ -1,273 +0,0 @@ ---- -title: YAML 工作流示例 -description: 完整的 YAML 工作流示例 ---- - -import { Tab, Tabs } from 'fumadocs-ui/components/tabs' - -## 多代理链式工作流 - -一个由多个 AI 代理依次处理信息的工作流: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: agent-1-initiator - - agent-1-initiator: - type: agent - name: Agent 1 Initiator - inputs: - systemPrompt: You are the first agent in a chain. Your role is to analyze the input and create an initial response that will be passed to the next agent. - userPrompt: |- - Welcome! I'm the first agent in our chain. - - Input to process: - - Please create an initial analysis or greeting that the next agent can build upon. Be creative and set a positive tone for the chain! - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-2-enhancer - - agent-2-enhancer: - type: agent - name: Agent 2 Enhancer - inputs: - systemPrompt: You are the second agent in a chain. Take the output from Agent 1 and enhance it with additional insights or improvements. - userPrompt: |- - I'm the second agent! Here's what Agent 1 provided: - - - - Now I'll enhance this with additional details, insights, or improvements. Let me build upon their work! - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-3-refiner - - agent-3-refiner: - type: agent - name: Agent 3 Refiner - inputs: - systemPrompt: You are the third agent in a chain. Take the enhanced output from Agent 2 and refine it further, adding structure or organization. - userPrompt: |- - I'm the third agent in our chain! Here's the enhanced work from Agent 2: - - - - My job is to refine and organize this content. I'll add structure, clarity, and polish to make it even better! - model: gpt-4o - temperature: 0.6 - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: agent-4-finalizer - - agent-4-finalizer: - type: agent - name: Agent 4 Finalizer - inputs: - systemPrompt: You are the final agent in a chain of 4. Create a comprehensive summary and conclusion based on all the previous agents' work. - userPrompt: |- - I'm the final agent! Here's the refined work from Agent 3: - - - - As the last agent in our chain, I'll create a final, polished summary that brings together all the work from our team of 4 agents. Let me conclude this beautifully! - model: gpt-4o - temperature: 0.5 - apiKey: '{{OPENAI_API_KEY}}' -``` - -## 基于路由的条件工作流 - -一个使用路由逻辑根据条件将数据发送到不同代理的工作流: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: router-1 - - router-1: - type: router - name: Router 1 - inputs: - prompt: go to agent 1 if is greater than 5. else agent 2 if greater than 10. else agent 3 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: - - agent-1 - - agent-2 - - agent-3 - - agent-1: - type: agent - name: Agent 1 - inputs: - systemPrompt: say 1 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - - agent-2: - type: agent - name: Agent 2 - inputs: - systemPrompt: say 2 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - - agent-3: - type: agent - name: Agent 3 - inputs: - systemPrompt: say 3 - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## 带结构化输出的网页搜索 - -一个使用工具搜索网页并返回结构化数据的工作流: - -```yaml -version: '1.0' -blocks: - 59eb07c1-1411-4b28-a274-fa78f55daf72: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: d77c2c98-56c4-432d-9338-9bac54a2d42f - d77c2c98-56c4-432d-9338-9bac54a2d42f: - type: agent - name: Agent 1 - inputs: - systemPrompt: look up the user input. use structured output - userPrompt: - model: claude-sonnet-4-0 - apiKey: '{{ANTHROPIC_API_KEY}}' - tools: - - type: exa - title: Exa - params: - type: auto - apiKey: '{{EXA_API_KEY}}' - numResults: '' - toolId: exa_search - operation: exa_search - isExpanded: true - usageControl: auto - responseFormat: |- - { - "name": "output_schema", - "description": "Defines the structure for an output object.", - "strict": true, - "schema": { - "type": "object", - "properties": { - "output": { - "type": "string", - "description": "The output value" - } - }, - "additionalProperties": false, - "required": ["output"] - } - } -``` - -## 使用循环处理集合 - -一个通过循环处理集合中每个项目的工作流: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: food-analysis-loop - food-analysis-loop: - type: loop - name: Food Analysis Loop - inputs: - count: 5 - loopType: forEach - collection: '["apple", "banana", "carrot"]' - connections: - loop: - start: calorie-agent - calorie-agent: - type: agent - name: Calorie Analyzer - inputs: - systemPrompt: Return the number of calories in the food - userPrompt: - model: claude-sonnet-4-0 - apiKey: '{{ANTHROPIC_API_KEY}}' - parentId: food-analysis-loop -``` - -## 邮件分类与回复 - -一个对邮件进行分类并生成适当回复的工作流: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: email-classifier - - email-classifier: - type: agent - name: Email Classifier - inputs: - systemPrompt: Classify emails into categories and extract key information. - userPrompt: | - Classify this email: - - Categories: support, billing, sales, feedback - Extract: urgency level, customer sentiment, main request - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' - connections: - success: response-generator - - response-generator: - type: agent - name: Response Generator - inputs: - systemPrompt: Generate appropriate responses based on email classification. - userPrompt: | - Email classification: - Original email: - - Generate a professional, helpful response addressing the customer's needs. - model: gpt-4o - temperature: 0.7 - apiKey: '{{OPENAI_API_KEY}}' -``` diff --git a/apps/docs/content/docs/zh/yaml/index.mdx b/apps/docs/content/docs/zh/yaml/index.mdx deleted file mode 100644 index 79da292f30..0000000000 --- a/apps/docs/content/docs/zh/yaml/index.mdx +++ /dev/null @@ -1,159 +0,0 @@ ---- -title: YAML 工作流参考 -description: Sim 中编写 YAML 工作流的完整指南 ---- - -import { Card, Cards } from "fumadocs-ui/components/card"; -import { Step, Steps } from "fumadocs-ui/components/steps"; -import { Tab, Tabs } from "fumadocs-ui/components/tabs"; - -YAML 工作流为在 Sim 中定义、版本化和共享工作流配置提供了一种强大的方式。本参考指南涵盖了完整的 YAML 语法、块模式以及创建健壮工作流的最佳实践。 - -## 快速开始 - -每个 Sim 工作流都遵循以下基本结构: - -```yaml -version: '1.0' -blocks: - start: - type: starter - name: Start - inputs: - startWorkflow: manual - connections: - success: agent-1 - - agent-1: - type: agent - name: "AI Assistant" - inputs: - systemPrompt: "You are a helpful assistant." - userPrompt: 'Hi' - model: gpt-4o - apiKey: '{{OPENAI_API_KEY}}' -``` - -## 核心概念 - - - - 版本声明:必须精确为 `version: '1.0'`(带引号) - - - 块结构:所有工作流块都定义在 `blocks` 键下 - - - 块引用:使用小写且去掉空格的块名称(例如,``) - - - 环境变量:使用双大括号引用 `{{VARIABLE_NAME}}` - - - -## 块类型 - -Sim 支持多种核心块类型,每种类型都有特定的 YAML 模式: - - - - 工作流的入口点,支持手动、Webhook 和定时触发器 - - - 支持工具和结构化输出的 AI 驱动处理 - - - 自定义 JavaScript/TypeScript 代码执行 - - - 向外部服务发送 HTTP 请求 - - - 基于布尔表达式的条件分支 - - - AI 驱动的智能路由到多个路径 - - - 使用 for 和 forEach 循环进行迭代处理 - - - 在多个实例间并发执行 - - - 用于外部集成的 Webhook 触发器 - - - 根据定义的标准和指标验证输出 - - - 将其他工作流作为可重用组件执行 - - - 最终工作流输出格式化 - - - -## 块引用语法 - -YAML 工作流中最关键的部分是理解如何在块之间引用数据: - -### 基本规则 - -1. **使用块名称**(而不是块 ID),将其转换为小写并去掉空格 -2. **添加适当的属性**(对于代理使用 .content,对于工具使用 .output) -3. **在使用聊天时,引用起始块**为 `` - -### 示例 - -```yaml -# Block definitions -email-processor: - type: agent - name: "Email Agent" - # ... configuration - -data-formatter: - type: function - name: "Data Agent" - # ... configuration - -# Referencing their outputs -next-block: - type: agent - name: "Next Step" - inputs: - userPrompt: | - Process this email: - Use this formatted data: - Original input: -``` - -### 特殊情况 - -- **循环变量**:``、``、`` -- **并行变量**:``、`` - -## 环境变量 - -使用环境变量存储敏感数据,例如 API 密钥: - -```yaml -inputs: - apiKey: '{{OPENAI_API_KEY}}' - database: '{{DATABASE_URL}}' - token: '{{SLACK_BOT_TOKEN}}' -``` - -## 最佳实践 - -- **保持块名称易于阅读**:例如用于 UI 显示的 "Email Processor" -- **引用环境变量**:切勿硬编码 API 密钥 -- **结构清晰可读**:逻辑分组相关块 -- **逐步测试**:逐步构建工作流 - -## 下一步 - -- [块引用语法](/yaml/block-reference) - 详细的引用规则 -- [完整的块模式](/yaml/blocks) - 所有可用的块类型 -- [工作流示例](/yaml/examples) - 真实的工作流模式 \ No newline at end of file diff --git a/apps/docs/i18n.lock b/apps/docs/i18n.lock index 4ef71f624c..f2772e0ac8 100644 --- a/apps/docs/i18n.lock +++ b/apps/docs/i18n.lock @@ -228,7 +228,7 @@ checksums: content/12: 8f5b5d43297c4ff114ca49395878292b 73129cc41f543288d67924faea3172db: meta/title: 8cbe02c3108a0dbe0586dbc18db04efe - meta/description: 43beda72c15313c4d1bd1183a6c83c57 + meta/description: 9540ac7731cebd594afa4ce2fb59ab9d content/0: 1b031fb0c62c46b177aeed5c3d3f8f80 content/1: 7bc3f27360dbfe215a3f4b67efbf253f content/2: 727302388d840298cdfe4baf4d867cd4 @@ -236,7 +236,7 @@ checksums: content/4: 9a642ef8acbba0fa362ff638cfe4ceee content/5: b962ad29fed1eaefbcc92b494dae426f content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: d343f6bd44acbb151aa01becf3e575fc + content/7: fac604797e4c3f02358cd9061e0d6738 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: ae20955b8ab6f7dc9af9f5a2f3dcc021 content/10: 221bb6ebd96fbe6dee87e249e9efeb56 @@ -244,8 +244,32 @@ checksums: content/12: 45c148fb7cd6e0143ce79c3113de95dc content/13: bcadfc362b69078beee0088e5936c98b content/14: 2b6fd595e0082e2f859eaf87207b4850 - content/15: b3f310d5ef115bea5a8b75bf25d7ea9a - content/16: 9f8b3ebb53dbde8abfb139b4a8bc0396 + content/15: 520df500d98af98029baab024cbc7f99 + content/16: a8798f038ca2649b33065546da420db9 + content/17: 371d0e46b4bd2c23f559b8bc112f6955 + content/18: 760bf27dabbee1672f3915714300c81c + content/19: bcadfc362b69078beee0088e5936c98b + content/20: 8350971da62df78a5eefbd347ece560e + content/21: aecc6b73e67f9e27bfb79bda541f1940 + content/22: 25a88e864ff73e906b0ba0ed01c09a5f + content/23: 371d0e46b4bd2c23f559b8bc112f6955 + content/24: 1efb19693da72b640bed069a2da79bd8 + content/25: bcadfc362b69078beee0088e5936c98b + content/26: 17bb05ffcff0a4f8d9c86cdfd7c48f0c + content/27: ef793ba00eb1dd18d978ade2e430a0c3 + content/28: 366f7c5a8ca971c18edbb9dd97c73ba1 + content/29: 371d0e46b4bd2c23f559b8bc112f6955 + content/30: 135fd99536465a8de4cd18eae682128f + content/31: bcadfc362b69078beee0088e5936c98b + content/32: e4824dd7acff8ac2bba07075c1bf5555 + content/33: 29d730395e60843523997a5440265c2b + content/34: f40cf8dcdbca5bdabddd2ccafe510827 + content/35: 371d0e46b4bd2c23f559b8bc112f6955 + content/36: fb04fb808287bc585c7bef1622cc5929 + content/37: bcadfc362b69078beee0088e5936c98b + content/38: 766eb78674c8d8a40cfd13eca533b7a4 + content/39: b3f310d5ef115bea5a8b75bf25d7ea9a + content/40: 9f8b3ebb53dbde8abfb139b4a8bc0396 31b5f846eb7f4b1751b4bd9233cc3e12: meta/title: dc96f9cb0985d77c30f55927723f0175 meta/description: 15c7d592f04655f534458cd82180ba1f @@ -257,7 +281,7 @@ checksums: content/5: fa646905bb0092015a9f52e4b154266a content/6: 9614484b88031316ce9a65c8d833e061 content/7: 821e6394b0a953e2b0842b04ae8f3105 - content/8: 35f20df09c887523efd87e9189ff323d + content/8: b9bba2dc7a2ad28569f28d18f97fb757 content/9: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/10: a7cd3ceb9da0d9bd6c57be8d119a87c9 content/11: 306d5dd97f0814bdfe5ba376e9062b5d @@ -360,7 +384,7 @@ checksums: content/4: c23e0794ecd7dd114eadb0159356c6c2 content/5: 90321be8691461312892d3e90fe25822 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 6e21bfc6987123c552772c77a0d0c99b + content/7: 17c828ff164f8fb5e942b38a806ca614 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 67a62dceeed227ec4675f8f77492dde2 content/10: 99bdff60b8642b7cb4097177ac6a48dc @@ -410,7 +434,7 @@ checksums: content/4: 63962344325f84cfcca7995a249a5fba content/5: 5791f0e5a6ec8c743536cfe7cb16233d content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 59b5e40237580bedf3a15364da0a8d5e + content/7: 2e29a28130b505a54e8488221fd079ab content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 10ec1e8eaecc6f3d30cfa63749e968b7 content/10: f4b856e774ec5e995c437201d22036ee @@ -519,7 +543,7 @@ checksums: content/16: 6858732ac08a51da710a6c405c3a0c58 83c85dff230a9333693653c8f75ca1c7: meta/title: 0719cb55ded3146892d106733a8431b2 - meta/description: 1e7333e4b816fea698161d8f21f13e20 + meta/description: 390e6d45014e6a7b466c7bcdb2cc24c0 content/0: 1b031fb0c62c46b177aeed5c3d3f8f80 content/1: f08d6595f6452ac5ade1a669628d4307 content/2: 6801f0cd19ad1016e50b33948222c1f3 @@ -532,16 +556,46 @@ checksums: content/9: 3c8ea9c9a1f8f06c774435bde2f9a698 content/10: 20afe174a7fa74b75ccc3e9b338c9c6f content/11: 821e6394b0a953e2b0842b04ae8f3105 - content/12: 4f1ff9b7418be745a2ec334c4c278f06 + content/12: 2392251160192f79987dfb224e52cdc9 content/13: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/14: e9c27829906bbebeb8f83cae2f501f01 content/15: 64b080aca78df204b5199d0f1f7f1c1d content/16: 371d0e46b4bd2c23f559b8bc112f6955 content/17: cec63e3cddf1a94994b33df4b7306f81 content/18: bcadfc362b69078beee0088e5936c98b - content/19: e198cca68d05dbafb8f860005ed789d1 - content/20: b3f310d5ef115bea5a8b75bf25d7ea9a - content/21: e1fa627fb51f09989752a9bddf0ebb58 + content/19: 13adc939ffc5d5962dc924d875e1ae9d + content/20: caffd1f968e255dce6534076d6795ff8 + content/21: a6762b0a497e4cd6d74550bf741517fb + content/22: 371d0e46b4bd2c23f559b8bc112f6955 + content/23: 2adfbc82a33bede5965996bacd271eed + content/24: bcadfc362b69078beee0088e5936c98b + content/25: 546c94908c8c1a5735c1c7b3404eb555 + content/26: 90273144fdcdd38662d86ad54505b2bb + content/27: e558457ae774e3c5371d972da8953157 + content/28: 371d0e46b4bd2c23f559b8bc112f6955 + content/29: 5ff467b610705d806b5ff818b32d818b + content/30: bcadfc362b69078beee0088e5936c98b + content/31: 0e03f35f5e4173f6dfaa1598e97a204a + content/32: c669d0e2e834ffbb2997965632b4f24d + content/33: 6c5b6324398192b225bf0942a43871ca + content/34: 371d0e46b4bd2c23f559b8bc112f6955 + content/35: 233895366e74908d2713c0823cfdaf14 + content/36: bcadfc362b69078beee0088e5936c98b + content/37: 8779f29ccc257e421d64c071949b81fb + content/38: c1c91d6df039d31649b3d38ef731488d + content/39: b220570b491b3067e0936472c02d0371 + content/40: 371d0e46b4bd2c23f559b8bc112f6955 + content/41: 3a3adf0245b681baad4057d6c93e0305 + content/42: bcadfc362b69078beee0088e5936c98b + content/43: 5263cccc9350b39bf499158dcf317263 + content/44: 5b98959068e6d4728e268a4fd8954b5e + content/45: 21f62cff3caafb74117764cdab2147f4 + content/46: 371d0e46b4bd2c23f559b8bc112f6955 + content/47: f18d03fa59e3997a6d951e333d99c822 + content/48: bcadfc362b69078beee0088e5936c98b + content/49: 8779f29ccc257e421d64c071949b81fb + content/50: b3f310d5ef115bea5a8b75bf25d7ea9a + content/51: e1fa627fb51f09989752a9bddf0ebb58 ac9313ccf1478cdf17fe25081b6b78be: meta/title: df20085ae7dc009c9b6532113064c6bb meta/description: 0a0c4af79216512ddc68df973afed52c @@ -591,7 +645,7 @@ checksums: content/17: 88ae2285d728c80937e1df8194d92c60 content/18: cb8a6d5bf54beed29f0809f80b27648d content/19: 371d0e46b4bd2c23f559b8bc112f6955 - content/20: e42d42daae0fad4a419f1b218b05fa4e + content/20: cdbe4726ca8dd4bb6a013055e14117f5 content/21: bcadfc362b69078beee0088e5936c98b content/22: 5c59a9fe4d16c81655acd350d08a052e content/23: 7d96d99e45880195ccbd34bddaac6319 @@ -615,7 +669,7 @@ checksums: content/41: 16f5fe78076e326d643c194312c730a5 content/42: 5d1098c4ada4a79ade1464bd8853fc9e content/43: 371d0e46b4bd2c23f559b8bc112f6955 - content/44: 5458d0069b1aec09a110fadf860dfc8a + content/44: b37f6692238f3a45bfcf106f0d192b21 content/45: bcadfc362b69078beee0088e5936c98b content/46: 1788748095a805b62a0e21403789dad7 content/47: b3f310d5ef115bea5a8b75bf25d7ea9a @@ -630,7 +684,7 @@ checksums: content/4: 0dc119884f651b204d99120ee4cf18b8 content/5: e22fa3c615bb36030a895b27eb7980f3 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 44c6d0b2012f2f34d88f2eed80724255 + content/7: 38a998638c8159412c7297e0d1f1884f content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: b09ace13f48c17268148d1602d105999 content/10: 553d5f0825e9d426b9753e64dd596872 @@ -650,7 +704,7 @@ checksums: content/4: 0cf4d7d650aec185fb41b3e92f507057 content/5: 3816dfaf26ed3afd7aff9090710024f1 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: f0128b95528a097c48c4ad98aadaa6d0 + content/7: e47a99fb84a6ba46b2f6bf91c26f842b content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 0f2701a070121f0abbbf8cc289652330 content/10: 18e01e99857573a423da69c5b4127487 @@ -673,7 +727,7 @@ checksums: content/7: ba78de4d6afab71c7f31fd95b7b6ad60 content/8: 4f085bd63503b33aa646596218de3a76 content/9: 821e6394b0a953e2b0842b04ae8f3105 - content/10: 3d42fce965b2876c3e083a4c95e5e3d3 + content/10: a5751a2c3edea7dd90c046aab3a4fa3b content/11: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/12: 8ee83eff32425b2c52929284e8485c20 content/13: 6cda87dc9837779f4572ed70b87a5654 @@ -761,7 +815,7 @@ checksums: content/4: b483f38b65f3d6480f56b132a1ac397f content/5: b3dc7d5d99dacec5674c2d7eb8b5754f content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 90fec3eb8bdccdaf637f72e7b5ddf358 + content/7: 324155a42076182acb56d9cdb86b8407 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 7e3d8ddfbab4b89712bdc11280206e01 content/10: 9a181be73ed0c3dacde435e084f00859 @@ -775,7 +829,7 @@ checksums: meta/title: a75428cb811bc50150cecde090a3a0d5 meta/description: 3a10eb581faaec784e5d637c65d6b146 content/0: 1b031fb0c62c46b177aeed5c3d3f8f80 - content/1: 7f46f325faa5cd50ff824bd7053a21e1 + content/1: 9f9dc0e0d7e2d840081299602b8267de content/2: 821e6394b0a953e2b0842b04ae8f3105 content/3: 7caef25f24f7384e2eb5091f6a6a084d content/4: b3f310d5ef115bea5a8b75bf25d7ea9a @@ -810,7 +864,7 @@ checksums: content/4: 11c2e5acc56bc1425141614a4e368719 content/5: 3d4387c5d3037048ebf79b98f5c1693a content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: e0cf337a465f1c5467a733e194a8b600 + content/7: 9378568b393150cf53b5ad8287b75b9f content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 1c39ec9b03033a7ddde7eed8aa9bafe6 content/10: 4329f0ec166634aef4dccd9e88d83eeb @@ -838,7 +892,7 @@ checksums: content/6: ce9accb7f60842dfe0b7370c4d91b2d5 content/7: 5b6a23935ed1a753045fb7093414dca1 content/8: 821e6394b0a953e2b0842b04ae8f3105 - content/9: 7e065741d8f68e2a07109d3cfc581416 + content/9: 4dc67d64be1e95ea23a94d988ca65466 content/10: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/11: 3d1fa348047e106f109373a93ea956f3 content/12: 3aefbef7b1dae4fe6b91a663f3a2a8e0 @@ -914,7 +968,7 @@ checksums: content/4: 7a39a2170e05513fcde970f9c254c45d content/5: 6e53ef77a94bf734dcc221c35c8a9d61 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 755a90e07a3bf3033b0fc2af3a137c9b + content/7: 0cff0cc1abf6edfc41a5fefe52b4e0af content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 459b96a12ae0ccf566c96f69d7f27de5 content/10: f64fe409b68c4125ada4b03024d2eb3f @@ -958,7 +1012,7 @@ checksums: content/4: 274d1fb1ae509dacebb118e5a8952f33 content/5: f0fc640b5d45cf93dd3620ce1b093aee content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: f4ce0f95bfb04117aaf88acf40042841 + content/7: 4eb3471462f5a9ba93dbc7dfe60a58d7 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 0aa23289864d03b6f5d117819d7adaa5 content/10: 2951a1f5a1290e356493eb5e3a98bead @@ -978,7 +1032,7 @@ checksums: content/4: 117884cc422b07394f6eba643e5e1bdc content/5: 5891dd6c177fb184b64522149925a8e6 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 0abb4827ee0d122066ce315a7d88ec9e + content/7: 2561d030fe2ec3f705af4270276c51e9 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 20bc24c91bb35da97e322a3c737a8d34 content/10: 8acc7f46c4164cf201c129957ca9630e @@ -998,7 +1052,7 @@ checksums: content/4: a428aeb79967c72a7a5d2175a205bde2 content/5: 226c90c96d29a6262fbaaaa6945be7a9 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 9335ca15fb899fdd5fd3c0b5a763bfc6 + content/7: 99b0de3dd2cb54bfbab31c7a5d0519da content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 822829fd1c0500496b72d5a0abafeb41 content/10: 4a8b7fc9ab62f88061e4b21ac5b10947 @@ -1036,7 +1090,7 @@ checksums: content/4: 4a2854d8bed529de9468d37bce3059c2 content/5: 52dca887a9d635aa2b74ac215eee8a7a content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 11fd2ef6ae2fc09dacb1d3890687608f + content/7: 686e2b0b8c15f271c8e81d1850d7346e content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 59ee189c9f2f4a84fe819dc7d36bb2ec content/10: 715136b3ee97910b6405ce2def4b5564 @@ -1057,7 +1111,7 @@ checksums: content/5: bcd65b6873b071b2831821ae39804ba9 content/6: 517dd4ba787691643cb3e929ca662fa9 content/7: 821e6394b0a953e2b0842b04ae8f3105 - content/8: 8d901a012f3f12d24821e4564d952a14 + content/8: b012f506c5556814c599055fa2e85d74 content/9: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/10: 6df7e096bafa5efda818db1ab65841fd content/11: 646990da68ff77ca02dd172f830f12f0 @@ -1091,7 +1145,7 @@ checksums: content/6: 85fe49270bd31c6b50b6a3c44299a085 content/7: 3b26b0428d985bb115fde9e7b03aec83 content/8: 821e6394b0a953e2b0842b04ae8f3105 - content/9: ed36ddf9316c387107dcd0cbccdd21bc + content/9: 8b5c91afb3af05efb200c854fa786712 content/10: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/11: 844ec45fdbdd7d02d0d641c09cac6587 content/12: 3da2fcbda99aa28c52736eb36f945a76 @@ -1231,7 +1285,7 @@ checksums: content/4: 7c6639b125ed3fc850b568ef8b8e5401 content/5: 0f29d04d25d7ec940a52caf2569e248e content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: ab76eeb9ccfd782e8943aaafb3e5d3a1 + content/7: 506a64ff5e3121af0d0cdef16cf3ff81 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: d991a1d8bb32bdeae893e410a431946c content/10: 39eb74af7b0b6cffbf8685131a431f7b @@ -1251,7 +1305,7 @@ checksums: content/4: a76c1ab5c6aa311c83d5cd9e24cba2f7 content/5: 4c67bf27d016fa3d435809e38c188539 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: cb99f3d4225c14690d381129d30d9350 + content/7: 2553efcfcd5a4a8d51a8f033401c2ddc content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 66821a30fb30695c77e7b0a6337979c1 content/10: 2b79e754c09db25e8eba249a66f4a1ca @@ -1289,7 +1343,7 @@ checksums: content/4: d72c202bcbb73408ad01c45504829637 content/5: 67682d62653b4e136aad655b6847aef4 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: e3f1b10e4c8967a2fe6d36a8c77ffa71 + content/7: a7ce4d58fd126bfbf2686ad68ed5a16a content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: c76a99515c28bf8536ec0c4ff74d69fa content/10: 842905c458442918b6560da383690710 @@ -1315,7 +1369,7 @@ checksums: content/4: 840a65d7676f756ba632bd7828c53024 content/5: 1ee7d3e935ef2c7c535da8c12ee25b56 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: ee07a194b32c29638a22d6ee521fd01d + content/7: 513b14c6b4501f4814c256edc9967883 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 5a447127a97cfcaa65d3b989fede92e5 content/10: d06a280df6a38b6a382231c8eb602d1d @@ -1381,7 +1435,7 @@ checksums: content/4: 1578d763fa803be6dac1d39a5496870d content/5: 08e0f277644f5bc8086e7931dc762256 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 2210632d8154520843065680cf190406 + content/7: a6947db24c3ee4c6d397b673e04ee245 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 1dbe0aefe027059f9b76731d876ced89 content/10: a8def7b512de41a1709abff120528c6a @@ -1413,7 +1467,7 @@ checksums: content/4: 758af3716235169c4cd3bf434ba7aeda content/5: f63b6cd7108f5337f9baeb6ee87410dc content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: b6cc290dad060d5f375d4082d48ef137 + content/7: e2489e1d2c2cd152ce6ed974c776818a content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: e0f4b23d8d63539477736aba2e05db1b content/10: c12731d11f702ac49f20aa8e67fc926f @@ -1427,14 +1481,14 @@ checksums: meta/title: 33bb376cf1a93dc6b2036c739a4362c2 meta/description: 5f2cac4736db1f268178e8bacb7877ed content/0: 1b031fb0c62c46b177aeed5c3d3f8f80 - content/1: e2f07b16f2952e1091f195d83ebac4b1 + content/1: c34dcf0bcd7f8b1e9ad5df7bd464fdab content/2: 082b06c7e8914e70851985b96bcb77fb content/3: 3bc0aea516e5a03daeea39f0e4da896c content/4: 89f48790cc2a9f716df9a848b319d810 content/5: 535e34d9695822e3c2c3730dc622f729 content/6: 3997fe3c3877bf91d4694a9b3ef32fe4 content/7: 821e6394b0a953e2b0842b04ae8f3105 - content/8: dd689f15c3d56b08e5f6e59b454554be + content/8: 59a8cba46cf9b3241919f56f8525610a content/9: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/10: dc0cd9ecdd8caafc0a4a7c60b68daa2f content/11: 67ffd9a9b55ad6c1259af98deafb5d0a @@ -1466,7 +1520,7 @@ checksums: content/10: 3b04588b480d6544f0229ce28b21224d content/11: 5f2cafef64da0c457716763f65d05caf content/12: 371d0e46b4bd2c23f559b8bc112f6955 - content/13: b823507e6f387b2daa1967b6d9b8a76a + content/13: 0e2601b609b4c95beada4bd76ca52322 content/14: bcadfc362b69078beee0088e5936c98b content/15: 9d5d5f979dc1f1a21c93f63bf2cb1adf content/16: 207fd9316e6f5f7c8f9ba48d4f5a7a7f @@ -1494,7 +1548,7 @@ checksums: content/5: d1c4450558c64b0daecbbebb1ef8d46d content/6: 1aaed8a1063b1af2cbae0ceb642739f0 content/7: 821e6394b0a953e2b0842b04ae8f3105 - content/8: 38f8763cd15d1e31efe7b22083e99f02 + content/8: 0a18a40bb5eae0dffedbc200af5f3f17 content/9: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/10: ac1c2fde5e6cc17fab123a65b33f89ab content/11: 2765ffecc34942a07ef0a9b97773bd65 @@ -1533,7 +1587,7 @@ checksums: content/5: 867a81c4ef2e604af37e72b80b7f60f4 content/6: e1c1b793f9d8fefc0620999502cc10c7 content/7: 821e6394b0a953e2b0842b04ae8f3105 - content/8: 73ad8dd826bffa87f08de78e66217b73 + content/8: d5d19fa5294c888119822347d79b0cd0 content/9: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/10: 1906031836f47631bfd5a944a07703ba content/11: de4cc9e2461685e5632c4c14f43480d8 @@ -1578,7 +1632,7 @@ checksums: content/4: a15021682f13db959d0aa64930e736da content/5: 22c19de4f5bd5e12b523aadc6536520c content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 405ae041c9f92e9a174ae074473e9d71 + content/7: 2766836fb1326a8ce0155f1625434aa2 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 1c35bd50d923457bbc6091c41f3db662 content/10: 4d2ede2a7587be9a4673aae664c83c0f @@ -1598,7 +1652,7 @@ checksums: content/4: 99cb887002d75f25f5b5abca98d9cdb3 content/5: f54cb2af7856dd698f0ec1e3774ecbb9 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 7f2d5487cccadf2e037bcc190947d1b9 + content/7: f09a83042ce38ece6be958575d077e50 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: a8f7f10c32de3da9bcbf154f947fd79c content/10: 79733f2becd4764339d419fa7a3d3f9b @@ -1647,7 +1701,7 @@ checksums: content/3: 5a2149dbe4ec4e628b72c925a86c5d9b content/4: 0ce7fe62b8305b7c330a00431754d317 content/5: 821e6394b0a953e2b0842b04ae8f3105 - content/6: e432eb36f8fef968def279abba411ff7 + content/6: 601b3ebc4c71a0cac2fd62fdac895226 content/7: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/8: 43fc45970edfe8248d3c3287b082f533 content/9: 19fe98e976f6b8bbd2f4d219d6bc959f @@ -1675,7 +1729,7 @@ checksums: content/12: 57dc28aaedac65a8d028471cede6054f content/13: 6eee2876f5c70d2c296da1cf82426efe content/14: 821e6394b0a953e2b0842b04ae8f3105 - content/15: c3aa743e41a7a1bfba185f3556579fc7 + content/15: 2258bc8c5950fc8c6744120af6e6fa91 content/16: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/17: ea3d2fb612b08ffe583e92ecd5b3025c content/18: a78936adb114037a8dee267d88abb603 @@ -1715,7 +1769,7 @@ checksums: content/6: cf7dace83e07f909a9e99214bceb71ff content/7: 4292edcddcf1a33b4237c4713a7d3dd2 content/8: 821e6394b0a953e2b0842b04ae8f3105 - content/9: b31e0431c2e7fb0dd65e3d6758f46a82 + content/9: 55884c8b268c6d0ac00e38b97b4a5d25 content/10: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/11: 0e9cf0b94c407d9e5dac6210ac6798b9 content/12: e91a5b730ab935e19f616f2fe442e53c @@ -1737,7 +1791,7 @@ checksums: content/6: 22c4d8ec3aa7238a5b6a14fcd5c8203a content/7: 1a38c2bc2522ee588bdefe841d85725b content/8: 821e6394b0a953e2b0842b04ae8f3105 - content/9: 1fe3f933e9fbd788f36a0101ac6cac4e + content/9: 0a48104682ca03979915726f662d32af content/10: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/11: 871d6ecf3f593f3b20f5c3c8ded1ecc6 content/12: 30072675a0dffbddc0e85bd3e34764ec @@ -1775,7 +1829,7 @@ checksums: content/10: c87b23da7d87c902cd766ba544347741 content/11: a428955d4200adf4ef051882fbfda4be content/12: 821e6394b0a953e2b0842b04ae8f3105 - content/13: 6b49597168545a029ee51eebd75d9396 + content/13: efa7204ba4251c8c166d2daaba431f2d content/14: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/15: 28fdb979dc45c74e876dac013363950c content/16: 99628639aa5575f231e2f052f06ba54d @@ -1807,7 +1861,7 @@ checksums: content/4: 660ecd7202376b3f16dd22da29a0b0a5 content/5: ce74ef8975c2f0254d732f6c42e8bab8 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 72b323f001bf0ea49a0e0a2bf9a7e84b + content/7: fca56375ce80122fe80f9faefdfc13e0 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 4094290e2d3e5a386eeb80bbfffdcb66 content/10: 1cf287e27ca91288eb3ddf06d67c1bbc @@ -1851,7 +1905,7 @@ checksums: content/4: 43a861224ba3878d8319e8b1827dbf80 content/5: 41e36dde12831a07df361eb8a769f657 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 21228bd2e3ca75844abc217714e6c216 + content/7: 4725897e3a454b1dcf6e496795b7a87a content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 59ea24bb2cd80bf7fb0f98b8dc0b251d content/10: 69c9a5b252f10da7e52a2537af16088a @@ -1889,7 +1943,7 @@ checksums: content/4: c541157a4545441abb8230f0fc592f75 content/5: f7bc4279f763bd6c38ad6fc5bcbc3480 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 26d1c85b5f0999824ad0886412bde1d1 + content/7: 09ae06d5cbd48da01ca6c57f36d4d94c content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 0abcb136d2a9617a6e49382d7dfa15c9 content/10: 46342ae29db0e5a542162124e359a826 @@ -1936,7 +1990,7 @@ checksums: content/6: d74114e19898e411abf03afa63701227 content/7: 1ed9b3fcc03266ab0a3190e5ecf73d8f content/8: 821e6394b0a953e2b0842b04ae8f3105 - content/9: 86653553a7b57d8bd5d11bbd995aaf6c + content/9: 91758adbd13f3753145eb4fb903e3477 content/10: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/11: 21ffec9c7c4a4e802556573a15f5ca26 content/12: 1e24b572e247655f0081396ce44af661 @@ -1988,7 +2042,7 @@ checksums: content/4: b3b9601b395d4a6f364f8b34afe6b2f9 content/5: 59ed0c3062e578c95624dc374ebff319 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: eccad7955db6942860555946c2454c32 + content/7: 34772a832706b411d104f7847c2fb0b2 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: b012197e65487ff167f2cbd78da85eac content/10: 0cc2f207ef4e2f3ac0acf4cf9b3aba2c @@ -2032,7 +2086,7 @@ checksums: content/4: 640bf7078f7274be242c66c786b81d5a content/5: 2225dd3fb2438f827f9eae1da7868254 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 7bee7cb55550ee7addec13d5a7a730fe + content/7: 75e2ced9cbea4724ee1d7568ca32fcba content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 3b1349731a12896fa3da551ac695aee4 content/10: 31392c503ad28f2a16d3ff6be4d680cd @@ -2056,7 +2110,7 @@ checksums: content/8: e7ee442b7f12c7330911017480478e87 content/9: 6f88565c2708d14750645193c4276a45 content/10: 821e6394b0a953e2b0842b04ae8f3105 - content/11: f146518273b270415d93b9a76df6ad6e + content/11: e3332bf4919aca52c8845687aaf1acb0 content/12: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/13: 4a01bece58a2e9ac96bea57ed39e35d5 content/14: f49c586052b88ec4bf80d844c0c7ca3e @@ -2094,7 +2148,7 @@ checksums: content/4: b41980e87958dc586244f52951023461 content/5: 4583ee62c782ca5b26e781cef04482d1 content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 17cd6731cbf7d924a0ef2485b963bccc + content/7: 0d8959984999f5b8724d820b3902a2df content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: f9f7b4ccf69ad24cee2d8b32b475975b content/10: 884524fa71cd8609367a3660f6045c80 @@ -2122,7 +2176,7 @@ checksums: content/6: 3944ad41005da05185cb8f84099ce6d4 content/7: cd99f11be56e9910cd9d990d8c0f88e7 content/8: 821e6394b0a953e2b0842b04ae8f3105 - content/9: 2cdbc0c7e1c2965c2ef214755cddd9ca + content/9: 6c15444031e81d478fbfcac2e865a023 content/10: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/11: 3524f0dac9a9152db223bcc2682a842d content/12: 341fbcb79af9a7cb1bf5ac653f51807c @@ -2142,7 +2196,7 @@ checksums: content/4: 3f9d3fe4f2b112783feff5c885192b49 content/5: 94a3334c997d217858c07a820b7d0baa content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: a600c210273796aad066a7a1b157b169 + content/7: f6b0d3ff747a7b0037257b215eb5cedc content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: c943ad1d080946813168f09d39c48176 content/10: e5f873f9afa24ed2ba3cfccdd5bbd0bb @@ -2194,7 +2248,7 @@ checksums: content/4: d558fc578cda9b893cad7ee9adc1ec06 content/5: d14f1791b1f2398ba75e1c1bdbce294c content/6: 821e6394b0a953e2b0842b04ae8f3105 - content/7: 11554e8310c5a196b3df4b1d25b319e1 + content/7: 27309a28f731c21ce951de168a04cf65 content/8: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/9: 8ecf9d45b1dedf037a3a795d195ad0ed content/10: 602024f39f5974b8b12eadb8470050cf @@ -2331,73 +2385,84 @@ checksums: content/98: 6bd60468d8cc072c5fe4214481fa9f60 content/99: a81d7cd4a644a0061dad3a5973b4fe06 content/100: 981447969a71fd038049e9d9f40f4f8c - content/101: 531941216d31cb1947367c3c02127baa - content/102: bf1afa789fdfa5815faaf43574341e90 - content/103: 5f2fe55d098d4e4f438af595708b2280 - content/104: 41b8f7cf8899a0e92e255a3f845f9584 - content/105: 61ddd890032078ffd2da931b1d153b6d - content/106: 7873aa7487bc3e8a4826d65c1760a4a0 - content/107: 98182d9aabe14d5bad43a5ee76a75eab - content/108: 2bdb01e4bcb08b1d99f192acf8e2fba7 - content/109: 7079d9c00b1e1882c329b7e9b8f74552 - content/110: 0f9d65eaf6e8de43c3d5fa7e62bc838d - content/111: 58c8e9d2d0ac37efd958203b8fbc8193 - content/112: 7859d36a7a6d0122c0818b28ee29aa3e - content/113: ce185e7b041b8f95ebc11370d3e0aad9 - content/114: 701e9bf4fd4d0669da0584eac5bd96e0 - content/115: d1bab8ec5a51a9da5464eb47e2a16b50 - content/116: da658275cc81a20f9cf7e4c66c7af1e3 - content/117: 377d7c99a5df4b72166946573f7210b8 - content/118: 3afc03a5ab1dc9db2bfa092b0ac4826a - content/119: 18ddfcaf2be4a6f1d9819407dad9ce7c - content/120: 2f6263b2e95f09f7e4842453f4bf4a0a - content/121: 4603578d6b314b662f45564a34ca430d - content/122: cf4c97eb254d0bd6ea6633344621c2c2 - content/123: 7b4640989fab002039936156f857eb21 - content/124: 65ca9f08745b47b4cce8ea8247d043bf - content/125: 162b4180611ff0a53b782e4dc8109293 - content/126: 6b367a189eb53cb198e3666023def89c - content/127: dbb2125cefcf618849600c1eccae8a64 - content/128: 04eedda0da3767b06e6017c559e05414 - content/129: 661688450606eb09d8faee1468e88331 - content/130: 8ff8367c3246103b3e3e02499e34ae0b - content/131: 44678bda9166f746da1d61b694ced482 - content/132: a5e75db27c0a901f4cacf6598f450e6c - content/133: d1bab8ec5a51a9da5464eb47e2a16b50 - content/134: da658275cc81a20f9cf7e4c66c7af1e3 - content/135: 377d7c99a5df4b72166946573f7210b8 - content/136: 3afc03a5ab1dc9db2bfa092b0ac4826a - content/137: 18ddfcaf2be4a6f1d9819407dad9ce7c - content/138: 2f6263b2e95f09f7e4842453f4bf4a0a - content/139: 4603578d6b314b662f45564a34ca430d - content/140: cf4c97eb254d0bd6ea6633344621c2c2 - content/141: 7b4640989fab002039936156f857eb21 - content/142: 65ca9f08745b47b4cce8ea8247d043bf - content/143: 162b4180611ff0a53b782e4dc8109293 - content/144: 6b367a189eb53cb198e3666023def89c - content/145: dbb2125cefcf618849600c1eccae8a64 - content/146: 04eedda0da3767b06e6017c559e05414 - content/147: 661688450606eb09d8faee1468e88331 - content/148: 8ff8367c3246103b3e3e02499e34ae0b - content/149: 44678bda9166f746da1d61b694ced482 - content/150: 192a89879084dd7a74a6f44bcecae958 - content/151: 41c2bb95317d7c0421817a2b1a68cc09 - content/152: 4c95f9fa55f698f220577380dff95011 - content/153: 9ef273d776aada1b2cff3452f08ff985 - content/154: 100e12673551d4ceb5b906b1b9c65059 - content/155: ce253674cd7c49320203cda2bdd3685b - content/156: 8910afcea8c205a28256eb30de6a1f26 - content/157: 4d7ad757d2c70fdff7834146d38dddd8 - content/158: a88260a5b5e23da73e4534376adeb193 - content/159: e5e2329cdc226186fe9d44767528a4a0 - content/160: 1773624e9ac3d5132b505894ef51977e - content/161: d62c9575cc66feec7589fba95c9f7aee - content/162: 7af652c5407ae7e156ab27b21a4f26d3 - content/163: 4aa69b29cca745389dea8cd74eba4f83 - content/164: 46877074b69519165997fa0968169611 - content/165: 2e81908c18033109ac82a054b3fafd3d - content/166: ecd571818ddf3d31b08b80a25958a662 - content/167: 7dcdf2fbf3fce3f94987046506e12a9b + content/101: c4a515e993f75288ac915094c80cc1df + content/102: 23e5e8228c45d58c3b16af1dccdaf598 + content/103: cab7213a23e59504d834d347c944b685 + content/104: fcb1568f1adf19ac5a706001a84cad91 + content/105: 7b486d79adc6500458cf8d4fb0c3ada8 + content/106: 531ba61df0fffebc44fc6ebe9b9b08b0 + content/107: 4267ac9375ea48bd994758885c0e05c9 + content/108: ae7b4696ba7e9edf4b192fbab90d8e45 + content/109: 0a7f8dfd0edb971c731dad1ce322c6e6 + content/110: 652b35852355ef0a9e0d7b634639cfc9 + content/111: 7afd8cd395c8e63bb1ede3538307de54 + content/112: 3304a33dfb626c6e2267c062e8956a9d + content/113: eea7828d6d712dc31d150bd438284b8a + content/114: 72a2b6306511832781715e503f0442d8 + content/115: fe19a895e0b360386bfefc269ca596a5 + content/116: d1bab8ec5a51a9da5464eb47e2a16b50 + content/117: f4b91b5931dff5faaa26581272e51b61 + content/118: 8f2d6066da0f1958aa55c6191f0a5be1 + content/119: 2a1c4e0626d1a10a59ae80490435f1c6 + content/120: a74834b7a623c3f5cc323d3ceeb5415f + content/121: f9da331cf341b7abe9fa4f1f021bb2ce + content/122: 006b642e4072cd86730b41503906c267 + content/123: 4570f2c71f19c1a89aa15c62abea2a6b + content/124: bbb4874da742521d5e07d05e17056a3a + content/125: 35f33ebf126b4a967bccf057d990d8ea + content/126: 519f8d2ed7a62f11b58f924d05a1bdf4 + content/127: 711f65ba5fbbc9204591770be00c0b76 + content/128: d1bab8ec5a51a9da5464eb47e2a16b50 + content/129: 9a2604ebbc848ffc92920e7ca9a1f5d5 + content/130: 2d9792d07b8887ecb00b4bddaa77760d + content/131: 67c60dcbdcb96ec99abda80aed195a39 + content/132: cd7923b20a896061bd8b437607a456ab + content/133: 6497acadfafd123e6501104bc339cb0b + content/134: 8d345f55098ed7fe8a79bfcd52780f56 + content/135: 7f2808ae7cc39c74fa1ea2e023e16db8 + content/136: 88f2cd0696cc8d78dc4b04549b26c13b + content/137: d1bab8ec5a51a9da5464eb47e2a16b50 + content/138: 4760068730805bd746ad2b7abae14be7 + content/139: 363a11a70ad2991f43e5c645343d24b1 + content/140: 76193afa096b6017eb981461fbd0af36 + content/141: 0e297ada3c58c15adbac6ede74fec86b + content/142: 08c8a11473671bde84d82b265f8f70cc + content/143: d1bab8ec5a51a9da5464eb47e2a16b50 + content/144: ac1580a83d54361553916f1518ca3eff + content/145: a10c4dc3ab88bfa976836d5a2fd21168 + content/146: e7ac414081f94d0ea1f36ef434392bb2 + content/147: 5235c1c6fe2a3956c0b55c2d1827fb98 + content/148: 074894d66efb4d36737a0735278e41cb + content/149: e5aa4e76b5d89aa3c2cda5255443eccd + content/150: b41c367dfb1527280df6c09bd32e626c + content/151: a5b2b0cf64941e8e962724a5728a5071 + content/152: 08c8a11473671bde84d82b265f8f70cc + content/153: d1bab8ec5a51a9da5464eb47e2a16b50 + content/154: da658275cc81a20f9cf7e4c66c7af1e3 + content/155: d87f098de2239cceabdb02513ec754c0 + content/156: 642e60a6fc14e6cca105684b0bc778fa + content/157: 41775a7801766af4164c8d93674e6cb2 + content/158: 3afc03a5ab1dc9db2bfa092b0ac4826a + content/159: 18ddfcaf2be4a6f1d9819407dad9ce7c + content/160: 0d9a26fefe257a86593e24043e803357 + content/161: 7ec562abd07f7db290d6f2accea4cd2d + content/162: ee8b87f59db1c578b95ad0198df084b7 + content/163: 4603578d6b314b662f45564a34ca430d + content/164: cf4c97eb254d0bd6ea6633344621c2c2 + content/165: 7b4640989fab002039936156f857eb21 + content/166: 65ca9f08745b47b4cce8ea8247d043bf + content/167: 162b4180611ff0a53b782e4dc8109293 + content/168: 6b367a189eb53cb198e3666023def89c + content/169: dbb2125cefcf618849600c1eccae8a64 + content/170: 04eedda0da3767b06e6017c559e05414 + content/171: 077ed20dc3e9d5664e20d2814825cbdf + content/172: a88260a5b5e23da73e4534376adeb193 + content/173: e5e2329cdc226186fe9d44767528a4a0 + content/174: 1773624e9ac3d5132b505894ef51977e + content/175: d62c9575cc66feec7589fba95c9f7aee + content/176: 7af652c5407ae7e156ab27b21a4f26d3 + content/177: ecd571818ddf3d31b08b80a25958a662 + content/178: 7dcdf2fbf3fce3f94987046506e12a9b 27578f1315b6f1b7418d5e0d6042722e: meta/title: 8c555594662512e95f28e20d3880f186 content/0: 9218a2e190598690d0fc5c27c30f01bb @@ -2479,16 +2544,16 @@ checksums: content/76: 33b9b1e9744318597da4b925b0995be2 content/77: 6afe3b62e6d53c3dcd07149abcab4c05 content/78: b6363faee219321c16d41a9c3f8d3bdd - content/79: 08410ce9f0ec358b3c7230a56bc66399 + content/79: 3c5b351d25fb0639559eacdad545a0ed content/80: b8b23ab79a7eb32c6f8d5f49f43c51f6 content/81: be358297e2bbb9ab4689d11d072611d1 - content/82: 09fea7c0d742a0eefa77e982e848de6c + content/82: 414b9bf7d35039c6a17f4fb03d6b7431 content/83: 7d098f0349c782f389431377ee512e92 content/84: 22b39537f6a104803389469d211154e4 content/85: d9ec74ab28b264d76f797fdae7c8f3d3 content/86: f29d6bfd74ba3fee0b90180f620b4f47 content/87: 2a59466500b62e57481fe27692a3ed0f - content/88: cbbb123fc3a12bf2ab72dc1bbe373a6e + content/88: 94965695a02aea6c753448c21fd66b18 content/89: 7873aa7487bc3e8a4826d65c1760a4a0 content/90: 98182d9aabe14d5bad43a5ee76a75eab content/91: 67bfa8ae3e22d9a949f08c79a40b8df5 @@ -2500,11 +2565,11 @@ checksums: content/97: dae96b41f0c029b464f02ac65d3c5796 content/98: 41c2bb95317d7c0421817a2b1a68cc09 content/99: 4c95f9fa55f698f220577380dff95011 - content/100: 6695bd47a05f9963134d8a71abb3d298 + content/100: e674c5e6ecaf4dae9fc93e328b8a57c4 content/101: 100e12673551d4ceb5b906b1b9c65059 content/102: ce253674cd7c49320203cda2bdd3685b content/103: 94d4346a735149c2a83f6d2a21b8ab4c - content/104: 3ee4b16b8204ef3b5b7c0322ff636fab + content/104: 869fd72c8911057ee0696f068fa22e35 content/105: 450265802cb0ba5b435b74b9cac1bf23 content/106: b735ede8764e4b2dfb25967e33ab5143 content/107: 0f881e586a03c4b916456c73fad48358 @@ -2834,10 +2899,20 @@ checksums: content/30: dbbf313837f13ddfa4a8843d71cb9cc4 content/31: cf10560ae6defb8ee5da344fc6509f6e content/32: c5dc6e5de6e45b17ee1f5eb567a18e2f - content/33: aa47ff01b631252f024eaaae0c773e42 - content/34: 1266d1c7582bb617cdef56857be34f30 - content/35: c2cef2688104adaf6641092f43d4969a - content/36: 089fc64b4589b2eaa371de7e04c4aed9 + content/33: 332dab0588fb35dabb64b674ba6120eb + content/34: 714b3f99b0a8686bbb3434deb1f682b3 + content/35: ba18ac99184b17d7e49bd1abdc814437 + content/36: bed2b629274d55c38bd637e6a28dbc4a + content/37: 71487ae6f6fb1034d1787456de442e6d + content/38: 137d9874cf5ec8d09bd447f224cc7a7c + content/39: 6b5b4c3b2f98b8fc7dd908fef2605ce8 + content/40: 3af6812662546ce647a55939241fd88e + content/41: 6a4d7f0ccb8c28303251d1ef7b3dcca7 + content/42: 5dce779f77cc2b0abf12802a833df499 + content/43: aa47ff01b631252f024eaaae0c773e42 + content/44: 1266d1c7582bb617cdef56857be34f30 + content/45: c2cef2688104adaf6641092f43d4969a + content/46: 089fc64b4589b2eaa371de7e04c4aed9 722959335ba76c9d0097860e2ad5a952: meta/title: 9842d3af9cf52b7f5ab4a6ed4f2b23d2 content/0: 112d20eb578be8c0f59a13c819bf7716 @@ -3938,7 +4013,7 @@ checksums: content/9: 9c8aa3f09c9b2bd50ea4cdff3598ea4e content/10: f95b3ee86f3460e79bdd41e36fa68dfc content/11: 371d0e46b4bd2c23f559b8bc112f6955 - content/12: f39d7d18d9fad461fc4f4d0733d06f6e + content/12: d71b6bb8e2dd6ce98101aec6a1dd77f2 content/13: bcadfc362b69078beee0088e5936c98b content/14: 02a204a8ecbdbe2508beabeb9e83bf22 content/15: b3f310d5ef115bea5a8b75bf25d7ea9a @@ -4068,11 +4143,13 @@ checksums: content/3: 78cfe3bc9c911dd9aa75f053f768707d content/4: d5c510cc37588bf8f3d9a91543544721 content/5: a09e8940e139c0b84886fa7f16f3e690 - content/6: 33f032ae58bee4c0e244491b110a22fe - content/7: ef92830705e75d566cb1c6bbc18a2c82 - content/8: 8f06e4f0147241cadfbae88fb2fc2057 - content/9: c2d4cc3ecf06ac3c07f57c83095e461b - content/10: 3d8114d48bbc82967b2e7c881f571dc0 + content/6: 4ec178f03b8b1dd035d0a2941d01b967 + content/7: c8a934e0c369887defde32b93786799b + content/8: 36205863ef80144682e36623ba455c7c + content/9: 1423b72abb907e40921f8f4ec40a22c2 + content/10: 8f06e4f0147241cadfbae88fb2fc2057 + content/11: c2d4cc3ecf06ac3c07f57c83095e461b + content/12: 3d8114d48bbc82967b2e7c881f571dc0 c1571f6a328a5083bc542ae1ffc98fac: meta/title: 41fc753f4232b5628873660d94faba90 meta/description: b108bba63132a8a2ddbff6b5264ef993 @@ -4081,30 +4158,99 @@ checksums: content/2: 3c7457d4671bdca75eb8847e77b3d09a content/3: b3c762557a1a308f3531ef1f19701807 content/4: bf29da79344f37eeadd4c176aa19b8ff - content/5: ae52879ebefa5664a6b7bf8ce5dd57ab - content/6: ce487c9bc7a730e7d9da4a87b8eaa0a6 - content/7: e73f4b831f5b77c71d7d86c83abcbf11 - content/8: 07e064793f3e0bbcb02c4dc6083b6daa - content/9: a702b191c3f94458bee880d33853e0cb - content/10: c497057cbb9dd53599071f8550f327cd - content/11: cc6e48f85d5c6bfc05f846341f2d5cc9 - content/12: 8a80a6a97da9bf375fac565f1caabb49 - content/13: 098cc8e062187eb877fe5e172a4aa467 - content/14: e452a7cb33d7cf2f7cf1804703edaa20 - content/15: 466cfd61b1d0fcd8fc93d867dfd0f3e3 - content/16: 377572316021236994f444e88949ef34 - content/17: 54852933b2cbe3deb3b1c3059dba6a15 - content/18: 9e66b045763abe053a3ba8d2c23e9aa1 - content/19: d34f0950591e3beb085e99db64d07d2f - content/20: 8677ef07618f7289b04fef3cce8bf745 - content/21: c0e6d2790e369569e7f272a5ec9ae21a - content/22: 93643a0d9d9745f131e4eabf7ead2018 - content/23: 89c7da6d2e8fbc25e303a7381e147237 - content/24: a8ec63597dc3a3564bc5f0c3a6e5f42c - content/25: 379618989b6cd427b319cfdab523297d - content/26: bc4c2e699a7514771276e90e9aee53ba - content/27: 38e14193b679ef774c3db93d399e700e - content/28: ce110ab5da3ff96f8cbf96ce3376fc51 - content/29: 83f9b3ab46b0501c8eb3989bec3f4f1b - content/30: e00be80effb71b0acb014f9aa53dfbe1 - content/31: 847a381137856ded9faa5994fbc489fb + content/5: d9ee91aa417a55e8cb1e0c5f4e4ca83b + content/6: b747c4e9aff28c3efba1c8888ba9b9f9 + content/7: d16a981c85afb9da140d46d4b8d51e06 + content/8: ff071011d7ed2f6c9b98e1bb18c0edf5 + content/9: e73f4b831f5b77c71d7d86c83abcbf11 + content/10: 07e064793f3e0bbcb02c4dc6083b6daa + content/11: a702b191c3f94458bee880d33853e0cb + content/12: c497057cbb9dd53599071f8550f327cd + content/13: cc6e48f85d5c6bfc05f846341f2d5cc9 + content/14: 8a80a6a97da9bf375fac565f1caabb49 + content/15: 098cc8e062187eb877fe5e172a4aa467 + content/16: e452a7cb33d7cf2f7cf1804703edaa20 + content/17: 466cfd61b1d0fcd8fc93d867dfd0f3e3 + content/18: 377572316021236994f444e88949ef34 + content/19: 54852933b2cbe3deb3b1c3059dba6a15 + content/20: 9e66b045763abe053a3ba8d2c23e9aa1 + content/21: d34f0950591e3beb085e99db64d07d2f + content/22: 8677ef07618f7289b04fef3cce8bf745 + content/23: c0e6d2790e369569e7f272a5ec9ae21a + content/24: 93643a0d9d9745f131e4eabf7ead2018 + content/25: 89c7da6d2e8fbc25e303a7381e147237 + content/26: a8ec63597dc3a3564bc5f0c3a6e5f42c + content/27: 379618989b6cd427b319cfdab523297d + content/28: bc4c2e699a7514771276e90e9aee53ba + content/29: 38e14193b679ef774c3db93d399e700e + content/30: ce110ab5da3ff96f8cbf96ce3376fc51 + content/31: 83f9b3ab46b0501c8eb3989bec3f4f1b + content/32: 8eafc1489817e2b31bb2dde5cf45bb17 + content/33: f7c188211a6c76460e159b65a8dae43f + content/34: 8a64c1f76a0bb16a40ba0eeaf6141dd1 + content/35: fb03882a39682b35fd8ef5574a110020 + content/36: cb234805a1738585c4725c6519b212bc + content/37: 3dee2b82795a6dab076cbcdc59a03965 + content/38: 950899e381ce7b7c73e98ad5b15562a0 + content/39: c8b1f8cd971687fc5d2b78c28c2b4050 + content/40: c8a934e0c369887defde32b93786799b + content/41: dc440445fa0173b8d47905205307b3a1 + content/42: 42cef4d960a45562b89682cc0a563fe5 + content/43: 0bbfb30bad650027ae86bb1a0baea081 + content/44: e00be80effb71b0acb014f9aa53dfbe1 + content/45: 847a381137856ded9faa5994fbc489fb + b214e6d00a19c26edb95e44446a6d760: + meta/title: 722934d11bc41f6e50b1cfc3dbadaf26 + content/0: 50d5c77e01abfc35c519f78cba84a473 + content/1: 5c9d3b7c555e2b6a1532d3112f841a70 + content/2: 23bd248a9a74fae4f7db5fde8d008138 + content/3: 5e26527ccf8fddebe14c951e6c950b48 + content/4: 49d51591195c906d11276a2dee57c0bb + content/5: 0461f100a5cf6ed6eb53cf836ef45c10 + content/6: dad5954a5a455e1c426441e4794b2a7c + content/7: a4efab9ed1bb9285bef34a82ba70c866 + content/8: c797150e0147747bbdacebac8a1421b7 + content/9: 770dc0be25d7b2c38351e32d9fa90e49 + content/10: 9ec734827a42d127af99e05d69fdf911 + content/11: 433e69f3cf2ae10821d1acf22a18a291 + content/12: be3b8ea55f32f09643422b15d37e3929 + content/13: ff1349545973b7600743bb8b95f90bb2 + content/14: 6bb355d4a953adbb0b5fe6501cd222f4 + content/15: ec3d41b4a649cfe33292f8be6c6c678c + content/16: 1f882cdaba7a9b78b05d26836e2411a5 + content/17: eacb0ee18275bf6801de5d2eef84e493 + content/18: 503ec68e64c9cbe4c283192659b5dbd2 + content/19: c09c061bd9bb350f345269de8532ac82 + content/20: c128c130dd3d3fd4148323cfcb675db2 + content/21: 83f4c595ce175cd6a414b46a88dfff57 + content/22: a746c949b86da5eca4fe9e1624b07836 + content/23: 842bd4cf67c9fdd48034d4b31d1a12db + content/24: 317d19b9c55fadf8fcd6b26e154f72e1 + content/25: 48af41b1da94b60b33f3402dd326f48b + content/26: d84ad590287648a6e6f08587fe6bf817 + content/27: 04e0d6242314dacfb8d8dd16505b2535 + content/28: b2f0eb9ec1d5c9cef46fa02b903a87e5 + content/29: 0441638444240cd20a6c69ea1d3afbb1 + content/30: 7384c7eedaf6fe9b7aa7d02f6e79bb5d + content/31: 69e9bbeac40eb0c9937f38647b06ba71 + content/32: 52afa38aae8cccc986d915c4ee894e89 + content/33: 29a51975b097968639b1b84009a809c0 + content/34: 987932038f4e9442bd89f0f8ed3c5319 + content/35: a351326511e997c1aa0f829733c4d8fa + content/36: f902bd33c2aa0d9eed80eb468255f0f3 + content/37: 320da12b94e7bb3d7b7524c15df7e035 + content/38: d4821d23bf0d88529a88aa7abe5330dc + content/39: 7a7902c8f8e0270e7949f37c5264f421 + content/40: 9c2f91f89a914bf4661512275e461104 + content/41: f76d8d662ed441da8d48254a63bb92a5 + content/42: f00ccf08ff9825a6dbed544caeb7e6ab + content/43: 3ab5d61f54f98ba50e611a48a2dc21bd + content/44: 0dc53c5490ace62a16ded85d264994de + content/45: 56570d30087803e02088eae20aecc762 + content/46: d99180a353e9102f7a3d0e366f140a28 + content/47: cb131821d20155010e12961c3aac309b + content/48: ec19338b3159fc866ee6cff196c54314 + content/49: b09931503d0e18462364b8e8d8c50e4b + content/50: b2a4a0c279f47d58a2456f25a1e1c6f9 + content/51: dd2fe5f38e6fadab2b5353cc6e8da57e + content/52: 604fec9d146658f2582bb53523378ac3 diff --git a/apps/sim/blocks/blocks/youtube.ts b/apps/sim/blocks/blocks/youtube.ts index 145b1ff9d6..7324646c75 100644 --- a/apps/sim/blocks/blocks/youtube.ts +++ b/apps/sim/blocks/blocks/youtube.ts @@ -1,19 +1,35 @@ import { YouTubeIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' import { AuthMode } from '@/blocks/types' -import type { YouTubeSearchResponse } from '@/tools/youtube/types' +import type { YouTubeResponse } from '@/tools/youtube/types' -export const YouTubeBlock: BlockConfig = { +export const YouTubeBlock: BlockConfig = { type: 'youtube', name: 'YouTube', - description: 'Search for videos on YouTube', + description: 'Interact with YouTube videos, channels, and playlists', authMode: AuthMode.ApiKey, - longDescription: 'Integrate YouTube into the workflow. Can search for videos.', + longDescription: + 'Integrate YouTube into the workflow. Can search for videos, get video details, get channel information, get playlist items, and get video comments.', docsLink: 'https://docs.sim.ai/tools/youtube', category: 'tools', bgColor: '#FF0000', icon: YouTubeIcon, subBlocks: [ + { + id: 'operation', + title: 'Operation', + type: 'dropdown', + layout: 'full', + options: [ + { label: 'Search Videos', id: 'youtube_search' }, + { label: 'Get Video Details', id: 'youtube_video_details' }, + { label: 'Get Channel Info', id: 'youtube_channel_info' }, + { label: 'Get Playlist Items', id: 'youtube_playlist_items' }, + { label: 'Get Video Comments', id: 'youtube_comments' }, + ], + value: () => 'youtube_search', + }, + // Search Videos operation inputs { id: 'query', title: 'Search Query', @@ -21,38 +37,180 @@ export const YouTubeBlock: BlockConfig = { layout: 'full', placeholder: 'Enter search query', required: true, + condition: { field: 'operation', value: 'youtube_search' }, }, { - id: 'apiKey', - title: 'YouTube API Key', + id: 'maxResults', + title: 'Max Results', + type: 'slider', + layout: 'half', + min: 1, + max: 50, + step: 1, + integer: true, + condition: { field: 'operation', value: 'youtube_search' }, + }, + // Get Video Details operation inputs + { + id: 'videoId', + title: 'Video ID', type: 'short-input', layout: 'full', - placeholder: 'Enter YouTube API Key', - password: true, + placeholder: 'Enter YouTube video ID (e.g., dQw4w9WgXcQ)', + required: true, + condition: { field: 'operation', value: 'youtube_video_details' }, + }, + // Get Channel Info operation inputs + { + id: 'channelId', + title: 'Channel ID', + type: 'short-input', + layout: 'full', + placeholder: 'Enter channel ID (or leave blank to use username)', + condition: { field: 'operation', value: 'youtube_channel_info' }, + }, + { + id: 'username', + title: 'Channel Username', + type: 'short-input', + layout: 'full', + placeholder: 'Enter channel username (if not using channel ID)', + condition: { field: 'operation', value: 'youtube_channel_info' }, + }, + // Get Playlist Items operation inputs + { + id: 'playlistId', + title: 'Playlist ID', + type: 'short-input', + layout: 'full', + placeholder: 'Enter YouTube playlist ID', required: true, + condition: { field: 'operation', value: 'youtube_playlist_items' }, }, { id: 'maxResults', title: 'Max Results', type: 'slider', layout: 'half', - min: 0, - max: 20, + min: 1, + max: 50, + step: 1, + integer: true, + condition: { field: 'operation', value: 'youtube_playlist_items' }, + }, + // Get Video Comments operation inputs + { + id: 'videoId', + title: 'Video ID', + type: 'short-input', + layout: 'full', + placeholder: 'Enter YouTube video ID', + required: true, + condition: { field: 'operation', value: 'youtube_comments' }, + }, + { + id: 'maxResults', + title: 'Max Results', + type: 'slider', + layout: 'half', + min: 1, + max: 100, + step: 1, + integer: true, + condition: { field: 'operation', value: 'youtube_comments' }, + }, + { + id: 'order', + title: 'Sort Order', + type: 'dropdown', + layout: 'full', + options: [ + { label: 'Most Relevant', id: 'relevance' }, + { label: 'Most Recent', id: 'time' }, + ], + value: () => 'relevance', + condition: { field: 'operation', value: 'youtube_comments' }, + }, + // API Key (common to all operations) + { + id: 'apiKey', + title: 'YouTube API Key', + type: 'short-input', + layout: 'full', + placeholder: 'Enter YouTube API Key', + password: true, + required: true, }, ], tools: { - access: ['youtube_search'], + access: [ + 'youtube_search', + 'youtube_video_details', + 'youtube_channel_info', + 'youtube_playlist_items', + 'youtube_comments', + ], + config: { + tool: (params) => { + // Convert numeric parameters + if (params.maxResults) { + params.maxResults = Number(params.maxResults) + } + + switch (params.operation) { + case 'youtube_search': + return 'youtube_search' + case 'youtube_video_details': + return 'youtube_video_details' + case 'youtube_channel_info': + return 'youtube_channel_info' + case 'youtube_playlist_items': + return 'youtube_playlist_items' + case 'youtube_comments': + return 'youtube_comments' + default: + return 'youtube_search' + } + }, + }, }, inputs: { - apiKey: { type: 'string', description: 'The API key for the YouTube search' }, - query: { type: 'string', description: 'The query for the YouTube search' }, - maxResults: { type: 'number', description: 'The maximum number of results to return' }, + operation: { type: 'string', description: 'Operation to perform' }, + apiKey: { type: 'string', description: 'YouTube API key' }, + // Search Videos + query: { type: 'string', description: 'Search query' }, + maxResults: { type: 'number', description: 'Maximum number of results' }, + // Video Details & Comments + videoId: { type: 'string', description: 'YouTube video ID' }, + // Channel Info + channelId: { type: 'string', description: 'YouTube channel ID' }, + username: { type: 'string', description: 'YouTube channel username' }, + // Playlist Items + playlistId: { type: 'string', description: 'YouTube playlist ID' }, + // Comments + order: { type: 'string', description: 'Sort order for comments' }, }, outputs: { - items: { type: 'json', description: 'The items returned by the YouTube search' }, - totalResults: { - type: 'number', - description: 'The total number of results returned by the YouTube search', - }, + // Search Videos & Playlist Items + items: { type: 'json', description: 'List of items returned' }, + totalResults: { type: 'number', description: 'Total number of results' }, + nextPageToken: { type: 'string', description: 'Token for next page' }, + // Video Details + videoId: { type: 'string', description: 'Video ID' }, + title: { type: 'string', description: 'Video or channel title' }, + description: { type: 'string', description: 'Video or channel description' }, + channelId: { type: 'string', description: 'Channel ID' }, + channelTitle: { type: 'string', description: 'Channel name' }, + publishedAt: { type: 'string', description: 'Published date' }, + duration: { type: 'string', description: 'Video duration' }, + viewCount: { type: 'number', description: 'View count' }, + likeCount: { type: 'number', description: 'Like count' }, + commentCount: { type: 'number', description: 'Comment count' }, + thumbnail: { type: 'string', description: 'Thumbnail URL' }, + tags: { type: 'json', description: 'Video tags' }, + // Channel Info + subscriberCount: { type: 'number', description: 'Subscriber count' }, + videoCount: { type: 'number', description: 'Total video count' }, + customUrl: { type: 'string', description: 'Channel custom URL' }, }, } diff --git a/apps/sim/tools/registry.ts b/apps/sim/tools/registry.ts index fda2fb95b9..858085ab60 100644 --- a/apps/sim/tools/registry.ts +++ b/apps/sim/tools/registry.ts @@ -205,7 +205,13 @@ import { } from '@/tools/wikipedia' import { workflowExecutorTool } from '@/tools/workflow' import { xReadTool, xSearchTool, xUserTool, xWriteTool } from '@/tools/x' -import { youtubeSearchTool } from '@/tools/youtube' +import { + youtubeChannelInfoTool, + youtubeCommentsTool, + youtubePlaylistItemsTool, + youtubeSearchTool, + youtubeVideoDetailsTool, +} from '@/tools/youtube' // Registry of all available tools export const tools: Record = { @@ -250,6 +256,10 @@ export const tools: Record = { typeform_files: typeformFilesTool, typeform_insights: typeformInsightsTool, youtube_search: youtubeSearchTool, + youtube_video_details: youtubeVideoDetailsTool, + youtube_channel_info: youtubeChannelInfoTool, + youtube_playlist_items: youtubePlaylistItemsTool, + youtube_comments: youtubeCommentsTool, notion_read: notionReadTool, notion_read_database: notionReadDatabaseTool, notion_write: notionWriteTool, diff --git a/apps/sim/tools/youtube/channel_info.ts b/apps/sim/tools/youtube/channel_info.ts new file mode 100644 index 0000000000..0bdd7e81cc --- /dev/null +++ b/apps/sim/tools/youtube/channel_info.ts @@ -0,0 +1,131 @@ +import type { ToolConfig } from '@/tools/types' +import type { YouTubeChannelInfoParams, YouTubeChannelInfoResponse } from '@/tools/youtube/types' + +export const youtubeChannelInfoTool: ToolConfig< + YouTubeChannelInfoParams, + YouTubeChannelInfoResponse +> = { + id: 'youtube_channel_info', + name: 'YouTube Channel Info', + description: 'Get detailed information about a YouTube channel.', + version: '1.0.0', + params: { + channelId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'YouTube channel ID (use either channelId or username)', + }, + username: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'YouTube channel username (use either channelId or username)', + }, + apiKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'YouTube API Key', + }, + }, + + request: { + url: (params: YouTubeChannelInfoParams) => { + let url = + 'https://www.googleapis.com/youtube/v3/channels?part=snippet,statistics,contentDetails' + if (params.channelId) { + url += `&id=${params.channelId}` + } else if (params.username) { + url += `&forUsername=${params.username}` + } + url += `&key=${params.apiKey}` + return url + }, + method: 'GET', + headers: () => ({ + 'Content-Type': 'application/json', + }), + }, + + transformResponse: async (response: Response): Promise => { + const data = await response.json() + + if (!data.items || data.items.length === 0) { + return { + success: false, + output: { + channelId: '', + title: '', + description: '', + subscriberCount: 0, + videoCount: 0, + viewCount: 0, + publishedAt: '', + thumbnail: '', + }, + error: 'Channel not found', + } + } + + const item = data.items[0] + return { + success: true, + output: { + channelId: item.id, + title: item.snippet?.title || '', + description: item.snippet?.description || '', + subscriberCount: Number(item.statistics?.subscriberCount || 0), + videoCount: Number(item.statistics?.videoCount || 0), + viewCount: Number(item.statistics?.viewCount || 0), + publishedAt: item.snippet?.publishedAt || '', + thumbnail: + item.snippet?.thumbnails?.high?.url || + item.snippet?.thumbnails?.medium?.url || + item.snippet?.thumbnails?.default?.url || + '', + customUrl: item.snippet?.customUrl, + }, + } + }, + + outputs: { + channelId: { + type: 'string', + description: 'YouTube channel ID', + }, + title: { + type: 'string', + description: 'Channel name', + }, + description: { + type: 'string', + description: 'Channel description', + }, + subscriberCount: { + type: 'number', + description: 'Number of subscribers', + }, + videoCount: { + type: 'number', + description: 'Number of videos', + }, + viewCount: { + type: 'number', + description: 'Total channel views', + }, + publishedAt: { + type: 'string', + description: 'Channel creation date', + }, + thumbnail: { + type: 'string', + description: 'Channel thumbnail URL', + }, + customUrl: { + type: 'string', + description: 'Channel custom URL', + optional: true, + }, + }, +} diff --git a/apps/sim/tools/youtube/comments.ts b/apps/sim/tools/youtube/comments.ts new file mode 100644 index 0000000000..ccd20b8460 --- /dev/null +++ b/apps/sim/tools/youtube/comments.ts @@ -0,0 +1,117 @@ +import type { ToolConfig } from '@/tools/types' +import type { YouTubeCommentsParams, YouTubeCommentsResponse } from '@/tools/youtube/types' + +export const youtubeCommentsTool: ToolConfig = { + id: 'youtube_comments', + name: 'YouTube Video Comments', + description: 'Get comments from a YouTube video.', + version: '1.0.0', + params: { + videoId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'YouTube video ID', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-only', + default: 20, + description: 'Maximum number of comments to return', + }, + order: { + type: 'string', + required: false, + visibility: 'user-only', + default: 'relevance', + description: 'Order of comments: time or relevance', + }, + pageToken: { + type: 'string', + required: false, + visibility: 'user-only', + description: 'Page token for pagination', + }, + apiKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'YouTube API Key', + }, + }, + + request: { + url: (params: YouTubeCommentsParams) => { + let url = `https://www.googleapis.com/youtube/v3/commentThreads?part=snippet,replies&videoId=${params.videoId}&key=${params.apiKey}` + url += `&maxResults=${params.maxResults || 20}` + url += `&order=${params.order || 'relevance'}` + if (params.pageToken) { + url += `&pageToken=${params.pageToken}` + } + return url + }, + method: 'GET', + headers: () => ({ + 'Content-Type': 'application/json', + }), + }, + + transformResponse: async (response: Response): Promise => { + const data = await response.json() + + const items = (data.items || []).map((item: any) => { + const topLevelComment = item.snippet?.topLevelComment?.snippet + return { + commentId: item.snippet?.topLevelComment?.id || item.id, + authorDisplayName: topLevelComment?.authorDisplayName || '', + authorChannelUrl: topLevelComment?.authorChannelUrl || '', + textDisplay: topLevelComment?.textDisplay || '', + textOriginal: topLevelComment?.textOriginal || '', + likeCount: topLevelComment?.likeCount || 0, + publishedAt: topLevelComment?.publishedAt || '', + updatedAt: topLevelComment?.updatedAt || '', + replyCount: item.snippet?.totalReplyCount || 0, + } + }) + + return { + success: true, + output: { + items, + totalResults: data.pageInfo?.totalResults || 0, + nextPageToken: data.nextPageToken, + }, + } + }, + + outputs: { + items: { + type: 'array', + description: 'Array of comments from the video', + items: { + type: 'object', + properties: { + commentId: { type: 'string', description: 'Comment ID' }, + authorDisplayName: { type: 'string', description: 'Comment author name' }, + authorChannelUrl: { type: 'string', description: 'Comment author channel URL' }, + textDisplay: { type: 'string', description: 'Comment text (HTML formatted)' }, + textOriginal: { type: 'string', description: 'Comment text (plain text)' }, + likeCount: { type: 'number', description: 'Number of likes' }, + publishedAt: { type: 'string', description: 'Comment publish date' }, + updatedAt: { type: 'string', description: 'Comment last updated date' }, + replyCount: { type: 'number', description: 'Number of replies', optional: true }, + }, + }, + }, + totalResults: { + type: 'number', + description: 'Total number of comments', + }, + nextPageToken: { + type: 'string', + description: 'Token for accessing the next page of results', + optional: true, + }, + }, +} diff --git a/apps/sim/tools/youtube/index.ts b/apps/sim/tools/youtube/index.ts index f0001ac06d..20d7470c5e 100644 --- a/apps/sim/tools/youtube/index.ts +++ b/apps/sim/tools/youtube/index.ts @@ -1,3 +1,11 @@ +import { youtubeChannelInfoTool } from '@/tools/youtube/channel_info' +import { youtubeCommentsTool } from '@/tools/youtube/comments' +import { youtubePlaylistItemsTool } from '@/tools/youtube/playlist_items' import { youtubeSearchTool } from '@/tools/youtube/search' +import { youtubeVideoDetailsTool } from '@/tools/youtube/video_details' export { youtubeSearchTool } +export { youtubeVideoDetailsTool } +export { youtubeChannelInfoTool } +export { youtubePlaylistItemsTool } +export { youtubeCommentsTool } diff --git a/apps/sim/tools/youtube/playlist_items.ts b/apps/sim/tools/youtube/playlist_items.ts new file mode 100644 index 0000000000..e6ad8e974a --- /dev/null +++ b/apps/sim/tools/youtube/playlist_items.ts @@ -0,0 +1,112 @@ +import type { ToolConfig } from '@/tools/types' +import type { + YouTubePlaylistItemsParams, + YouTubePlaylistItemsResponse, +} from '@/tools/youtube/types' + +export const youtubePlaylistItemsTool: ToolConfig< + YouTubePlaylistItemsParams, + YouTubePlaylistItemsResponse +> = { + id: 'youtube_playlist_items', + name: 'YouTube Playlist Items', + description: 'Get videos from a YouTube playlist.', + version: '1.0.0', + params: { + playlistId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'YouTube playlist ID', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-only', + default: 10, + description: 'Maximum number of videos to return', + }, + pageToken: { + type: 'string', + required: false, + visibility: 'user-only', + description: 'Page token for pagination', + }, + apiKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'YouTube API Key', + }, + }, + + request: { + url: (params: YouTubePlaylistItemsParams) => { + let url = `https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,contentDetails&playlistId=${params.playlistId}&key=${params.apiKey}` + url += `&maxResults=${params.maxResults || 10}` + if (params.pageToken) { + url += `&pageToken=${params.pageToken}` + } + return url + }, + method: 'GET', + headers: () => ({ + 'Content-Type': 'application/json', + }), + }, + + transformResponse: async (response: Response): Promise => { + const data = await response.json() + + const items = (data.items || []).map((item: any, index: number) => ({ + videoId: item.contentDetails?.videoId || item.snippet?.resourceId?.videoId, + title: item.snippet?.title || '', + description: item.snippet?.description || '', + thumbnail: + item.snippet?.thumbnails?.medium?.url || + item.snippet?.thumbnails?.default?.url || + item.snippet?.thumbnails?.high?.url || + '', + publishedAt: item.snippet?.publishedAt || '', + channelTitle: item.snippet?.channelTitle || '', + position: item.snippet?.position ?? index, + })) + + return { + success: true, + output: { + items, + totalResults: data.pageInfo?.totalResults || 0, + nextPageToken: data.nextPageToken, + }, + } + }, + + outputs: { + items: { + type: 'array', + description: 'Array of videos in the playlist', + items: { + type: 'object', + properties: { + videoId: { type: 'string', description: 'YouTube video ID' }, + title: { type: 'string', description: 'Video title' }, + description: { type: 'string', description: 'Video description' }, + thumbnail: { type: 'string', description: 'Video thumbnail URL' }, + publishedAt: { type: 'string', description: 'Date added to playlist' }, + channelTitle: { type: 'string', description: 'Channel name' }, + position: { type: 'number', description: 'Position in playlist' }, + }, + }, + }, + totalResults: { + type: 'number', + description: 'Total number of items in playlist', + }, + nextPageToken: { + type: 'string', + description: 'Token for accessing the next page of results', + optional: true, + }, + }, +} diff --git a/apps/sim/tools/youtube/types.ts b/apps/sim/tools/youtube/types.ts index c066768017..08fe2e7c51 100644 --- a/apps/sim/tools/youtube/types.ts +++ b/apps/sim/tools/youtube/types.ts @@ -19,3 +19,101 @@ export interface YouTubeSearchResponse extends ToolResponse { nextPageToken?: string } } + +export interface YouTubeVideoDetailsParams { + apiKey: string + videoId: string +} + +export interface YouTubeVideoDetailsResponse extends ToolResponse { + output: { + videoId: string + title: string + description: string + channelId: string + channelTitle: string + publishedAt: string + duration: string + viewCount: number + likeCount: number + commentCount: number + thumbnail: string + tags?: string[] + } +} + +export interface YouTubeChannelInfoParams { + apiKey: string + channelId?: string + username?: string +} + +export interface YouTubeChannelInfoResponse extends ToolResponse { + output: { + channelId: string + title: string + description: string + subscriberCount: number + videoCount: number + viewCount: number + publishedAt: string + thumbnail: string + customUrl?: string + } +} + +export interface YouTubePlaylistItemsParams { + apiKey: string + playlistId: string + maxResults?: number + pageToken?: string +} + +export interface YouTubePlaylistItemsResponse extends ToolResponse { + output: { + items: Array<{ + videoId: string + title: string + description: string + thumbnail: string + publishedAt: string + channelTitle: string + position: number + }> + totalResults: number + nextPageToken?: string + } +} + +export interface YouTubeCommentsParams { + apiKey: string + videoId: string + maxResults?: number + order?: 'time' | 'relevance' + pageToken?: string +} + +export interface YouTubeCommentsResponse extends ToolResponse { + output: { + items: Array<{ + commentId: string + authorDisplayName: string + authorChannelUrl: string + textDisplay: string + textOriginal: string + likeCount: number + publishedAt: string + updatedAt: string + replyCount?: number + }> + totalResults: number + nextPageToken?: string + } +} + +export type YouTubeResponse = + | YouTubeSearchResponse + | YouTubeVideoDetailsResponse + | YouTubeChannelInfoResponse + | YouTubePlaylistItemsResponse + | YouTubeCommentsResponse diff --git a/apps/sim/tools/youtube/video_details.ts b/apps/sim/tools/youtube/video_details.ts new file mode 100644 index 0000000000..78d2c785c0 --- /dev/null +++ b/apps/sim/tools/youtube/video_details.ts @@ -0,0 +1,138 @@ +import type { ToolConfig } from '@/tools/types' +import type { YouTubeVideoDetailsParams, YouTubeVideoDetailsResponse } from '@/tools/youtube/types' + +export const youtubeVideoDetailsTool: ToolConfig< + YouTubeVideoDetailsParams, + YouTubeVideoDetailsResponse +> = { + id: 'youtube_video_details', + name: 'YouTube Video Details', + description: 'Get detailed information about a specific YouTube video.', + version: '1.0.0', + params: { + videoId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'YouTube video ID', + }, + apiKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'YouTube API Key', + }, + }, + + request: { + url: (params: YouTubeVideoDetailsParams) => { + return `https://www.googleapis.com/youtube/v3/videos?part=snippet,statistics,contentDetails&id=${params.videoId}&key=${params.apiKey}` + }, + method: 'GET', + headers: () => ({ + 'Content-Type': 'application/json', + }), + }, + + transformResponse: async (response: Response): Promise => { + const data = await response.json() + + if (!data.items || data.items.length === 0) { + return { + success: false, + output: { + videoId: '', + title: '', + description: '', + channelId: '', + channelTitle: '', + publishedAt: '', + duration: '', + viewCount: 0, + likeCount: 0, + commentCount: 0, + thumbnail: '', + }, + error: 'Video not found', + } + } + + const item = data.items[0] + return { + success: true, + output: { + videoId: item.id, + title: item.snippet?.title || '', + description: item.snippet?.description || '', + channelId: item.snippet?.channelId || '', + channelTitle: item.snippet?.channelTitle || '', + publishedAt: item.snippet?.publishedAt || '', + duration: item.contentDetails?.duration || '', + viewCount: Number(item.statistics?.viewCount || 0), + likeCount: Number(item.statistics?.likeCount || 0), + commentCount: Number(item.statistics?.commentCount || 0), + thumbnail: + item.snippet?.thumbnails?.high?.url || + item.snippet?.thumbnails?.medium?.url || + item.snippet?.thumbnails?.default?.url || + '', + tags: item.snippet?.tags || [], + }, + } + }, + + outputs: { + videoId: { + type: 'string', + description: 'YouTube video ID', + }, + title: { + type: 'string', + description: 'Video title', + }, + description: { + type: 'string', + description: 'Video description', + }, + channelId: { + type: 'string', + description: 'Channel ID', + }, + channelTitle: { + type: 'string', + description: 'Channel name', + }, + publishedAt: { + type: 'string', + description: 'Published date and time', + }, + duration: { + type: 'string', + description: 'Video duration in ISO 8601 format', + }, + viewCount: { + type: 'number', + description: 'Number of views', + }, + likeCount: { + type: 'number', + description: 'Number of likes', + }, + commentCount: { + type: 'number', + description: 'Number of comments', + }, + thumbnail: { + type: 'string', + description: 'Video thumbnail URL', + }, + tags: { + type: 'array', + description: 'Video tags', + items: { + type: 'string', + }, + optional: true, + }, + }, +}