Skip to content
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

Make termination condition config declarative #4984

Merged
merged 10 commits into from
Jan 14, 2025

Conversation

victordibia
Copy link
Collaborator

Why are these changes needed?

Step 1 in making components in agentchat natively declarative.

from autogen_agentchat.conditions import StopMessageTermination, MaxMessageTermination 

max_term = MaxMessageTermination(5)
stop_term = StopMessageTermination() 

or_term = max_term | stop_term
print(or_term.dump_component() )
 
print(max_term.dump_component())

Results

ComponentModel(provider='autogen_agentchat.base._termination._OrTerminationCondition', 
component_type='termination', version=1, component_version=1, description=None, 
config={'conditions': [{'provider': 'autogen_agentchat.conditions.MaxMessageTermination', '
component_type': 'termination', 'version': 1, 'component_version': 1, 
'config': {'max_messages': 5}}, {'provider': 'autogen_agentchat.conditions.StopMessageTermination', 
'component_type': 'termination', 'version': 1, 'component_version': 1, 'config': {}}]})
ComponentModel(provider='autogen_agentchat.conditions.MaxMessageTermination', 
component_type='termination', version=1, component_version=1, 
description=None, config={'max_messages': 5})

Related issue number

Closes #4983

Checks

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.86%. Comparing base (9570e82) to head (9cc873d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4984      +/-   ##
==========================================
+ Coverage   68.53%   68.86%   +0.33%     
==========================================
  Files         156      156              
  Lines       10140    10252     +112     
==========================================
+ Hits         6949     7060     +111     
- Misses       3191     3192       +1     
Flag Coverage Δ
unittests 68.86% <100.00%> (+0.33%) ⬆️

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.

Copy link
Collaborator

@ekzhu ekzhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just to make sure, we will use the override for a cleaner provider path right?

@victordibia victordibia marked this pull request as ready for review January 11, 2025 03:00
@victordibia victordibia merged commit d883e3d into main Jan 14, 2025
63 checks passed
@victordibia victordibia deleted the agentchat_termination_config_vd branch January 14, 2025 03:30
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.

Support declarative configs for TerminationCondition
3 participants