Skip to content

Commit 2e1f730

Browse files
GWealecopybara-github
authored andcommitted
fix: Update LiteLLM system instruction role from "developer" to "system"
This change replaces the use of `ChatCompletionDeveloperMessage` with `ChatCompletionSystemMessage` and sets the role to "system" for providing system instructions to LiteLLM models Close #3657 Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 835388738
1 parent 52674e7 commit 2e1f730

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/google/adk/models/lite_llm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
from litellm import acompletion
4040
from litellm import ChatCompletionAssistantMessage
4141
from litellm import ChatCompletionAssistantToolCall
42-
from litellm import ChatCompletionDeveloperMessage
4342
from litellm import ChatCompletionMessageToolCall
43+
from litellm import ChatCompletionSystemMessage
4444
from litellm import ChatCompletionToolMessage
4545
from litellm import ChatCompletionUserMessage
4646
from litellm import completion
@@ -983,8 +983,8 @@ def _get_completion_inputs(
983983
if llm_request.config.system_instruction:
984984
messages.insert(
985985
0,
986-
ChatCompletionDeveloperMessage(
987-
role="developer",
986+
ChatCompletionSystemMessage(
987+
role="system",
988988
content=llm_request.config.system_instruction,
989989
),
990990
)

tests/unittests/models/test_litellm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ async def test_generate_content_async_with_system_instruction(
11951195

11961196
_, kwargs = mock_acompletion.call_args
11971197
assert kwargs["model"] == "test_model"
1198-
assert kwargs["messages"][0]["role"] == "developer"
1198+
assert kwargs["messages"][0]["role"] == "system"
11991199
assert kwargs["messages"][0]["content"] == "Test system instruction"
12001200
assert kwargs["messages"][1]["role"] == "user"
12011201
assert kwargs["messages"][1]["content"] == "Test prompt"

0 commit comments

Comments
 (0)