https://retellai.com/?utm_source=discord&utm_medium=seo logo
Can't send chat completion from agents perspective
# ❓・bug-report
b
So I'm trying to build a feature where I follow up with the customer if I haven't heard back from them in a given time period(e.x. 24 hours). So what I tried to do was call the API with something like
Copy code
ts
    await httpClient.post(
            `${retellApiUrl}/create-chat-completion`,
                    {
                        chat_id: existingRetellChatId,
                        content: followUpMessage,
                        role: 'agent',
                    }
The problem is that their isn't actually a "role" parameter that you can pass in, and I guess since the last message sent was by the agent, the next chat-completion automatically gets sent from the user role? So I get this mess where the agent is replying to itself(see screenshot). First I don't know if the completion should ever be sending as a user message? Or if there is a use case for that, then adding an optional agent param would be useful. https://cdn.discordapp.com/attachments/1479063975772819478/1479063977467183134/image.png?ex=69aaad2b&is=69a95bab&hm=97fc11d312a4cd328a5bb5bfd2342cda2b975d83356af9f9482bd26f89945623&
s
Hi @Ben
The create-chat-completion API only accepts chat_id and content as parameters. There is no role parameter. The endpoint always treats the content you send as a user message, which then triggers an agent response. That's why your follow-up message appears as a "User" message and the agent replies to it.
there's no way to inject a message as the agent role via create-chat-completion
b
Is this behavior something you'd be able to support?