https://retellai.com/?utm_source=discord&utm_medium=seo logo
When i put a custom function node, not sure how to...
# ❓・ai-evy-support
e
@AI Evy When i put a custom function node, not sure how to direct it to use the proper parameters...
a
Thanks for tagging me @ezzy. I'll look through relevant sources and get back to you shortly.
### Answer The LLM determines when to call the function and extracts the required parameters based on your parameter definition. [(1) ]() To configure parameters for a custom function node: Define Parameters Using JSON Schema For POST, PATCH, and PUT requests, define parameters using JSON schema format. Here's an example:
Copy code
json
{
 "type": "object",
 "required": [
 "order_id"
 ],
 "properties": {
 "name": {
 "type": "object",
 "description": "",
 "properties": {
 "first_name": {
 "type": "string",
 "description": "User first name"
 },
 "last_name": {
 "type": "string",
 "const": "{{last_name}}"
 }
 }
 },
 "order_id": {
 "type": "number",
 "const": 1234
 }
 }
}
Key Points: - You can use
"description"
for the LLM to resolve the value dynamically - You can use
"const"
to apply a value directly to the function - Both description and const value can include dynamic variables using
{{variable_name}}
format Common Issues: - Ensure you add
"type": "object"
at the top level of your JSON schema - For dynamic variables in URLs or query parameters, use double curly braces:
{{variable_name}}
[(2) ]() [(3) ]() - Variables must be extracted before the function call that uses them [(3) ]() Update Node Instruction Guide the LLM on when to use the function in your node's prompt instruction. [(4) ]() For example:
Copy code
Help the user check their order status. If the user provides an order number,
call the check_order_status function to look up the order.
​ To learn more, see the sources I considered: [[1] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[2] Issue with Global Variables Not Passing in Query Parameters for Custom Function Tool](https://community.retellai.com/t/issue-with-global-variables-not-passing-in-query-parameters-for-custom-function-tool/773) [[3] Custom function failure to substitute dynamic variable](https://community.retellai.com/t/custom-function-failure-to-substitute-dynamic-variable/231) [[4] Node Functions](https://docs.retellai.com/build/conversation-flow/conversation-node-functions) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.