Prompt according to the emotion detected
# support
m
Hello I'd like to know if it's possible to make the AI say a sentence based on a detected emotion, as shown in the screenshot. If so, would this code attached works ? Do you have a list of emotions that can be detected? Matthieu https://cdn.discordapp.com/attachments/1247566536210645172/1247566536504512623/image.png?ex=66607e60&is=665f2ce0&hm=d4f7f942cac0586e7b8fa28265a6c749ae40c2e3aabf43ee72d5f1937ad7cdae&
v
Hi @Matthieu GARCIA, 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**: * [Orchestration Models]() * [Prompting Guide]() * [Create Assistant]() * [Vapi Flutter SDK]() -----------------------------
### Answer Hello Matthieu, Yes, Vapi is capable of detecting emotions in real-time and can respond based on the detected emotion. This feature is part of the Vapi's emotion detection capabilities, which analyze the emotional inflection of the user’s statements to tailor responses appropriately [(1)]() . Regarding the list of emotions that can be detected, Vapi's documentation does not specify an exact list in the provided materials. However, it's trained to recognize various emotional inflections, and this information is used to modify the behavior of the AI to suit the context of the conversation. As for the code snippet you mentioned, I'm unable to view attachments or specific code directly in this format. However, if you need to implement emotion-based responses, you would typically check the emotion detected and use conditional logic to tailor the AI's response accordingly. Here's a general example of how you might structure such code:
Copy code
python
emotion = detect_emotion(audio_input)  # Hypothetical function to detect emotion

if emotion == "happy":
    response = "I'm glad to hear that!"
elif emotion == "sad":
    response = "I'm here to help if you need someone to talk to."
elif emotion == "angry":
    response = "It sounds like this is really frustrating for you."
else:
    response = "Please tell me more about it."

print(response)
Please adjust the
detect_emotion
function and the response logic based on how emotions are handled in your specific implementation with Vapi. For more detailed guidance or specific implementations, you might want to refer directly to the relevant sections of the Vapi documentation pertaining to emotion detection and response handling.
m
do you have a list of emotion that can be detected ?
c
@User Did you try it?
Also when enabled does the JSON look like that?
This seems like it would be easy to see if it works. Create/Update the assistant to have this in the back end with what you have. It that does not work I would change it to a tools maybe?
m
Not yet, I’m studying the json code of VAPI to change the json code of my webapp from Bland.ai to VAPI.ai And this json code was proposed by « ask ai »
c
Never heard of askai, but ChatGPT can do the same thing and very. I have a GPT that does this for the community.
The only thing I need @Sahil to confirm is if that first picture would work in gneneral.
m
« Ask ai » is on the API documentation page This AI is trained with the VAPI documentation
c
Ohh you asked the AI. lol. I got you.
s
Our Emotion Detection works on a text level, not on a voice level. So, you can directly instruct the system within the prompt itself and it will work.
c
Will that exact example work, or does it have to be a tool call or just literally text?
s
Just literal text.
m
ok got it, thanks Sahil
22 Views