feat: support multiple LLM providers (OpenAI, Anthropic, Ollama)#5
Open
Aditya8840 wants to merge 2 commits intomainfrom
Open
feat: support multiple LLM providers (OpenAI, Anthropic, Ollama)#5Aditya8840 wants to merge 2 commits intomainfrom
Aditya8840 wants to merge 2 commits intomainfrom
Conversation
Introduce a provider abstraction that decouples the agent loop from any specific LLM SDK. Each provider manages its own message format, tool schema conversion, and API interaction behind a unified interface. - Add LLMProvider ABC with add_user_message/get_tool_call/add_tool_result - Implement OpenAI, Anthropic, and Ollama providers - Ollama reuses OpenAI provider via inheritance (OpenAI-compatible API) - Add --provider CLI flag and DROIDPILOT_PROVIDER env var - Default model per provider (gpt-4o, claude-sonnet-4-20250514, llama3) - Anthropic SDK as optional dependency: pip install droidpilot[anthropic] - Add 20 unit tests covering registry, tool conversion, and all providers Closes #1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add GitHub Actions CI workflow (black, mypy, pytest) - Fix mypy arg-type error in ui_tree.py by asserting bounds is not None (already guaranteed by the _is_visible guard above) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Closes #1
LLMProviderabstraction that decouples the agent loop from any specific LLM SDK--providerCLI flag andDROIDPILOT_PROVIDERenv var for provider selectionpip install droidpilot[anthropic]Usage examples
Architecture
providers/base.pyLLMProviderABC defining the interfaceproviders/openai_provider.pyproviders/anthropic_provider.pyproviders/ollama_provider.pyproviders/__init__.pycreate_provider()factoryTest plan
black .formatting passesmypy .passes (only pre-existingui_tree.pyerror remains)🤖 Generated with Claude Code