feat: provider abstraction layer — BaseProvider ABC + ProviderFactory [GSoC 2026 Draft]#108
Open
vanshjohri09-collab wants to merge 1 commit intosugarlabs:mainfrom
Open
Conversation
Author
|
Hi @chimosky I've finalized the BaseProvider ABC and the Factory pattern This forms the foundation for my GSoC proposal Looking forward to your initial feedback on the architecture ,@walterbender @sum2it since you both have a great bird's-eye view of the project, I’d love your thoughts on whether this abstraction fits well with the upcoming UI features Ready for review! |
Member
|
Seeing as it's a GSoC project idea, I won't review this and would rather it be worked on within GSoC. |
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.
GSoC 2026 — Provider Abstraction Layer: Foundation
This draft PR introduces the foundational files for the provider
abstraction layer proposed in my GSoC 2026 application.
What this adds
app/providers/base.py—BaseProviderABC withgenerate(),chat(),stream(),health_check()abstract methodsapp/providers/factory.py—get_provider()readingAI_PROVIDERfrom
.env, defaulting tohuggingface_local(zero regression)app/providers/__init__.py— package initDesign decisions
Default is
huggingface_local— existing behaviour is fullypreserved. No deployment breaks if
AI_PROVIDERis not set.RAGAgent integration point:
app/routes/api.pycurrently callsRAGAgent(model=settings.DEFAULT_MODEL). After this project, thatbecomes:
This PR establishes the interface that makes that change possible.
What comes next (GSoC scope)
HuggingFaceLocalProvider— wraps existing inference codeOllamaProvider— local offline inference via/api/generateHuggingFaceAPIProvider— Inference API with tokenCustomProvider— any OpenAI-compatible endpointhealth_check()cachingpytest + mocktest suite (no real API needed in CI)Related
GSoC 2026 proposal: provider abstraction layer for sugar-ai
Fixes known bug:
extract_answer_from_output()breaks withnon-HuggingFace model output format (verified with llama3, mistral)
Draft — interface design open for mentor feedback before
implementation begins.