https://retellai.com/?utm_source=discord&utm_medium=seo logo
why do I get an error message while extracting dyn...
# ❓・ai-evy-support
i
@AI Evy why do I get an error message while extracting dynamic variables
Copy code
Tool Invocation: extract_dynamic_variables
tool_call_id: extract_dynamic_variables_24cea3
Error parsing the JSON
a
Thanks for tagging me @iraql0bster.. I'll look through relevant sources and get back to you shortly.
​ 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 in function query parameters are not parsed](https://discord.com/channels/1186424376300679209/1414306451656151291) [[3] Error updating general_tools with tool type extract_dynamic_variable in Retell LLM API](https://discord.com/channels/1186424376300679209/1438181992498728980) ​
### Answer The "Error parsing the JSON" message when extracting dynamic variables typically indicates an issue with how the Extract Dynamic Variable tool is configured or how the LLM is attempting to invoke it [(1) ]() . Here are the key configuration requirements for the Extract Dynamic Variable tool : 1. Variable Name – A short name to reference this variable 2. Description – A brief explanation of what this value should be 3. Variable Type – Choose from
Text
,
Number
,
Enum
, or
Boolean
4. Enum Options - Options to choose from (only when type is enum) The variable types supported are : - 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 Additionally, it's important to update your prompt to explicitly tell the agent 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.
Based on a community discussion, there's also a known issue where dynamic variables in function query parameters may not be parsed correctly if using nested object notation like
{{nearest_location.id}}
[(2) ]() . The workaround suggested was to extract the specific field directly rather than using nested references . If you're trying to create or update these tools via the API, note that extract_dynamic_variable tools need to be created at the agent or LLM creation time first before they can be properly updated [(3) ]() . **
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.