-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Properly close model clients in documentation and samples #5898
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
Ensure that model clients are explicitly closed after use to prevent resource leaks.
|
@microsoft-github-policy-service agree |
ekzhu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Two things:
- We can share the model clients across agents. So in many cases we can keep the same usage of a single model client.
agent.close()doesn't close the model clients, so we should change those to callcloseon the model clinet.
...es/autogen-core/docs/src/user-guide/core-user-guide/design-patterns/multi-agent-debate.ipynb
Outdated
Show resolved
Hide resolved
- Added shared model clients across agents - Remove `agent.close()`
Fixed `memory.ipynb` file after incurring in merge conflict issues.
|
@ekzhu thank you for the feedback. I’ve addressed both points in the updates. Let me know if further adjustments are needed! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5898 +/- ##
=======================================
Coverage 76.73% 76.73%
=======================================
Files 191 191
Lines 13170 13170
=======================================
Hits 10106 10106
Misses 3064 3064
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Just a few more lint errors |
- Added `model_client` param in `migration_guide.md` - Moved model client initialization to `main` function of chess game example.
Why are these changes needed?
These changes ensures that the model clients in the documentation and samples are explicitly closed to prevent resource leaks and avoid runtime errors.
Refs:
Related issue number
Closes #5873
Checks