refactor(core): unify initialization and testing of explainer and `…#6
Merged
Conversation
…recommender` modules with consistent `API` handling and helper usage - Added default argument values to `VisualizationRecommender` and `PlotExplainer` constructors for strategy, models, timeout, and interactivity - Introduced `self.api_keys` and standardized `ProviderManager` initialization across both components - Updated `test_explanations` to use shared helper functions `encode_image` and `save_plot_to_image` from `core.utils` - Revised `test_plotgen` to align with new `_default_plots` naming and initialization logic - Refactored `test_suggestions` to leverage new `ResponseParser`, updated recommendation pipeline, and aligned prompt/query flow - Commented deprecated internal tests tied to removed private methods (`_get_all_recommendations`, `_parse_recommendations`, etc.) - Ensured test assertions verify model availability and provider correctness under new recommender structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request refactors initialization and test logic for the
PlotExplainerandVisualizationRecommenderclasses, improves test reliability, and introduces a dedicated response parsing class. The main themes are improved default argument handling, more robust provider/model management, and test suite modernization to match the refactored APIs.Class Initialization and Provider Management:
VisualizationRecommender.__init__, and consistently storeapi_keysas a class attribute for use in provider management. [1] [2] [3]self.api_keysattribute, ensuring consistent API key handling. [1] [2]Test Suite Refactoring:
save_plot_to_image,encode_image) directly, instead of methods on the explainer instance, improving modularity and reliability. [1] [2]_default_plotsattribute and its initializer, reflecting internal API changes and improving clarity. [1] [2] [3]API and Interface Changes:
recommend_visualizationsand its returned objects for prompt building and dataframe description, replacing direct calls to internal methods. [1] [2]Response Parsing Refactor:
ResponseParserclass and updated all relevant tests to use it for recommendation parsing, improving separation of concerns and code clarity. [1] [2] [3]Mocking and Test Reliability:
These changes collectively modernize the codebase, improve maintainability, and ensure that tests are robust and aligned with the latest API refactors.