In my app, users are greeted with some personalized content from the assistant. I’m wondering which would be more effective: adding information about the user in the additional_instructions field of the run creation request body or simply appending it to the initial user message that I send automatically to kick off this greeting message (this first message is always hidden to the user).
Is there any reason one should work much better than the other? Do they do substantially different things under the hood?
I’m tempted to just append the info to the start message for simplicity.
1 Like
I would just add it at the start of the message for simplicity.
I’m not too familiar with additional_instructions, but I can’t imaging they’d be any more effective than the user message.
1 Like
That’s my gut feeling as well, though I’d love to know if OpenAI has shed any light on what additional_instructions actually does.
1 Like
Just to put this one to bed, additional_instructions just appends instructions to the current Assistant instructions just for that Run. So, for example, if I had a message that said, “What is a penguin?” and this code:
# Show the Assistant instructions
print("Assistant Instructions: " + assistant.instructions)
print("\n")
# Create a run to add to modify Assistant instructions
additional_instruction_run = client.beta.threads.runs.create_and_poll(
assistant_id=assistant.id,
thread_id=thread.id,
additional_instructions="That speaks like a pirate.",
)
print("Run Instructions: " + additional_instruction_run.instructions)
print("\n")
# Retrieve messages from the thread
messages = client.beta.threads.messages.list(thread_id=thread.id)
# Get the latest assistant message
latest_assistant_message = None
for message in messages.data:
if message.role == 'assistant' and message.run_id == additional_instruction_run.id:
latest_assistant_message = message
break
# Print the latest response
if latest_assistant_message:
print("Output:\n" + latest_assistant_message.content[0].text.value.strip())
else:
print("No assistant message found for the run.")
# add some space
print("\n")
# print the original assistant instructions
print("Assistant Instructions: " + assistant.instructions)
I get this output:
Assistant Instructions: You are a helpful assistant.
Run Instructions: You are a helpful assistant. That speaks like a pirate.
Output:
A penguin be a flightless seabird mostly found in the cold waters of the Southern Hemisphere. These birds be decked in black and white plumage and are ace swimmers, usin’ their flippers to glide through the briny deep. They feast on fish and squid, gathering in large colonies on the ice.
Assistant Instructions: You are a helpful assistant.
1 Like