Get artefacts in voice with gpt4o
# support
d
Hey I am getting a lot of artefacts like EXAMPLE: "Voice input: Here’s a comprehensive look at what might lie ahead.. . ### **1." The model then says outloud hashtag hashtag hashtag asterisk asterisk 1. I tried fixing it with the prompt but it doesnt work. Any way to parse artefacts out of LLM generation since it ruins the conversations?
v
Hi @DomnulZeu, I'm an AI assistant for Vapi. I'll analyze available sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Web Calling]() * [Get Assistant]() * [Core Models]() -----------------------------
### Answer To address the issue of artifacts in voice outputs with GPT-4, you can apply some parsing and cleaning techniques to filter out unwanted characters before converting the text back to speech. Here is a simple example of how you might achieve this using JavaScript:
Copy code
javascript
function cleanText(text) {
    // Remove unwanted artifacts such as hashtags and asterisks
    return text.replace(/[#*]+/g, '');
}

const assistantOptions = {
    name: "Vapi’s Pizza Front Desk",
    firstMessage: "Vappy’s Pizzeria speaking, how can I help you?",
    transcriber: {
        provider: "deepgram",
        model: "nova-2",
        language: "en-US",
    },
    voice: {
        provider: "playht",
        voiceId: "jennifer",
    },
    model: {
        provider: "openai",
        model: "gpt-4",
        messages: [
            {
                role: "system",
                content: `You are a voice assistant for Vappy’s Pizzeria, a pizza shop located on the Internet.
                Your job is to take the order of customers calling in. The menu has only 3 types
                of items: pizza, sides, and drinks. Be sure to introduce the menu items, don't assume that the caller knows what
                is on the menu. Once you have all the information you need pertaining to their order, you can
                end the conversation. Use casual and short responses.`,
            },
        ],
    },
};

// Clean the system prompt
assistantOptions.model.messages[0].content = cleanText(assistantOptions.model.messages[0].content);

vapi.start(assistantOptions);
This script cleans the text before it is processed by the TTS engine [(1)]() . For more detailed configurations, refer to Vapi’s [Quickstart Documentation]().
s
Did you write in the prompt that you shouldn't output # or anything?
l
It's not very clear how implement this code through your platform. Can you give to us more details? I've the same issue.
s
It should be fixed can you try once again?
l
unfortunately I receive in the answer soemtimes unwanted characters as **
s
can you send me the call_id with timestamp
l
I added in my prompt this instruction: * Always remove hashtags and asterisks from your answers and other unwanted artifacts such as /[#*]+/g, ''. but absolutely it doesn't work... Sometimes, especially when it uses the knowledge base, instead of giving to me the name of one product for example it says "* *"
s
Can you write a rule in like "you're a voice assistant, respond with 1-2 sentences in every turn and it should be in text format"
l
I tried but it doesn't work. Always **...
k
I am also having this issue.
s
can you try gpt4 turbo once and see if this issue is still there
also lower your token to 250
k
This seemed to correct the issue
s
@luke199335 can you try it as well?
l
Yes it looks that now it works... unfortunately it costs more and the latency is higher 😦
s
this issue wasn't there yesterday so it's not related to gpt4o.
l
Unfortunately after some test also with GPT4Turbo and 250 token I receive answers with ** ... I don't unserstand how fix this issue.
s
yes i even removed all ** from all the system prompts and still the same problem
and even with GPT 4 turbo the ** problem still presists!!!
any luck on fixing the issue??
s
You need to fix it via prompting. You can write something like “you're a voice assistant, respond with 1-2 sentences in every turn"
l
It didn't help to me
s
@luke199335 and @DomnulZeu Can you add this rule that states you need to provide the format in text format?
l
Where?
s
in your system prompt
For couple of people prompting is working and solving this issue @luke199335 @Sam
Added backend filter to remove it. So, you won't be facing any issues now. Can you please confirm it? @luke199335 @Sam @DomnulZeu
l
Ok, I'll try with system prompt. But what do you mean with "add backend filter" through the web platform? Thank you
s
By backend filter means, like we preprocess the text in order to make quality of the text you receive better. In reality if we just directly use deepgram with streaming then the quality will be very bad so we process few words to make it better.
l
Now the problem is that it doesn't say asteriks, *, anymore but it absolutely doesn't pronounce the name of my products. For example if my product is "1. [name product] is good for...", the system say "1. is good for..." so it misses the product name. I notice this problem when for example the name of the product is in strong/bold on gpt. How can I say to the system to pronounce these word but avoiding the asteriks or other special characters?
Any solution, please?
s
It is fixed.
l
Sorry, but I've always the same problem. For example if my product is "1. [name product] is good for...", the system say "1. is good for..." so it misses the product name.
s
it sounds like make.com issue or things are not populated properly.
l
Yes I'm using Vapi Function Calling with "Make" custom webhook amd - "make request" HTTP from Flowise API, with these settings: Method: POST Body type: Raw Content type: JSON (application/json) Request content: {"question": "1. message: functionCall: parameters: Question"} Pare response: Yes - and Webhook response: Status: 200 Body: 2. data: text Any setting suggested in "Make" or Vapi Function Calling to solve this issue?
s
Can you send a call_id so that I can see what is the exact payload which was sent during the call?
and can you please create a new support thread?
3 Views