Skip to content

Commit 7d5c6b9

Browse files
Jacksunweicopybara-github
authored andcommitted
fix: Fixes the identity prompt to be one line and add ending period after description statement
From ``` You are an agent. Your internal name is "agent". The description about you is "test description" ``` to ``` You are an agent. Your internal name is "agent". The description about you is "test description". ``` PiperOrigin-RevId: 822358196
1 parent aab2504 commit 7d5c6b9

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/google/adk/flows/llm_flows/identity.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ async def run_async(
3434
self, invocation_context: InvocationContext, llm_request: LlmRequest
3535
) -> AsyncGenerator[Event, None]:
3636
agent = invocation_context.agent
37-
si = [f'You are an agent. Your internal name is "{agent.name}".']
37+
si = f'You are an agent. Your internal name is "{agent.name}".'
3838
if agent.description:
39-
si.append(f' The description about you is "{agent.description}"')
40-
llm_request.append_instructions(si)
39+
si += f' The description about you is "{agent.description}".'
40+
llm_request.append_instructions([si])
4141

4242
# Maintain async generator behavior
4343
if False: # Ensures it behaves as a generator

tests/unittests/flows/llm_flows/test_identity.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ async def test_with_description():
6464
):
6565
pass
6666

67-
assert request.config.system_instruction == "\n\n".join([
68-
'You are an agent. Your internal name is "agent".',
69-
' The description about you is "test description"',
70-
])
67+
assert (
68+
request.config.system_instruction
69+
== """\
70+
You are an agent. Your internal name is "agent". The description about you is "test description"."""
71+
)

0 commit comments

Comments
 (0)