https://retellai.com/?utm_source=discord&utm_medium=seo logo
, for some reason, when using gtp4
# ❓・ai-evy-support
s
@AI Evy , for some reason, when using gtp4.1 as the model, the AI agent does not invoke a specific function, but when using claude 4.0, it does however I dont want to use clause, I want to use gpt4,.1
a
Thanks for tagging me @simon_digilov. I'll look through relevant sources and get back to you shortly.
### Answer Based on the documentation, this appears to be a known issue with GPT-4.1's function calling consistency [(1) ]() . According to community feedback, GPT-4.1 is "not calling functions as consistently as 4o" . To improve function calling reliability with GPT-4.1, you can enable
tool_call_strict_mode
[(2) ]() [(3) ]() :
Copy code
javascript
const llmResponse = await client.llm.create({
  model: "gpt-4.1",
  tool_call_strict_mode: true
}) ;
[(2) ]() The
tool_call_strict_mode
parameter uses structured output to ensure tool call arguments follow the JSON schema, which may help with function calling consistency [(2) ]() [(3) ]() . Note that this feature is only applicable when the model is GPT-4o or GPT-4o mini , so it may not be available for GPT-4.1. Based on community experience, users have reverted back to GPT-4o due to these issues [(1) ]() , as "GPT-4o gives the best balance of quality, speed, and cost" . You might consider using GPT-4o instead, which is available as a model option [(2) ]() [(3) ]() and appears to have more reliable function calling behavior.
​ To learn more, see the sources I considered: [[1] 4.1 not calling functions as consistently as 4o](https://discord.com/channels/1186424376300679209/1362546174141137230) [[2] Create Retell LLM](https://docs.retellai.com/api-references/create-retell-llm) [[3] Update Retell LLM](https://docs.retellai.com/api-references/update-retell-llm) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
s
So i reverted to gtp 4o, and while testing the function is being called fine, but when I call the actual phone number, it doesn't call the function why
@AI Evy So i reverted to gtp 4o, and while testing the function is being called fine, but when I call the actual phone number, it doesn't call the function why
a
Thanks for the follow-up, @simon_digilov. I'll get back to you soon.
### Answer Based on the available sources, this behavior difference between testing and actual phone calls isn't directly addressed in the documentation. However, there are several configuration aspects that could affect function calling during actual phone calls: The function calling system works by having the LLM intelligently decide when to call functions by outputting structured JSON objects containing the necessary arguments [(1) ]() . Functions are configured in the agent detail page under the "Functions" section . For actual phone calls, ensure your agent configuration includes the necessary function tools. When creating phone calls via the API, you can use:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneCallResponse = await client.call.createPhoneCall({
 from_number: '+14157774444',
 to_number: '+12137774445',
}) ;
[(2) ]() The documentation mentions that custom tools support configurable speech behavior during and after execution, and support for background execution [(1) ]() . This suggests that function calling behavior might differ between testing environments and live calls. I don't have specific information about why functions work in testing but not during actual phone calls. For this specific troubleshooting scenario, you might want to: Check out these potentially useful sources: [Function Calling Overview]() , [Create Phone Call]() , [Create Agent]() Would you like me to try to provide a general answer based on my knowledge instead?
​ To learn more, see the sources I considered: [[1] Function Calling Overview](https://docs.retellai.com/build/single-multi-prompt/function-calling) [[2] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.