User inputs and Variables

What is a Variable?

#Tags:
Variables
Data
Context
Learn how to use variables to reference user inputs throughout your AI applications.

What are variables?

Variables are placeholders that store values that represent data being passed through an AI application.

How to use variables

When creating a user input, assign a variable name to pass the data collected from that user input to other parts of your application. For example, if we’re building a demo sales call generator, we want to have the user provide a description of the customer they are selling to, which we've given the variable name "client_description."

You can then use that variable in a Generate Text block as context when asking the AI to create a demo call. Variables can also be used when saving the output from a Generate Text block and using that output somewhere else in your workflow. 

In this case, we've assigned all the context of our demo call to a variable titled "call.” We could then use this variable in tandem with another Generate Text block that includes additional information.

Benefits of using variables

  • Allow you to keep your application organized, as you can store data in one place and then reference it later.
  • Make your application more flexible, as you can change the value of a variable without having to change the code in other parts of your application.
  • Help debug your application, as you can use variables to track the flow of data through your application.

#Tags:
Variables
Data
Context