Nodes
Last updated
Last updated
Nodes are the building blocks of your AI flows in our app, allowing you to design and customize powerful AI solutions. They represent different functionalities, actions, or conditions that are connected to create a complete flow. In this section, we'll explore various types of built-in nodes and best practices for connecting and configuring them.
Variable Nodes: Define the starting variables of the flow, which will later pull new values from the database and activate the flow based on those variables.
The key name defines the name of the variable. The key value is for local flow-checking purposes.
Action Nodes: Send specific, pre-defined prompts and variables to AI models, which manipulate the data and generate outputs for further processing within the flow.
The Action Node plays a critical role in your workflow, as it processes and generates outputs based on the provided prompt. To reference the output later in your flow, assign a unique action name by entering it in the 'Action Name' field. You can then use this name in other nodes by typing {action_name_you_choose}. In the 'Prompt' section, craft a prompt to send to the AI model, incorporating any connected variables using syntax {variable_name}. To utilize specific variables, connect them to the left-hand 'Variables' input handle, and link the right-hand 'Output' handle to the subsequent node in your flow for seamless data transfer.
Code Nodes: Write and execute custom code snippets with built-in libraries for common tasks.
The Code Node is a powerful tool for executing custom code within your workflow. Enter a unique name in the 'Action Name' field to identify the node itself. The main window, designated as the 'Code Input,' is where you enter your desired code. To access specific variables within your code, ensure they are connected to the left-hand 'Variables' input handle. When returning variables created within the code node, use the appropriate syntax for the language (e.g., "return {a}" in JavaScript) to return both the variable and its value. Keep in mind that the return function stops the code, so place it at the end of your script. You can return multiple variables and reference them later in your workflow. For seamless integration with subsequent nodes, connect the right-hand 'Output' handle, allowing further manipulation and processing of the data.
Output Nodes: Define the variables that need to be saved in the database or forwarded through the developer API.
The Output Node is a crucial component for saving and organizing the results of your workflow. Connecting other nodes to it ensures that their outputs are captured in a dedicated column within the Database. Name the Output Node using the 'Key Name' field; this will serve as the column header, enabling easy identification and interpretation of the data. Utilize this node for streamlined data organization and seamless retrieval of processed information for further analysis or reporting.
Conditional Nodes: Evaluate conditions and direct the flow based on specific criteria.
The Conditional Node offers a versatile solution for incorporating logic-based decision-making in your workflow. Designed to accommodate various conditions, from numerical comparisons to text-based evaluations, this node allows you to steer the flow depending on the input variable and a comparison value. You can connect a comparison value to the left handle or set a manual value for added flexibility. The right handles provide two distinct output connections: one for "If condition is met" and another for "If condition is not met." Integrating the Conditional Node into your AI-driven flows allows you to craft customized responses that adapt seamlessly to various scenarios.
Context Nodes: Provide specific contextual information and parameters to guide the AI models in comprehending the data and generating tailored outputs. These nodes allow you to enhance the AI's understanding by offering additional cues, constraints, or background details that influence how the models process and respond to the input data. This ensures the generated content aligns more closely with your intended outcomes and objectives, making your flows more targeted and effective.
Vectored Database Queries: With Context Nodes, you can easily pull data from your pre-built vectored databases. By sending queries tailored to these databases, you retrieve relevant information efficiently. Keep in mind that while querying vectored databases, you're not interacting with a language model (LLM) as you would in other nodes. Instead, focus on crafting concise, direct queries to ensure accurate results. Think of it as an advanced "Google searcher" for structured data.
Incorporating Variables: Like other nodes, you can integrate variables into your vector queries to personalize the results based on dynamic input. This flexibility lets you fine-tune your queries and obtain contextually relevant database information.
Hit Count and Threshold: Define the number of hits you want to retrieve and set a threshold score to filter the most relevant results. This level of control ensures that you receive the most pertinent information for your specific use case.
Viewing and Retrieving Results: After executing the Context Node, you can view the results within the node itself. You can call upon the results in other nodes to retrieve specific content for further use. For instance, if you're dealing with text results, you can use '{$node'sname[0].metadata.text}' to access the text of the first result.
Seamless Data Flow: You'll need to establish connections between the handles to connect the data retrieved from the Context Node with other nodes in your flow. Connect the Context Node's appropriate handle to the target node's corresponding handle, ensuring a smooth and coherent data flow throughout your workflow.
Image Nodes: Deliver bespoke, pre-determined prompts and variables to AI image-generation models, such as Dall-E, that interpret the data and construct visual outputs for further incorporation within the flow.
These nodes send pre-set prompts and variables to AI image-generation models like Dall-E, creating visual outputs for your flow. To reference the image later, assign a unique 'Action Name' to the node, much like in an Action Node. Construct a prompt for the AI model in the 'Prompt' field, incorporating any connected variables with the syntax {variable_name}. You can also specify the output image's resolution, offering more control over your visual content. Connect variables and output handles as usual for seamless data flow.
Properly connecting and configuring nodes is crucial for creating efficient and effective flows. Understanding the logical relationships between nodes and ensuring no bugs in the flow is essential for maintaining performance and achieving desired outcomes.