refactor(core): Introduce provider architecture#382
Merged
Mzack9999 merged 5 commits intoprojectdiscovery:devfrom Oct 21, 2025
Merged
refactor(core): Introduce provider architecture#382Mzack9999 merged 5 commits intoprojectdiscovery:devfrom
Mzack9999 merged 5 commits intoprojectdiscovery:devfrom
Conversation
Closed
Mzack9999
approved these changes
Oct 21, 2025
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.
Related to #306
1. What this PR does / Why we need it
This Pull Request addresses issue #306 by refactoring the core architecture of
aixto support multiple LLM providers. It decouples the application from its tight integration with OpenAI by introducing a genericProviderinterface.This PR focuses exclusively on the foundational architectural changes and does not yet add a new provider. The primary goal here is to make the codebase more scalable, maintainable, and future-proof without altering any existing functionality.
A subsequent PR will leverage this new architecture to add support for local LLMs via Ollama.
2. Key Architectural Changes
To address the limitations of the original design, we've implemented a provider-centric architecture. The key changes are as follows:
2.1.
ProviderInterfaceProviderinterface ininternal/provider/provider.go.2.2.
OpenAIProviderrunner.gowas migrated into a newinternal/provider/openai.gofile.OpenAIProviderfully implements theProviderinterface, encapsulating all OpenAI-specific logic.2.3. Refactored
runner.goRunnernow acts as a high-level dispatcher.--providerflag, it will instantiate the appropriate provider and delegate all LLM-related tasks to it.2.4. Unified and Improved CLI Flags
--provider: A new flag to select the desired provider. In this PR, it only supports the defaultopenai.--modelConsolidation: The--gpt3and--gpt4flags have been removed. Model selection is now handled exclusively by the--modelflag for a consistent experience (e.g.,aix --model gpt-4-turbo).3. Verification: No Functionality Change
A primary goal of this refactoring was to ensure no existing functionality was lost. All features from the original OpenAI-only implementation have been successfully carried over.
--gpt3/--gpt4flags were deprecated in favor of a single, clearer--modelflag. This is a non-breaking improvement in user experience and extensibility.--list-modelsTemperatureandTopP, are correctly passed to the OpenAI client via the newChatOptionsstruct.go-openai's streaming client andio.Piperemains identical, ensuring the same performance and behavior.--system-context(-sc) flag functions exactly as it did before.4. Next Steps
Once this PR is approved and merged, I will submit a follow-up PR introducing the
OllamaProvider. This will enable local LLM support, fully resolving issue #306.