feat(providers): add Eden AI provider - #193
Conversation
saschabuehrle
left a comment
There was a problem hiding this comment.
Thanks for the provider contribution. I rebased the patch conceptually onto current main after #180 and the isolated tests, Ruff, and Black pass, but this is not merge-ready through cascadeflow’s actual configuration path.
Required before merge:
- Register
edenaiinModelConfig.validate_provider. TodayModelConfig(name="x", provider="edenai", cost=0)raises a validation error, so aCascadeAgentcannot configure this provider. - Add an
edenaientry toPROVIDER_CAPABILITIESwith the implemented streaming/tool/cost behavior. - Add an integration-level regression test that constructs
ModelConfigwithprovider="edenai"and resolves the provider fromPROVIDER_REGISTRY; direct-provider unit tests did not catch this blocker.
Official Eden AI V3 docs confirm the /v3/chat/completions endpoint, provider/model names, and top-level cost tracking, so those core API assumptions look reasonable. Please update against current main and re-request review.
Eden AI (https://www.edenai.co) is an OpenAI-compatible aggregator exposing 100+ models from many providers through a single EU-hosted endpoint and API key. Adds EdenAIProvider (cascadeflow/providers/edenai.py) mirroring the existing OpenAI-compatible providers, registers it in the provider registry, and documents the EDENAI_API_KEY in .env.example. The provider reads the per-request cost returned by the Eden AI API when present and falls back to a local pricing table otherwise. Models use Eden AI's provider/model naming. - API key via EDENAI_API_KEY env var only (never hardcoded or logged) - Streaming + tool-calling supported - Adds tests/test_edenai.py (11 tests, all passing) Signed-off-by: Victor M. SMITH <72023257+MVS-source@users.noreply.github.com>
Addresses review feedback: the provider was implemented but unreachable through cascadeflow's actual configuration path. - Register "edenai" in ModelConfig.validate_provider, so ModelConfig(provider="edenai") no longer raises a validation error and a CascadeAgent can configure the provider. - Add an "edenai" entry to PROVIDER_CAPABILITIES reflecting what the provider implements: streaming and tool calling supported, logprobs reported False (support varies per underlying model, matching EdenAIProvider._check_logprobs_support), and exact cost tracking since Eden AI returns the per-request cost in the response body. - Add tests/test_edenai_integration.py: integration-level regression coverage that builds ModelConfig, resolves the provider from PROVIDER_REGISTRY, wires up a CascadeAgent and checks the capability matrix against the implementation. The direct-provider unit tests instantiated EdenAIProvider themselves and so could not catch this. Rebased onto current main (after lemony-ai#180).
28de275 to
2730f1f
Compare
|
Thanks for the detailed review. All three blockers are addressed, rebased onto current main after #180.
One thing worth flagging: the first two blockers are coupled by your own test. Verification on my side: full suite green with the CI marker filter (1251 passed, 41 skipped), plus Ready for another look whenever you have time. |
🎯 Description
Adds Eden AI (https://www.edenai.co) as a native provider. Eden AI is an OpenAI-compatible aggregator that exposes 100+ models from many providers (OpenAI, Anthropic, Google, Mistral, DeepSeek, X.AI, …) through a single EU-hosted endpoint and one API key.
EdenAIProvidermirrors the existing OpenAI-compatible providers (closest analog:OpenRouterProvider). Because Eden AI returns the actual per-request cost in each response, the provider uses that value for accurate accounting and falls back to a local pricing table when it's absent. Follows the "Adding a New Provider" checklist in CONTRIBUTING.🔄 Type of Change
🧪 Testing
Test cases added
tests/test_edenai.py, 11 tests: init, completion, system prompt, API-cost vs local-pricing fallback, 401, 429, cost estimation)How to test
Verified locally:
pytest tests/test_edenai.py→ 11 passed; existing provider tests (groq/openai/ollama) → 49 passed, 1 skipped (no regressions);black/ruffclean. Live run:complete,stream, andfetch_available_models(763 models) all working; cost read from the API response.📝 Notes
provider/modelformat (e.g.mistral/codestral-latest).EDENAI_API_KEYonly — never hardcoded or logged.https://api.edenai.run/v3(EU-only endpoint available athttps://api.eu.edenai.run/v3).