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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

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 56.05%. Comparing base (6bc285c) to head (489db97).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4984       +/-   ##
===========================================
- Coverage   72.42%   56.05%   -16.37%     
===========================================
  Files         112       67       -45     
  Lines        6494     5755      -739     
===========================================
- Hits         4703     3226     -1477     
- Misses       1791     2529      +738     
Flag Coverage Δ
unittests 56.05% <ø> (-16.37%) ⬇️

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.


component_config_schema = AndTerminationConditionConfig
component_type = "termination"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Shall we include component override for cleaner path?

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?

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
2 participants