https://retellai.com/?utm_source=discord&utm_medium=seo logo
Why would an enum fail to be referenced correctly
# 💬・general
r
@AI Evy Why would an enum fail to be referenced correctly? I have two instances of either a character being added or removed entirely from a string. Below is a real example of a character being removed. Example JSON: "vin": { "type": "string", "enum": [ "qSiRvYlZaoSYGZKNp4ih" ] } Expected output: qSiRvYlZaoSYGZKNp4ih Real output: qSiRvYlZaoSYGKNp4ih (notice the missing "Z")
a
Thanks for tagging me @RFA. I'll look through relevant sources and get back to you shortly.
### Answer Based on the available Retell AI documentation, I can see that enum types are supported in the Extract Dynamic Variables tool [(1) ]() . The documentation shows that when creating variables, you can choose from different types including
Enum
, which allows you to define a value from a predefined list with specific "Enum Options" . However, the specific issue you're experiencing with characters being dropped or added from enum strings isn't directly addressed in the available documentation sources. This type of character-level inconsistency in enum output could be related to: 1. How the LLM is interpreting or processing the enum values 2. Potential encoding or parsing issues in the variable extraction process 3. The way the enum options are being matched against user input The documentation shows that enum variables work with predefined options , but doesn't detail the exact matching or validation logic that might cause character-level discrepancies. For more specific troubleshooting of this enum processing issue, you might want to: - Visit [Contact Sales]() - Visit [) Would you like a general answer based on my knowledge about common enum processing issues instead?
​ To learn more, see the sources I considered: [[1] Extract Dynamic Variables](https://docs.retellai.com/build/single-multi-prompt/extract-dv) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
@AI Evy This is for a custom function. I have this working in other custom functions tied to this same agent. So, referencing this string in the exact same method on other tools work, but not this tool. I even deleted the function, saved, and recreated the function. Does Retell have a soft-cap for tools attached to an agent? Is it possible we've hit a context-limit for tools? Why would a nearly identical tool call work, but not this one? Failing tool: add_tag_by_phone Working tool: add_task_by_phone The only differences: function name, function description, url, parameters: - for tag: "tags" - for task: "tasks", "assignee_name", "assignee_id", "task_due_delay_hrs"
a
Thanks for the follow-up, @RFA. I'll get back to you soon.
### Answer Based on the available Retell AI documentation, I don't see any specific information about soft-caps or context limits for the number of tools attached to an agent [(1) ]() . The custom function documentation shows how to create and configure custom functions, but doesn't mention any limits on the total number of functions per agent . For your enum parameter issue where characters are being dropped, the documentation shows that custom function parameters should be defined using JSON schema format :
Copy code
json
{
 "type": "object",
 "properties": {
  "tags": {
   "type": "string",
   "enum": [
    "qSiRvYlZaoSYGZKNp4ih"
   ]
  }
 },
 "required": ["tags"]
}
Since you mention that identical functions work for
add_task_by_phone
but not
add_tag_by_phone
, and you've already tried deleting and recreating the function, this suggests the issue might be specific to how that particular function is being processed rather than a general limit. The documentation doesn't address specific troubleshooting for enum parameter processing inconsistencies or tool limits. For this specific technical issue where identical configurations behave differently, I'd recommend: - Visit [Contact Sales]() - Visit [) Would you like a general answer based on my knowledge about common function calling issues instead?
​ To learn more, see the sources I considered: [[1] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
@AI Evy I forgot, "tasks" also has the following parameters: "assignee_name", "assignee_id", "task_due_delay_hrs" when those are included in the parameters, I get the enum failure, where either a random character is added or removed from one of the location_id or x-app-key. when those parameters are removed and the function called, i get no failures.
a
Thanks for the follow-up, @RFA. I'll get back to you soon.
​ To learn more, see the sources I considered: [[1] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[3] Discord message from @renovia_70920 on 2025-08-14](https://discord.com/channels/1186424376300679209/1186462578310910112/1405650264744136766) ​
### Answer Based on your latest information, it appears the issue is related to parameter complexity or context overload when multiple parameters are included in your custom function. The pattern you're describing - where enum values work correctly with fewer parameters but fail when additional parameters like
assignee_name
,
assignee_id
, and
task_due_delay_hrs
are added - suggests a potential processing issue when the function schema becomes more complex [(1) ]() [(2) ]() . The Retell AI documentation shows that custom functions should define parameters using JSON schema format :
Copy code
json
{
 "type": "object",
 "properties": {
  "city": {
   "type": "string",
   "description": "The city of the weather"
  }
 },
 "required": [
  "city"
 ]
}
One common issue mentioned in the community is that in custom functions,
headers
,
query_params
, and
response
variables should be objects
{}
rather than empty arrays
[]
[(3) ]() . However, your specific issue with character-level corruption in enum values when parameter count increases isn't directly addressed in the available documentation. The documentation mentions that function results are capped at 15000 characters to prevent overloading the LLM context window [(1) ]() [(2) ]() , but doesn't specify limits on parameter complexity or total parameter count that might cause enum processing issues. Since this appears to be a technical issue specific to parameter complexity affecting enum value integrity, and the available documentation doesn't cover this scenario, I'd recommend: - Visit [Contact Sales]() - Visit [) Would you like a general answer based on my knowledge about common function calling parameter issues instead?
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
@AI Evy yes i would
a
Thanks for the follow-up, @RFA. I'll get back to you soon.
### Answer Based on my general knowledge, the enum character corruption issue you're experiencing with Retell AI custom functions when parameter complexity increases is likely related to LLM token processing and context management. When you have multiple parameters in your custom function, the LLM needs to process more context to understand and generate the correct enum values. This can lead to several issues: 1. **Token Truncation**: As parameter schemas become more complex, the LLM might truncate or misinterpret parts of the enum values due to context window limitations or attention mechanism issues. 2. **Parameter Interference**: Multiple parameters can create competing attention patterns where the model focuses on generating values for one parameter while corrupting another. 3. **JSON Schema Complexity**: More complex schemas can cause the LLM to make mistakes when trying to match exact enum values, especially with long alphanumeric strings like "qSiRvYlZaoSYGZKNp4ih". Potential Solutions: 1. **Simplify Parameter Names**: Use shorter, more distinctive parameter names to reduce cognitive load on the LLM. 2. **Reorder Parameters**: Place the enum parameters first in your schema definition, as LLMs often perform better on earlier tokens. 3. **Use Shorter Enum Values**: If possible, use shorter identifiers or create a mapping system where you use simple enum values that map to your complex IDs. 4. **Split Functions**: Consider breaking your complex function into smaller, focused functions with fewer parameters each. 5. **Add Explicit Instructions**: In your function description, explicitly mention the importance of exact enum value matching. 6. **Validate and Retry**: Implement server-side validation that can detect corrupted enum values and request regeneration. The fact that simpler versions work but complex ones fail strongly suggests this is a
context/complexity issue rather than a hard limit in Retell AI itself.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
message has been deleted