Skip to content

Generalize Continuous SystemMessage merging via model_info[“multiple_system_messages”] instead of startswith("gemini-") #6345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

SongChiYoung
Copy link
Contributor

Why are these changes needed?

The current implementation of consecutive SystemMessage merging applies only to models where model_info.family starts with "gemini-".

Since PR #6327 introduced the multiple_system_messages field in model_info, we can now generalize this logic by checking whether the field is explicitly set to False.

This change replaces the hardcoded family check with a conditional that merges consecutive SystemMessage blocks whenever multiple_system_messages is set to False.

Test cases that previously depended on the "gemini" model family have been updated to reflect this configuration flag, and renamed accordingly for clarity.

In addition, for consistency across conditional logic, a follow-up PR is planned to refactor the Claude-specific transformation condition
(currently implemented via create_args.get("model", "unknown").startswith("claude-"))
to instead use the existing is_claude().

Related issue number

Checks

@ekzhu ekzhu merged commit 1de07ab into microsoft:main Apr 21, 2025
59 checks passed
Copy link

codecov bot commented Apr 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.94%. Comparing base (99aac24) to head (e569bf0).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6345   +/-   ##
=======================================
  Coverage   77.94%   77.94%           
=======================================
  Files         214      214           
  Lines       15355    15355           
=======================================
  Hits        11968    11968           
  Misses       3387     3387           
Flag Coverage Δ
unittests 77.94% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

peterj added a commit to kagent-dev/autogen that referenced this pull request Apr 24, 2025
…e0424

* upstream/main:
  Remove `name` field from OpenAI Assistant Message (microsoft#6388)
  Introduce workbench (microsoft#6340)
  TEST/change gpt4, gpt4o serise to gpt4.1nano (microsoft#6375)
  update website version (microsoft#6364)
  Add self-debugging loop to `CodeExecutionAgent` (microsoft#6306)
  Fix: deserialize model_context in AssistantAgent and SocietyOfMindAgent and CodeExecutorAgent (microsoft#6337)
  Add azure ai agent (microsoft#6191)
  Avoid re-registering a message type already registered (microsoft#6354)
  Added support for exposing GPUs to docker code executor (microsoft#6339)
  fix: ollama fails when tools use optional args (microsoft#6343)
  Add an example using autogen-core and FastAPI to create streaming responses (microsoft#6335)
  FEAT: SelectorGroupChat could using stream inner select_prompt (microsoft#6286)
  Add experimental notice to canvas (microsoft#6349)
  DOC: add extentions - autogen-oaiapi and autogen-contextplus (microsoft#6338)
  fix: ensure serialized messages are passed to LLMStreamStartEvent (microsoft#6344)
  Generalize Continuous SystemMessage merging via model_info[“multiple_system_messages”] instead of `startswith("gemini-")` (microsoft#6345)
  Agentchat canvas (microsoft#6215)

Signed-off-by: Peter Jausovec <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants