Skip to content

add multi-provider abstraction layer for AI model providers#55

Open
AjayBandiwaddar wants to merge 6 commits intosugarlabs:mainfrom
AjayBandiwaddar:feat/provider-abstraction
Open

add multi-provider abstraction layer for AI model providers#55
AjayBandiwaddar wants to merge 6 commits intosugarlabs:mainfrom
AjayBandiwaddar:feat/provider-abstraction

Conversation

@AjayBandiwaddar
Copy link

@AjayBandiwaddar AjayBandiwaddar commented Mar 3, 2026

Summary

Implements a provider abstraction layer in app/providers.py that enables Sugar-AI to support multiple AI model providers beyond HuggingFace.

Relates to #51.

Changes

This PR introduces the following in separate commits:

  • BaseProvider abstract class defining the common interface
  • HuggingFaceProvider implementing BaseProvider (existing behavior)
  • OpenAIProvider implementing BaseProvider
  • AnthropicProvider implementing BaseProvider
  • OllamaProvider implementing BaseProvider (local models, no API key)
  • get_provider() factory function for provider detection from model string

How provider detection works

Model strings with provider prefixes are routed accordingly:

  • openai/gpt-4 → OpenAIProvider
  • anthropic/claude-3 → AnthropicProvider
  • ollama/llama3 → OllamaProvider
  • anything else → HuggingFaceProvider (existing behavior unchanged)

Note

RAGAgent integration to actually use these providers is the next step.
This PR establishes the abstraction layer for review first.

AI Disclosure

This PR was developed with AI assistance (claude.ai). As per Sugar Labs contributing guidelines, I'm disclosing this. The AI helped me structure this, but I verified, and tested each change myself.

@AjayBandiwaddar
Copy link
Author

Hi @chimosky, I've opened this as the Phase 1 prototype for multi-provider support as discussed in #51. Would really appreciate your review. Thanks!

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.

1 participant