https://retellai.com/?utm_source=discord&utm_medium=seo logo
how to use what user said and pass it to custom fu...
# ❓・ai-evy-support
y
@AI Evy how to use what user said and pass it to custom function
a
Thanks for tagging me @yaro_30421. I'll look through relevant sources and get back to you shortly.
### Answer The LLM automatically extracts what the user said and passes it to your custom function through structured parameters [(1) ]() . When you define a custom function, you specify parameters using JSON schema format that the LLM will populate based on the conversation [(2) ]() . Here's how it works: 1. Define parameters in your custom function:
Copy code
json
{
 "type": "object",
 "properties": {
  "name": {
   "type": "string",
   "description": "User's name from the conversation"
  },
  "age": {
   "type": "number", 
   "description": "User's age mentioned in the call"
  }
 },
 "required": ["name", "age"]
}
2. The LLM processes user speech and calls your function: When your endpoint receives the request, the user's spoken information is automatically extracted and passed in the
args
field [(3) ]() [(2) ]() :
Copy code
javascript
// Request body structure
{
 "name": "get_user_details",
 "call": { /* call object with transcript */ },
 "args": {
  "name": "John Doe",
  "age": 26
 }
}
[(3) ]() , [(2) ]() 3. Access the extracted information in your endpoint: [(3) ]() [(2) ]()
Copy code
javascript
this.app.post("/check-weather", async (req, res) => {
 const content = req.body;
 if (content.args.city === "New York") {
  return res.json("25f and sunny") ;
 } else {
  return res.json("20f and cloudy") ;
 }
}) ;
[(3) ]() , [(2) ]() The key is defining clear parameter descriptions in your JSON schema - the LLM uses these descriptions to understand what information to extract from the user's speech and automatically populate the
args
object .
​ To learn more, see the sources I considered: [[1] Function Calling Overview](https://docs.retellai.com/build/single-multi-prompt/function-calling) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[3] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
y
where I define parameters in custom function
@AI Evy where I define parameters in custom function
a
Thanks for the follow-up, @yaro_30421. I'll get back to you soon.
### Answer You define parameters in your custom function during the setup process in the Retell AI dashboard [(1) ]() [(2) ]() . Here's exactly where and how: Step 6: Define parameters Define the parameters for the custom function using JSON schema format or JSON form [(1) ]() . Only available for POST, PATCH and PUT requests . Example parameter schema:
Copy code
json
{
 "type": "object",
 "properties": {
 "city": {
 "type": "string",
 "description": "The city of the weather"
 }
 },
 "required": [
 "city"
 ]
}
Important troubleshooting note: If you failed to save the custom function, it is likely because the parameters are not valid [(1) ]() [(2) ]() . One common mistake is not adding
"type": "object",
to the top level of the JSON schema . The parameters you define here will be automatically populated by the LLM based on what the user says during the conversation, and sent to your endpoint in the
args
field of the request body .
​ 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) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
y
why its not available in single prompt function @AI Evy
a
Thanks for the follow-up, @yaro_30421. I'll get back to you soon.
### Answer Actually, parameters are available in single prompt function! Looking at the Single Multi Prompt documentation, you can define parameters in custom functions using JSON schema format [(1) ]() . In the Single Multi Prompt custom function setup, Step 7 specifically states: "Define the parameters for the custom function using JSON schema format or JSON form. Only available for POST, PATCH and PUT requests" . The example parameter schema provided is:
Copy code
json
{
 "type": "object",
 "properties": {
 "city": {
 "type": "string",
 "description": "The city of the weather"
 }
 },
 "required": [
 "city"
 ]
}
The key point is that parameter definition is only available for POST, PATCH and PUT requests . If you're using GET or DELETE methods, you won't see the parameter definition option. Make sure you: 1. Select POST, PATCH, or PUT as your HTTP method 2. Include
"type": "object",
at the top level of your JSON schema (common mistake that prevents saving)
​ 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.