Home Tool and Workflow

Tool and Workflow

Learn how to use tools and workflows.
By DigiAI INTL
5 articles

Create Workflow

Workflows significantly simplify complex tasks by breaking intricate tasks into smaller, manageable steps, known as nodes. This approach reduces dependence on prompt engineering and model inference, while boosting LLM applications' efficiency for complex processes. Additionally, workflows enhance system interpretability, stability, and fault tolerance by supporting visual drag-and-drop node orchestration using serial and parallel design patterns. Serial Node Design Pattern Nodes in a serial pattern execute sequentially, each starting its operation only after its predecessor completes and delivers output. This ensures logical task execution in a defined order. Example Workflow: In a "Content Creation" agent, users input their requirements such as tone, format, and target audience. The system then sequentially assists with research, drafting, and editing, with each node relying on the preceding one to maintain content quality and coherence. Steps for Designing a Serial Structure 1. Insert a new serial node by clicking the + icon between existing nodes. 2. Link the nodes in sequence. 3. Funnel all paths to an "End" node to complete the workflow. Parallel Structure Design Pattern This design allows multiple nodes to operate concurrently, enabling previous nodes to trigger numerous subsequent nodes simultaneously. Parallel nodes run independently, enhancing workflow efficiency by executing tasks in parallel. Example Workflow: In a "Survey Analysis" application, once users input survey data, nodes within the parallel structure analyze various segments of the survey responses simultaneously, such as statistical analysis, sentiment analysis, and trend identification, thus expediting the overall evaluation process. Steps for Designing Parallel Structures 1. Add Nodes with Hover Action: Hover over an existing node and click the + button to automatically create multiple nodes, establishing a parallel framework. 2. Drag Connections: Use the drag feature from the + button on a node to develop parallel branches. 3. Next Step Additions: In a node's right panel, use the "Next Step" section to add parallel nodes, setting up a parallel architecture. Common Parallel Structure Patterns 1. Normal Parallel: A straightforward Start | Parallel Nodes | End is intuitive for simultaneously running multiple tasks after user input, supporting up to 10 branches. 2. Nested Parallel: Involves complex multi-layer operations, such as external API requests with results feeding into downstream nodes, with support for up to 3 nesting layers. 3. Conditional Branch + Parallel: Utilizes parallel nodes alongside IF/ELSE branches. 4. Iteration Branch + Parallel: Integrates parallel processing within iterative loops for efficiency in repeating tasks. Previewing the Workflow Click "Run" to enter debugging mode and use the right-side interface for testing the workflow's configuration. Publishing the Workflow After completing debugging, click "Publish" to save your workflow and release it as a reusable tool. By publishing the workflow, all workspace members gain the capability to apply it within agent settings. If needed, click "Restore" to preview and revert to the last published version, overwriting the current one if confirmed.

Last updated on Oct 22, 2024

Workflow Nodes (Basic)

Nodes serve as the fundamental elements of a workflow, facilitating the execution of various operations by interlinking nodes with distinct functions. Start Node This node defines the starting point of your workflow, establishing the initial parameters needed to begin the process. Customize the input variables within the start node to initiate the workflow. Every workflow mandates a start node as the precursor to execution. Once set up, the workflow will request input values for these specified variables at the time of execution. End Node The end node determines the final output of a workflow. It is essential to have at least one end node to conclude the process and generate the final output. Acting as the termination point, the end node does not allow further node additions beyond it. Workflow applications produce results only when the process reaches the end node. If conditional paths are present, multiple end nodes must be established. The end node must specify one or more output variables, which can refer to output variables from any preceding upstream node. LLM Node This node engages large language models to interpret questions or process natural language inputs. Scenarios - Intent Recognition: Utilized in customer service to discern and categorize user queries, guiding subsequent steps in the process. - Text Generation: Employed in content creation to craft text aligned with themes and keywords. - Content Classification: In email management, it automatically sorts emails into categories like inquiries, complaints, or spam. - Text Conversion: Facilitates translation by converting user-submitted text into a chosen language. - Code Generation: Assists in programming tasks by creating specific business code or test cases based on user specifications. - RAG: In knowledge base Q&A, reorganizes relevant retrieved information to address user queries effectively. - Image Understanding: Uses multimodal models with vision capabilities to comprehend and respond to questions regarding image content. By selecting the right model and composing effective prompts, you can craft robust solutions within the Workflow. Configuration Steps 1. Select a Model: Choose a model that aligns with your task type and scenario requirements. 2. Configure Model Parameters: Fine-tune controls for the generation results by adjusting parameters like temperature, TopP, maximum tokens, and response formats. 3. Write Prompts: Utilize the user-friendly prompt composition page for the LLM node. Knowledge Retrieval Node The Knowledge Base Retrieval Node plays a crucial role in querying relevant text content from the DigiAI Knowledge Base. This retrieved information serves as valuable context, enhancing the subsequent responses generated by the Large Language Model (LLM). Configuration Steps 1. Select the Query Variable: Start by determining the query variable, which typically represents the user's inquiry or question. This variable guides the retrieval process by identifying the specific content needed from the knowledge base. 2. Choose the Appropriate Knowledge Base: Within the retrieval node settings, you have the opportunity to add and select an existing knowledge base from DigiAI AgentHub. This selection ensures that the most relevant information database is used to address the user's query effectively. 3. Configure Retrieval Strategy: Tailor the retrieval strategy to suit your needs by adjusting the indexing approach for each knowledge base within the node. This configuration ensures the retrieval process is optimized and aligns with the specific requirements of the task. Question Classifier Node The Question Classifier Node enables the intelligent categorization of user inputs by aligning them with predefined classification descriptions. This node's output facilitates efficient content routing to appropriate downstream processes. Scenarios Utilized in a variety of cases such as categorizing customer inquiries, organizing feedback and reviews. For example, in a technical support workflow, the Question Classifier Node can act as an initial processing stage before engaging specific systems or resources. It efficiently categorizes questions, directing them to the appropriate destination for precise responses. In this context, we define three classification categories: - Category 1: Technical Support Questions - Category 2: Account Management Queries - Category 3: Miscellaneous Sample Inputs and Their Categories: - "How do I reset my router?" → "Technical Support Questions" - "How can I update my billing information?" → "Account Management Queries" - "What's the office dress code?" → "Miscellaneous" Configuration Steps 1. Select Input Variable: Identify the input content, such as user inquiries under a technical support system. 2. Choose Inference Model: Employ large language models for their natural language processing strengths. An optimal model choice will enhance the effectiveness of classification. 3. Write Classification Labels/Descriptions: Craft multiple classification criteria by inputting keywords or descriptive phrases for each category. These augment the model's understanding of classification rules. 4. Advanced Settings: Incorporate additional details or guidelines to refine the node's performance, enhancing its classification precision. 5. Select Corresponding Downstream Nodes: Post-classification, direct the workflow through different pathways reflecting the categorized output, ensuring alignment with respective downstream nodes. IF/ELSE Node The Conditional Branch IF/ELSE Node is a tool for directing workflow operations along multiple pathways depending on logical conditions. This node enables the workflow to dynamically adapt based on varying scenarios, ensuring precise execution paths. This node comprises three components: 1. IF Condition: Start by selecting a variable, followed by defining a condition and assigning the specific value that will satisfy this condition. When the IF condition is met (True), the workflow proceeds along the IF path. 2. ELSE Path: If the IF condition is not met (False), the workflow diverges into the ELSE path, allowing for an alternative set of operations. 3. ELIF Conditions: For scenarios requiring additional granularity, you can introduce ELIF conditions. If the first ELIF condition is satisfied (True), that path is executed. If not (False), the workflow evaluates subsequent ELIF conditions or defaults to the final ELSE path. For intricate decision-making, the node allows establishing multiple conditional checks, where you can integrate logical operators like AND or OR between conditions. This enables constructing comprehensive intersections (AND) or unions (OR) to achieve the desired conditional logic.

Last updated on Oct 23, 2024

Workflow Nodes (Advanced)

Iteration Node The Iteration Node is a component for performing repetitive operations on elements within an array until all outputs are complete. This node applies the same logical steps to each list item, facilitating complex processing within workflows. Scenarios Example: Data-Driven Customer Survey Analysis 1. Initial Setup: Start by inputting survey metadata, such as survey title and description, into the Start Node to establish the foundation. 2. Identify Key Topics: Use an LLM Node to generate major themes and relevant questions from the survey data. 3. Arrange Data Structure: Use a Code Node to convert the survey responses into an array format for easier handling. 4. Iterative Analysis Process: Employ the Iteration Node to wrap around an LLM Node, systematically analyzing responses for each identified theme. 5. Transform Results: Use a Template Node to recompile the analysis results from an array back into a cohesive report. 6. Output Final Report: Finalize the process with an End Node to present a comprehensive survey analysis. Utilizing Array-Formatted Content: - Using the CODE Node: Script logic to derive and structure data into arrays. - Using the Parameter Extraction Node: Capture specific data parameters to form arrays efficiently. Converting Array-Formatted Content to Text: The Iteration Node's output is array-based and needs conversion to a text format. Apply a conversion step to turn these arrays back into accessible text. - Using a Code Node: Craft the conversion of arrays into readable text through programming. - Using a Template Node: Customize templates to specify output formats, ensuring the final text is organized and meets desired presentation standards. Code Node The Code Execution Node enables the integration of Python and NodeJS scripts within workflows, facilitating a wide range of data transformations. This node streamlines complex workflows, making it ideal for tasks such as arithmetic operations, JSON manipulation, text refinement, and more. This node provides developers with expanded flexibility, allowing them to incorporate custom Python or JavaScript scripts that enable variable manipulation beyond what standardized nodes offer. By configuring settings, you can define the necessary input and output variables, alongside the corresponding script for execution. Scenarios - Structured Data Processing Workflows often involve handling unstructured data, which requires parsing, extraction, and transformation of JSON strings. One example is processing data received from an HTTP Request Node, where data might be nested within XML structures or need specific fields extracted. The Code Node efficiently performs these complex operations. - Mathematical Calculations Workflows that require intricate arithmetic operations or statistical analyses greatly benefit from the Code Node. It can handle complex mathematical formulas and provide insights into data through calculated analyses, enhancing decision-making processes. - Data Aggregation The Code Node excels at merging multiple data streams, such as combining the results of knowledge base queries, integrating outcomes from various data searches, or unifying API call data. It seamlessly brings together diverse data sources for comprehensive analysis. Security Considerations Both the Python and JavaScript environments used by the Code Node are securely sandboxed, ensuring robust security. This isolation prevents the usage of functions that might heavily tax system resources or introduce security threats. These include actions such as direct file system interactions, making external network requests, or performing operating system-level commands. By enforcing these restrictions, DigiAI ensures code is executed safely while safeguarding system resources. Template Node The Template Node is an invaluable tool for dynamically formatting and merging variables from previous nodes into a cohesive text output using Jinja2—an advanced templating engine for Python. This node is particularly effective when you need to amalgamate data from various sources into a specific format that later nodes in the workflow require. Key Features - Dynamic Text Formatting Utilizing the robust Jinja2 syntax, the Template Node allows the seamless integration of different data variables into a unified text string, providing an organized and consistent format. - Data Consolidation from Multiple Inputs The node excels at synthesizing diverse data points sourced from preceding nodes, arranging them into a structured output. This function is crucial when combining elements like user inputs, API call results, and database queries to prepare them for subsequent processing stages. - Preparing Data for Further Processing: By formatting data into a structured output, the Template Node ensures that subsequent nodes receive the information in an expected arrangement, enhancing the workflow's coherence and reliability. Whether you are preparing detailed reports, structured emails, or formatted datasets, this node simplifies the process. Variable Aggregator Node The Variable Aggregator Node is a potent mechanism within workflows that consolidates variables originating from multiple branches into a unified variable. This integration ensures streamlined configurations for downstream processing nodes and enhances data management efficiency. This node serves as a conduit for combining outputs from various branches, allowing collected results to be accessed through a singular variable regardless of the branch from which they originate. It is particularly advantageous in multi-path scenarios where it assimilates variables performing identical functions across different branches into one cohesive output variable, thereby eliminating the redundancy of redefining these variables in subsequent nodes. Data Type Compatibility The Variable Aggregator efficiently handles various data types, including strings, numbers, objects, and arrays. It aggregates variables of the same type; for instance, if the initial variable is a String, subsequent nodes will be limited to adding only String-type variables. This ensures coherence and avoids potential data type conflicts within the aggregation process. Aggregation Group Once the aggregation group is enabled, the variable aggregator allows for the combination of multiple variable groups, where each group must consist of variables of the same data type for the aggregation process. Parameter Extraction Node The Parameter Extraction Node is a tool that leverages LLM (Large Language Model) capabilities to infer and extract structured parameters from natural language inputs. These structured parameters are essential for invoking tools or configuring HTTP Request Node within workflows. DigiAI workflows come equipped with an array of tools that require structured input parameters. The Parameter Extraction Node converts the user's natural language inputs into structured formats, ensuring they are compatible with various tools for smooth invocation and operation. Certain nodes demand specific data formats, such as arrays for the Iteration Node. The Parameter Extraction Node adeptly transforms content into these necessary structures, streamlining subsequent workflow operations. Scenarios - Tool Parameter Extraction from Natural Language Consider a scenario where you wish to create a weather reporting application. The weather tool needs specific parameters such as location or forecast date. The Parameter Extraction Node processes an input like "What's the weather in New York tomorrow?" and extracts "New York" and "tomorrow" as parameters for precise tool queries. - Transforming Text into Structured Data In an interactive recipe creation application, chapter content can be converted from text to an array format. The node serves as a preliminary step that enables the Iteration Node to handle each recipe step systematically, enhancing multi-round processing. - Using Structured Data for External Requests: Extract parameters to facilitate HTTP Request Node operations, allowing for the retrieval of external data sources, initiation of webhooks, image generation requests, or any scenario requiring structured interaction with external systems. Configuration Steps 1. Select the Input Variable: Identify the variable input for parameter extraction, which typically comes from user queries or natural language inputs within the workflow. 2. Choose the Model: The effectiveness of parameter extraction relies on the chosen LLM, which uses its inference skills and structured generation capabilities to interpret and convert input data. 3. Define Parameters to Extract: Manually add required parameters or import them swiftly from existing tools to align with workflow needs. 4. Write Instructions: Provide clear instructions and examples to the LLM. Offering illustrative samples can enhance the accuracy and reliability of parameter extraction, especially in scenarios involving complex data. HTTP Request Node The HTTP Request Node is designed to facilitate interconnectivity between workflows and external services by sending HTTP protocol-based server requests. It is ideal for tasks that involve retrieving external data, activating webhooks, generating content like images, or downloading various file types, thereby ensuring seamless integration with a multitude of online services. HTTP Request Methods Supported - GET: Utilized to retrieve specific resources from a server. - POST: Employed for submitting data to a server, often used for form submissions or file uploads. - HEAD: Similar to GET, this request fetches the response headers only, without the actual resource body. - PATCH: Allows for partial updates to existing resources. - PUT: Used to upload or update resources on a server, either creating or modifying existing content. - DELETE: Sends a request for the server to remove a specified resource. Each HTTP request can be extensively configured, allowing you to specify parameters such as URLs, request headers, query parameters, request body details, and necessary authentication credentials. The data returned from an HTTP request encompasses the response body, status code, headers, and any associated files. Crucially, if the server returns a file (currently supporting image types), the node can save the file automatically for successive workflow actions. This capability not only enhances processing efficiency but also simplifies the workflow’s response handling, particularly when files are involved.

Last updated on Oct 23, 2024