Variables and Data Management
Understanding Variables
Variables are vital in PromptChainer, enabling you to effectively store, manipulate, and manage data within your flows. They serve as placeholders for values, which can be changed or updated as your workflow progresses. In PromptChainer, there are two types of variables: database and temporary. Database variables are those pulled from a connected database by connecting a Variable Node. These variables store persistent data that you can use throughout your flow. On the other hand, temporary variables are created on the fly within the flow for specific purposes, such as intermediate calculations. These temporary variables are not connected to a final output node and are rewritten during each flow iteration. Using both variables, you can create dynamic and adaptable flows that respond to different inputs and scenarios.
Creating and Using Variables
To create and use PromptChainer variables, you can connect a Variable Node to a database or generate temporary variables within the flow using different nodes, such as Action or Code Nodes. When using a Variable Node, you can pull data from the connected database, which can be used throughout your flow. On the other hand, temporary variables are generated within the flow by utilizing various nodes, such as Action or Code Nodes. These variables are created for specific purposes and are not connected to a final output node, making them temporary and rewritten during each flow iteration.
It's important to note that different action nodes do not "remember" or "see" the preceding or succeeding nodes. To integrate outputs from one node into another, use the node's name as a variable. For example, if you wish to utilize the output of a node named 'second' in the prompt of another node, your prompt might look like this: "Please create two paragraphs about {second}". If you require the LLM to return only specific data without added explanations, prompt it explicitly. For instance, "Give me breeds of brown dogs. Return only the names themselves". By doing this, referencing previous outputs as variables becomes more coherent.
To utilize variables in your flow effectively, connect the Variable Node to the left handle of the node where you want to use the variable. Then, you can reference them within different nodes or prompts by using their names wrapped in curly braces, like {variable_name}. This method allows you to manipulate data and create dynamic workflows that adapt to various inputs and situations, providing a seamless experience for developers and end users.
Managing Data within Flow
Managing data within your flows is essential for creating robust and efficient AI-driven solutions. Keep track of your variables and their values as your flow progresses, and ensure your flow's logic is coherent and well-structured. Use the Output Node to define which variables need to be saved in the database or forwarded through the developer API. Additionally, utilize the Database Interface to set up and manage your databases, ensuring that the appropriate data is stored and retrieved as needed. By carefully managing your data within flows, you can create powerful and versatile AI-driven applications with PromptChainer.
Last updated