SillyTavern / SillyTavern-Extras

Extensions API for SillyTavern.
GNU Affero General Public License v3.0
563 stars 133 forks source link

Character Expressions: Using LLM for emotion classification #191

Closed hopto-dot closed 11 months ago

hopto-dot commented 11 months ago

Talking head and the Character Expressions extension should both give you the option to use the LLM to classify the emotion of the latest reply as it can be better at doing it (depending on the model obviously) AND is much more flexible. It also means you don't need to load another model into ram/vram.

Here is an example string you could use to do that:

"Oh no, really? *worried* Is it because it's from me?"

Out of the following emotions: joy, sad, neutral, terrified, surprised, embarrassed, anger, confusion

The sentence expresses: <answer>sad</answer>

"Oh it's just a present I bought for your birthday tomorrow! Surprise! *smiles*"

Out of the following emotions: joy, sad, neutral, terrified, surprised, embarrassed, anger, confusion

The sentence expresses: <answer>joy</answer>

"Woah, no way! You bought that just for me??"

Out of the following emotions: joy, sad, neutral, terrified, surprised, embarrassed, anger, confusion

The sentence expresses: <answer>surprised</answer>

"{current sentence}"

Out of the following emotions: joy, sad, neutral, terrified, surprised, embarrassed, anger, confusion

The sentence expresses: <answer>

After the final "Out of the following emotions:" you could have any custom emotion then have images in your emotion

Cohee1207 commented 11 months ago

One could use the newly added STscript to easily achieve this. Add as a quick reply and set to execute on character message.

/setglobalvar key=labels6emo ["joy", "sadness", "anger", "surprise", "love", "fear"] |
/genraw instruct=off stop=["\n"] {{lastMessage}}{{newline}}Pause your roleplay. Out of the following emotions: {{getglobalvar::labels6emo}}{{newline}}The message expresses: |
/fuzzy list=labels6emo |
/emote
hopto-dot commented 11 months ago

Thank you!