You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's an OpenAI API example, adding a name to messages for few-shot prompting:
openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{
"role": "system",
"content": "Translate from English to French"
},
{
"role": "system",
"name": "example_user",
"content": "How are you?"
},
{
"role": "system",
"name": "example_assistant",
"content": "Comment allez-vous?"
},
{
"role": "user",
"content": user_input
}
]
)
And here's the generated input to the model itself on OpenAI's end:
<|im_start|>system
Translate from English to French
<|im_end|>
<|im_start|>system name=example_user
How are you?
<|im_end|>
<|im_start|>system name=example_assistant
Comment allez-vous?
<|im_end|>
<|im_start|>user
{{user input here}}<|im_end|>
Can this be done with Guidance? If not, is it on the roadmap? It's a super useful trick for getting the most out of their models.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
OpenAI's ChatML includes an optional "name" field in addition to the role to indicate to the model who sent a given message:
Here's an OpenAI API example, adding a name to messages for few-shot prompting:
And here's the generated input to the model itself on OpenAI's end:
Can this be done with Guidance? If not, is it on the roadmap? It's a super useful trick for getting the most out of their models.
Beta Was this translation helpful? Give feedback.
All reactions