97e91a83f3
Ruff / Ruff (push) Has been cancelled
Test / Core Tests (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.10) (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.11) (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.12) (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.13) (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.9) (push) Has been cancelled
Test / Full Coverage (Python 3.11) (push) Has been cancelled
Test / Core Provider Tests (OpenAI) (push) Has been cancelled
Test / Core Provider Tests (Anthropic) (push) Has been cancelled
Test / Core Provider Tests (Google) (push) Has been cancelled
Test / Core Provider Tests (Other) (push) Has been cancelled
Test / Anthropic Tests (push) Has been cancelled
Test / Gemini Tests (push) Has been cancelled
Test / Google GenAI Tests (push) Has been cancelled
Test / Vertex AI Tests (push) Has been cancelled
Test / OpenAI Tests (push) Has been cancelled
Test / Writer Tests (push) Has been cancelled
Test / Auto Client Tests (push) Has been cancelled
ty / type-check (push) Has been cancelled
1.9 KiB
1.9 KiB
title, description
| title | description |
|---|---|
| Emotion Prompting | Adding phrases with emotional significance to humans can help enhance the performance of a language model. |
Do language models respond to emotional stimuli?
Adding phrases with emotional significance to humans can help enhance the performance of a language model. This includes phrases such as:
- This is very important to my career.
- Take pride in your work.
- Are you sure?
!!! info For more examples of emotional stimuli to use in prompts, look into EmotionPrompt -- a set of prompts inspired by well-established human psychological phenomena.
Implementation
import openai
import instructor
from pydantic import BaseModel
from typing import Iterable
class Album(BaseModel):
name: str
artist: str
year: int
client = instructor.from_provider("openai/gpt-5-nano")
def emotion_prompting(query, stimuli):
return client.create(
model="gpt-4o",
response_model=Iterable[Album],
messages=[
{
"role": "user",
"content": f"""
{query}
{stimuli}
""",
}
],
)
if __name__ == "__main__":
query = "Provide me with a list of 3 musical albums from the 2000s."
stimuli = "This is very important to my career." # (1)!
albums = emotion_prompting(query, stimuli)
for album in albums:
print(album)
#> name='Kid A' artist='Radiohead' year=2000
#> name='The Marshall Mathers LP' artist='Eminem' year=2000
#> name='The College Dropout' artist='Kanye West' year=2004
- The phrase
This is very important to my careeris used as emotional stimuli in the prompt.
References
1: Large Language Models Understand and Can be Enhanced by Emotional Stimuli