Skip to content

Develop - #88

Merged
christianchimezie merged 62 commits into
mainfrom
develop
Apr 5, 2026
Merged

Develop#88
christianchimezie merged 62 commits into
mainfrom
develop

Conversation

@christianchimezie

Copy link
Copy Markdown
Collaborator

Pull Request

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring (no functional changes)
  • Performance improvement
  • Test additions/improvements
  • CI/CD changes
  • Dependencies update

Related Issues

Closes #
Related to #

Changes Made

Documentation

  • I have updated the README.md (if needed)
  • I have updated TESTING.md (if test-related changes)
  • I have added/updated docstrings for new functions/classes
  • I have updated type hints/annotations
  • I have added comments for complex logic

Checklist

  • I have read the CONTRIBUTING guidelines
  • My branch is up to date with the target branch
  • I have resolved all merge conflicts
  • All CI/CD checks pass
  • Code has been reviewed by me
  • I have tested this on my local environment
  • Documentation is updated
  • Commit messages follow Conventional Commits

christianchimezie and others added 30 commits April 4, 2026 09:56
…LLM` querying with strategy-based execution, parallel model handling, multimodal message building, and weighted model scoring
…coding functions for `matplotlib` integration
…` models with endpoint, key validation, and model listing
…orting text and multimodal queries with validation
…point with query, list_models, and key validation
…PI` with query, list_models, and key validation
…providers, manage `API` keys, and handle queries
…order until success, with optional success tracking
…ghest-performance models with fallback to lower tiers
… provider/model pairs with iteration-aware selection
…ace` and `ProviderManager` with strategy-based model selection, remove `Groq`-specific hardcoding, and unify image handling
…add new `AI/LLM` packages; update `setup.py` to read `README` safely and include additional dependencies
…arams (strategy, models, iterations, interactivity, timeout)
DYung26 added 29 commits April 4, 2026 09:56
…, integration, and live test tiers

- Reorganize test structure from single test/ directory to tests/ with unit/, integration/, and live/ subdirectories
- Add @pytest.mark.live marker for opt-in live API tests requiring real credentials (GROQ_API_KEY, OPENAI_API_KEY)
- Create tests/unit/ directory with mocked API tests: test_exceptions.py, test_explanations_unit.py, test_plot_generator.py, test_suggestions_unit.py
- Create tests/integration/ directory with test fixtures for component interaction testing
- Create tests/live/ directory with test_live_explanations.py and test_live_suggestions.py for real API calls
- Consolidate shared fixtures into tests/conftest.py with session-scoped, data, plot, mock, and temporary file fixtures
- Add unit-specific fixtures in tests/unit/conftest.py and live-specific fixtures in tests/live/conftest.py
- Update TESTING.md documentation with new test structure, categories, markers, and execution examples
- Update pytest.ini testpaths from "test" to "tests" and add new "live" marker
- Update pytest.ini minversion from 8.3+ to 7.0+ to reflect actual requirement
- Remove deprecated test/ directory and all old test files (conftest.py, test_exceptions.py, test_explanations.py, test_plotgen.py, test_suggestions.py)
- Remove __pycache__ directories from git tracking (plotsense/, plotsense/explanations/, plotsense/visual_suggestion/) to honor .gitignore
- Fix SmartPlotGenerator._create_scatter() to handle pandas StringDtype and other non-standard types using pd.api.types.is_numeric_dtype() fallback
- Update .coverage metrics and pytest.log after test migration
…e dependencies

- environment.yml: add explicit version constraints for all AI provider packages (groq, openai, anthropic, google-genai>=1.69.0)
- pyproject.toml: add missing provider packages (openai, anthropic) and explicit google-genai>=1.69.0 version constraint to dependencies
- setup.py: update google-genai version constraint to >=1.69.0 for consistency
- requirements.txt: add version constraint google-genai>=1.69.0
- plotsense/core/providers/provider_manager.py: refactor _init_providers() to use api_keys as source of truth, validate restrict_to against available providers, add import for GroqOpenAIProvider, register groq_openai variant in SUPPORTED_PROVIDERS
- plotsense/core/providers/groq_openai.py: rename GroqProvider class to GroqOpenAIProvider for clarity and to avoid naming conflict with native Groq provider
- plotsense/core/ai_interface.py: remove broken finally block that was overriding successful query responses, add vendor extraction logic using split("_")[0], update all provider routing blocks to use exact vendor matching instead of substring matching, clarify _build_messages() parameter documentation
- pytest.ini: delete file (configuration now handled in pyproject.toml)
- tests/live/live_test_explanations.py: update to work with fixed provider selection logic
- tests/live/test_live_suggestions.py: update to work with fixed provider selection logic
- test_logs/pytest.log: update with latest test run results
…lement hidden API key input

* refactor(provider-manager): redesign provider selection with selected_providers as source of truth
  - Rename parameter restrict_to → selected_providers to clarify semantic intent
  - Implement corrected logic: selected_providers determines which providers to initialize
  - api_keys now only supplies credentials, not selection criteria
  - Add _get_api_key_for_provider() method for interactive prompting of selected providers
  - Unselected providers are never initialized, validated, or prompted for
  - Implement filter logic: only initialize providers explicitly requested or with available keys
  - Update error messages to clearly specify missing credentials vs configuration issues
  - Add comprehensive docstring explaining design principle

* feat(registry): load provider/model metadata from dynamic registry instead of hardcoded values
  - Update all provider files to call registry.get_provider_models() instead of returning hardcoded lists
  - Update groq.py, groq_openai.py, openai_chat.py, openai_response.py, anthropic.py, gemini.py
  - Update azure_openai.py, ollama_openai.py to use registry for model lists
  - Move model_costs hardcoded dict in ProviderManager to call registry.get_model_costs()
  - All providers now fetch models dynamically from loaded registry system

* feat(security): implement hidden API key input using getpass module
  - Update prompt_for_api_key() to use getpass.getpass() instead of builtins.input()
  - API keys no longer echoed to terminal, preventing storage in shell logs/history
  - Improve prompt text for required vs optional key entry
  - Apply same hiding to VisualizationRecommender interactive key input
  - Add comprehensive docstring for prompt function parameters and return value

* fix(error-handling): improve PlotExplainer model validation and error messages
  - Expand vendor-level model selections to match all provider variants
  - Validate requested models exist in registry before initialization
  - Generate clear error messages listing supported models per provider
  - Add logic to check vendor availability before attempting queries
  - Prevent cryptic "no available models" errors by validating selections upfront

* test(provider-selection): update tests to verify corrected provider selection behavior
  - Update test_selected_provider_missing_key to expect new error messages
  - Rename restrict_to to selected_providers in all test calls
  - Update test_restrict_to_filters_available_providers test
  - Update TestEdgeCases tests for new validation behavior
  - Add TestSelectedModelsSourceOfTruth test class with new test cases

* test(live): update live tests to work with redesigned provider selection
  - Update live_test_explanations.py to use selected_models parameter correctly
  - Update live_test_suggestions.py to use new provider selection semantics
  - Ensure tests work with both interactive and non-interactive modes
…rs.json and update notebook interactive parameters
… pyproject.toml, setup.py, github workflows, and documentation
…omatic complexity

Eliminated all flake8 linting violations across the codebase:

* W293 (87 violations): Removed trailing whitespace from blank lines in registry_loader.py, provider_manager.py, explanations.py, and utils.py
* W391 (13 violations): Removed trailing blank lines at end of file in provider implementations and strategy files
* F401 (4 violations): Removed unused datetime imports from registry_loader.py and builtins imports from utils.py and suggestions.py
* E302 (4 violations): Added missing blank lines before top-level class definitions in strategy.py, enums, base.py, and utils.py
* E261 (6 violations): Fixed inline comment spacing (single→double space before #) in ollama_openai.py and explanations.py
* E305 (1 violation): Added blank line between _query_model method and module-level comment in explanations.py
* E303 (1 violation): Removed extra blank line between methods in provider_manager.py
* E501 (1 violation): Broke long function signature in ai_interface.py._query_parallel() across multiple lines
* E251 (1 violation): Removed spaces around keyword parameter equals in explanations.py
* F841 (1 violation): Removed unused 'link' variable in provider_manager.py._init_providers()

Refactored 8 high-complexity functions to reduce cyclomatic complexity:

* AIModelInterface.query_model (12→6): Extracted _route_vendor_query() for vendor routing logic
* AIModelInterface.get_model_weights (12→4): Extracted _calculate_base_weight() helper
* AIModelInterface._build_messages (11→4): Extracted 5 vendor-specific message builders
* ProviderManager._init_providers (11→7): Extracted _init_provider_variants() for variant loop
* RegistryLoader._validate_registry (12→5): Extracted validation helper methods
* SmartPlotGenerator._create_scatter (14→8): Extracted dimension and title helpers
* plotgen (12→6): Extracted _extract_and_override_variables() to eliminate duplication
* VisualizationRecommender._apply_ensemble_scoring (13→4): Extracted recommendation collection helpers
@christianchimezie
christianchimezie merged commit c31a91f into main Apr 5, 2026
22 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.

3 participants