Use "developer" role for remaining developer-intent messages in examples

This commit is contained in:
Paul Kompfner
2026-03-20 17:46:47 -04:00
parent 27fabfc1b3
commit 5806a3f0fa
34 changed files with 39 additions and 39 deletions

View File

@@ -151,7 +151,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
LLMMessagesAppendFrame(
messages=[
{
"role": "user",
"role": "developer",
"content": f"Greet the user and introduce yourself. Don't use emojis.",
}
],

View File

@@ -128,7 +128,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation
context.add_message(
{
"role": "user",
"role": "developer",
"content": "You are an AI assistant. You can help with a variety of tasks. Introduce yourself and ask the user what they would like to know.",
}
)

View File

@@ -164,7 +164,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": f"Please introduce yourself to the user. Use '{client_id}' as the user ID during function calls.",
}
)

View File

@@ -169,7 +169,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": f"Please introduce yourself to the user briefly; don't mention the camera. Use '{client_id}' as the user ID during function calls.",
}
)

View File

@@ -164,7 +164,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": f"Please introduce yourself to the user. Use '{client_id}' as the user ID during function calls.",
}
)

View File

@@ -202,7 +202,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": f"Please introduce yourself to the user. Use '{client_id}' as the user ID during function calls.",
}
)

View File

@@ -163,7 +163,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": f"Please introduce yourself to the user. Use '{client_id}' as the user ID during function calls.",
}
)

View File

@@ -163,7 +163,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": f"Please introduce yourself to the user. Use '{client_id}' as the user ID during function calls.",
}
)

View File

@@ -220,7 +220,7 @@ indicate you should use the get_image tool are:
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": f"Please introduce yourself to the user. Use '{client_id}' as the user ID during function calls.",
}
)

View File

@@ -102,7 +102,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
tools = ToolsSchema(standard_tools=[weather_function])
messages = [
{
"role": "user",
"role": "developer",
"content": "Start a conversation with 'Hey there' to get the current weather.",
},
]

View File

@@ -105,7 +105,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
messages = [
{
"role": "user",
"role": "developer",
"content": "Start a conversation with 'Hey there' to get the current weather.",
},
]

View File

@@ -172,7 +172,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": f"Please introduce yourself to the user and let them know the voices you can do. Your initial responses should be as if you were a {tts.current_voice}.",
}
)

View File

@@ -162,7 +162,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": f"Please introduce yourself to the user and let them know the languages you speak. Your initial responses should be in {tts.current_language}.",
}
)

View File

@@ -60,14 +60,14 @@ class IdleHandler:
if self._retry_count == 1:
# First attempt: Add a gentle prompt to the conversation
message = {
"role": "user",
"role": "developer",
"content": "The user has been quiet. Politely and briefly ask if they're still there.",
}
await aggregator.push_frame(LLMMessagesAppendFrame([message], run_llm=True))
elif self._retry_count == 2:
# Second attempt: More direct prompt
message = {
"role": "user",
"role": "developer",
"content": "The user is still inactive. Ask if they'd like to continue our conversation.",
}
await aggregator.push_frame(LLMMessagesAppendFrame([message], run_llm=True))

View File

@@ -152,10 +152,10 @@ Remember, your responses should be short. Just one or two sentences, usually. Re
# openai WebSocket API can understand.
context = OpenAILLMContext(
[{"role": "developer", "content": "Say hello!"}],
# [{"role": "user", "content": [{"type": "text", "text": "Say hello!"}]}],
# [{"role": "developer", "content": [{"type": "text", "text": "Say hello!"}]}],
# [
# {
# "role": "user",
# "role": "developer",
# "content": [
# {"type": "text", "text": "Say"},
# {"type": "text", "text": "yo what's up!"},

View File

@@ -159,10 +159,10 @@ Remember, your responses should be short. Just one or two sentences, usually. Re
# openai WebSocket API can understand.
context = LLMContext(
[{"role": "developer", "content": "Say hello!"}],
# [{"role": "user", "content": [{"type": "text", "text": "Say hello!"}]}],
# [{"role": "developer", "content": [{"type": "text", "text": "Say hello!"}]}],
# [
# {
# "role": "user",
# "role": "developer",
# "content": [
# {"type": "text", "text": "Say"},
# {"type": "text", "text": "yo what's up!"},

View File

@@ -226,7 +226,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": "Start the call by saying the word 'hello'. Say only that word.",
}
)

View File

@@ -303,7 +303,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": f"Please introduce yourself to the user. Use '{client_id}' as the user ID during function calls.",
}
)

View File

@@ -112,7 +112,7 @@ async def load_conversation(params: FunctionCallParams):
# commented out below, is part of this.
# messages.append(
# {
# "role": "user",
# "role": "developer",
# "content": f"{AWSNovaSonicLLMService.AWAIT_TRIGGER_ASSISTANT_RESPONSE_INSTRUCTION}",
# }
# )

View File

@@ -97,7 +97,7 @@ async def main():
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": "Start by greeting the user and ask how you can help.",
}
)

View File

@@ -130,7 +130,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": "Please introduce yourself to the user, asking them a question that will require a complete response. To start, say 'Let me start with a fun one. If you could travel anywhere in the world right now, where would you go and why?'",
}
)

View File

@@ -143,7 +143,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation with a weather-related prompt
context.add_message(
{
"role": "user",
"role": "developer",
"content": "Ask the user what city they'd like to know the weather for.",
}
)

View File

@@ -179,7 +179,7 @@ class InputTranscriptionContextFilter(FrameProcessor):
}
)
new_message_content.append(last_part)
msg = {"role": "user", "content": new_message_content}
msg = {"role": "developer", "content": new_message_content}
ctx = LLMContext([{"role": "system", "content": transcriber_system_message}, msg])
await self.push_frame(LLMContextFrame(context=ctx))
@@ -318,7 +318,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
messages = [
{
"role": "user",
"role": "developer",
"content": "Start by saying hello.",
},
]

View File

@@ -63,7 +63,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
context = LLMContext(
[
{
"role": "user",
"role": "developer",
"content": "Say hello.",
},
],

View File

@@ -88,7 +88,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
messages = [
{
"role": "user",
"role": "developer",
"content": 'Start by saying "Hello, I\'m Gemini".',
},
]

View File

@@ -83,7 +83,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
context = LLMContext(
[
{
"role": "user",
"role": "developer",
"content": "Start by greeting the user warmly, introducing yourself, and mentioning the current day. Be friendly and engaging to set a positive tone for the interaction.",
}
],

View File

@@ -133,7 +133,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
context = LLMContext(
[
{
"role": "user",
"role": "developer",
"content": [
{
"type": "text",
@@ -156,7 +156,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
context = LLMContext(
[
{
"role": "user",
"role": "developer",
"content": "Greet the user and explain that there was an issue with file upload, but you're ready to help with other tasks.",
}
]

View File

@@ -116,7 +116,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
context = LLMContext(
[
{
"role": "user",
"role": "developer",
"content": "Start by greeting the user warmly, introducing yourself, and mentioning the current day. Be friendly and engaging to set a positive tone for the interaction.",
}
],

View File

@@ -100,7 +100,7 @@ async def main():
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": "Start by saying 'Hello' and then a short greeting.",
}
)

View File

@@ -133,7 +133,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": "Start by saying 'Hello' and then a short greeting.",
}
)

View File

@@ -104,7 +104,7 @@ async def run_bot(pipecat_transport):
messages = [
{
"role": "user",
"role": "developer",
"content": "Start by greeting the user warmly and introducing yourself.",
}
]

View File

@@ -158,7 +158,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
{"role": "developer", "content": "Please introduce yourself to the user."}
)
evaluator_context.add_message(
{"role": "user", "content": "Ready to evaluate user messages."}
{"role": "developer", "content": "Ready to evaluate user messages."}
)
await task.queue_frames([LLMRunFrame()])

View File

@@ -63,7 +63,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
messages = [
{
"role": "user",
"role": "developer",
"content": "You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. Start by introducing yourself.",
},
]

View File

@@ -103,7 +103,7 @@ async def main():
# Kick off the conversation.
context.add_message(
{
"role": "user",
"role": "developer",
"content": "Start by greeting the user and ask how you can help.",
}
)