Conflicting Docs
The docs on this page state:
You can create custom functions that will be called by the LLM when needed. When called, Retell sends a POST request to your specified URL with the function name and parameters.
This seems to imply that Retell only works with POST requests. That doesn’t seem to be the case though because later in the page, you are instructed to:
Choose the HTTP method that Retell will use to send the request to your endpoint. Available methods include:
- GET, POST, PATCH, PUT, DELETE
Unclear/Missing Docs
How do you get the agent to actually pass conversation data to a GET query param? Query Params only seems to support hard coded value. The docs don’t cover how you can get your agent to do this.
For example I have an availability API that requires you to pass a day query parameter.
Hidden Knowledge in Docs
The docs state:
Add a name and description for the custom function. The name should be unique and separated with underscore.
If this is a requirement it should be mandated by the UI. The UI allows you to create custom function names without underscores.
After posting: I saw this other related post which instructs you to first extract the variables using the Extract Dynamic Variable Tool.
I followed those instructions.
I updated my custom function’s query parameter to use the variable {{requested_appointment_date}}:
I then created a Extract Dynamic Variable Function to extract that value from the conversation:
I then updated my prompt to ensure the LLM extracts the value before calling the custom function. My Prompt:
Call fetch_availability to answer the user’s availability related questions. Call extract_user_details before to ensure you have a valid requested_appointment_date. If you don’t, ask the user what date they’d like to come in.
I was able to get the LLM to properly insert the dynamic variable before making my GET request.
This seems like a very basic usecase and should be clearly documented in the retell docs.
Here’s a screenshot of the execution in the Test Agent UI.
There are still a few weird things happening though, which I could use some explanation on from the Retell support team:
-
The extract tool correct extracts a date before calling the Custom function. However the date is wrong. The LLM think it’s 2024 though Retell docs state the agent always knows the current date and time.
-
LLM hallucinates and comes up with “appointment_new_time” out of no where. Where is that even coming from? Is that submitting a POST request because GET requests don’t have bodies (at least in the Retell world).