Add shared LLM client cache clearing utilities for tests #1470
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

TL;DR
Added cache clearing functionality for LLM client singletons to improve test isolation and provide a way to reset client state.
What changed?
clear_cache()methods to all LLM client implementations (Anthropic, Azure OpenAI, Google, OpenAI)cache.pymodule with aclear_all_client_caches()function that clears all client caches at once__init__.pyfilestests/e2e/conftest.pythat clears client caches before and after each e2e testHow to test?
clear_all_client_caches()in a test or application codeWhy make this change?
This change improves test isolation by ensuring that cached LLM client singletons don't persist between tests, which could lead to test interference. It also provides a way for users to explicitly reset client state when needed, such as when changing API keys or endpoints during runtime.