Skip to content

Conversation

@federicovilla55
Copy link
Contributor

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

federicovilla55 and others added 2 commits March 11, 2025 14:49
Ensure that model clients are explicitly closed after use to prevent resource leaks.
@federicovilla55
Copy link
Contributor Author

@microsoft-github-policy-service agree

Copy link
Contributor

@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.

Thanks for the PR. Two things:

  1. We can share the model clients across agents. So in many cases we can keep the same usage of a single model client.
  2. agent.close() doesn't close the model clients, so we should change those to call close on the model clinet.

- Added shared model clients across agents
- Remove `agent.close()`
Fixed `memory.ipynb` file after incurring in merge conflict issues.
@federicovilla55
Copy link
Contributor Author

@ekzhu thank you for the feedback. I’ve addressed both points in the updates. Let me know if further adjustments are needed!

@codecov
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.73%. Comparing base (3498c3c) to head (8170ab8).
Report is 1 commits behind head on main.

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           
Flag Coverage Δ
unittests 76.73% <ø> (ø)

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.

@ekzhu
Copy link
Contributor

ekzhu commented Mar 18, 2025

Just a few more lint errors

federicovilla55 and others added 3 commits March 18, 2025 23:21
- Added `model_client` param in `migration_guide.md`
- Moved model client initialization to `main` function of chess game example.
@ekzhu ekzhu enabled auto-merge (squash) March 20, 2025 07:45
@ekzhu ekzhu merged commit 262c74f into microsoft:main Mar 20, 2025
55 checks passed
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.

Update documentations and samples to properly close model clients

2 participants