https://retellai.com/?utm_source=discord&utm_medium=seo logo
how do I use the Extract Variable custom function
# ❓・ai-evy-support
m
@AI Evy how do I use the Extract Variable custom function?
a
Thanks for tagging me @martram3246. I'll look through relevant sources and get back to you shortly.
### Answer To use the Extract Variable tool in Retell AI, follow these steps: ## Setting Up Extract Dynamic Variables 1. Add the Extract Dynamic Variable Tool - This gives your agent the ability to extract variables [(1) ]() . 2. Add Variables - Click "+Add" at the bottom and configure : - Variable Name – A short name to reference this variable - Description – A brief explanation of what this value should be - Variable Type – Choose from
Text
,
Number
,
Enum
, or
Boolean
- Enum Options - Options to choose from (only when type is enum) ## Variable Types Available You can create variables of these types : - Text - Any word or sentence. Examples:
"headache"
,
"John Smith"
- Number - A numeric value. Examples:
42
,
98.6
- Enum - A value from a predefined list. Examples:
"Yes"
,
"No"
,
"Maybe"
- Boolean - True or false 3. Save the Extract Dynamic Variable Tool - Click the save button . 4. Update prompt for function - Include in the prompt explicitly when to invoke the extract variable function . For example:
Copy code
When user states his name and phone number, please extract the information by calling the `extract_user_details` function.
## Using Extracted Variables Once extracted, you can use these variables throughout your agent using the
{{variable_name}}
syntax in prompts, begin messages, tool descriptions, and other areas [(2) ]() . For unconditional variable setting, you can directly assign values like
true
to variables without checking conversation context [(3) ]() .
​ To learn more, see the sources I considered: [[1] Extract Dynamic Variables](https://docs.retellai.com/build/single-multi-prompt/extract-dv) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[3] Extract Variable always True Unconditionally](https://discord.com/channels/1186424376300679209/1390309243860680704) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.