Repository navigation
feat: add deepseek provider support - #85
Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdded support for a new provider, Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI Entry Point
participant Config as Config Loader
participant App as App Pipeline
participant LLM as LLMProvider Plugin
participant Provider as Anthropic Provider
CLI->>Config: load_config(provider="deepseek", api_key=None)
Config->>Config: if api_key empty and provider=="deepseek" -> use DEEPSEEK_API_KEY
Config-->>App: return Config(with resolved api_key)
App->>App: normalize/validate resolved_key
App->>LLM: request provider instance (provider="deepseek")
LLM->>LLM: resolve api_key (explicit or DEEPSEEK_API_KEY)
LLM->>Provider: instantiate AnthropicProvider(base_url="https://api.deepseek.com/anthropic")
Provider-->>LLM: provider instance
LLM-->>App: configured provider returned
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@coding-agent/src/coding_agent/core/config.py`:
- Around line 104-107: The DeepSeek fallback currently only checks for presence
of "api_key" in values which misses empty-string keys; update the condition in
the provider-check block (the code manipulating values and reading
DEEPSEEK_API_KEY) to treat empty or falsy api_key as missing (e.g., use not
values.get("api_key") rather than "api_key" not in values) so that when provider
== "deepseek" and values["api_key"] is empty it will read DEEPSEEK_API_KEY from
the environment and assign it to values["api_key"] if present.
In `@coding-agent/tests/coding_agent/test_cli_pipeline.py`:
- Around line 518-536: The test
test_run_uses_deepseek_api_key_env_without_cli_api_key can be flaky if
AGENT_API_KEY is present; update the test to explicitly remove any ambient
AGENT_API_KEY before setting DEEPSEEK_API_KEY by calling
monkeypatch.delenv("AGENT_API_KEY", raising=False) (or equivalent) prior to
monkeypatch.setenv("DEEPSEEK_API_KEY", "deepseek-env-key") so that the code path
in coding_agent.__main__.main and the patched _run_headless uses
DEEPSEEK_API_KEY as intended.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4cb12c8f-cc28-4b51-8346-51b726447f58
📒 Files selected for processing (8)
coding-agent/README.mdcoding-agent/src/coding_agent/app.pycoding-agent/src/coding_agent/cli/repl.pycoding-agent/src/coding_agent/core/config.pycoding-agent/src/coding_agent/plugins/llm_provider.pycoding-agent/tests/coding_agent/plugins/test_llm_provider.pycoding-agent/tests/coding_agent/test_cli_pipeline.pycoding-agent/tests/core/test_config.py
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Summary
deepseekas an Anthropic-compatible provider usinghttps://api.deepseek.com/anthropic.DEEPSEEK_API_KEYfallback plus CLI/REPL/session restore wiring.Verification
uv run pytest tests/core/test_config.py tests/coding_agent/plugins/test_llm_provider.py tests/coding_agent/test_cli_pipeline.py tests/cli/test_repl.py::TestSessionManagerIntegration::test_switch_active_session_syncs_restored_model_into_repl_context tests/cli/test_repl.py::TestSessionManagerIntegration::test_switch_session_rejects_missing_restored_provider_without_mutating_state -vuv run python -m coding_agent --provider deepseek --model deepseek-v4-pro run --helpuv run python -c 'from coding_agent.plugins.llm_provider import LLMProviderPlugin; from coding_agent.providers.anthropic import AnthropicProvider; p = LLMProviderPlugin(provider="deepseek", model="deepseek-v4-pro", api_key="sk-test"); r = p.provide_llm(); assert isinstance(r, AnthropicProvider); assert r._base_url == "https://api.deepseek.com/anthropic"; assert r._api_key == "sk-test"; print(r.model_name, r._base_url)'Notes
tests/cli/still has two unrelated pre-existing failures in session restore tests that omit provider metadata.Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests