#How to make the AI know when to call the function

1 messages · Page 1 of 1 (latest)

dire beacon
#

I'm trying to create an AI that handles leads coming from ads.

The AI's prompt contains instructions on how to conduct the service. In the middle of the instructions, I ask the AI to perform actions in the CRM, for example, after asking the lead for their name, I request:
"create a new contact in the CRM"

And then there is a function with the description:
"use this function to create a new contact in the CRM"

In this case, it works perfectly. The AI returns the function it will use, and the JSON parameters that the function requires. Then, through Python, I execute the function that creates a new contact in the CRM.

However, in the prompt, I ask the AI to perform another action. After asking all the questions to the lead, I ask the AI to add a tag "tag_name" in the CRM, and I created a function with the description:
"use this function to add the tag 'tag_name' in the CRM"
to identify which leads have answered all the questions.

But in this case, the AI is not understanding that it needs to call this function. Sometimes it works, but most of the time it doesn’t call it.

What would be the ideal prompt and function description to make the AI understand that it needs to call a function?

hazy shoal
#

create a series of prompts that asks or these sort of actions? you're running through some 'create contact' business logic and sending a prompt to create a contact. have it return the id of the contact created and ask it to create the tag in a separate prompt?

dire beacon
# hazy shoal create a series of prompts that asks or these sort of actions? you're running th...

Exactly. I handle all this process and logic through Python.
Regarding the problem I posted, I tested another function description and it worked.
I set the prompt to 'register the last response from the lead in the CRM', and now it understands that it needs to call the function to register the last response. In other words, as it's an input that depends on the lead's response, it made it understand that the function is 'important' for the conversation.

The problem with such function descriptions like 'Register something' is that the AI doesn't see a need to call it. If it was something like 'Use this function to pass the price', then it's much easier because the function is needed to respond to the lead. Unlike a function that 'registers' or 'updates' something.

Sorry for my english, Im using GPT to translate 😅

winged panther
dire beacon
# winged panther Interesting insight, thanks for sharing. Something that I have come to find usef...

I've thought about that too. However, the AI handles lead responses, and it converses by following steps. That is, it doesn't need to take action for every message. So, it's not every time it receives a message that it needs to do something.
When I thought of this idea, I considered adding a function that does nothing. Then the AI would choose this function while conversing, and when it needs to update something in the CRM or database, it would call the function. But I found it better to do it the way I described, for reasons of performance and speed. to also extract the maximum from the AI's intelligence instead of relying on makeshift or kludge solutions