feat: add Avian as an LLM provider#11929
Conversation
|
Hi maintainers! This PR adds Avian as a new OpenAI-compatible LLM provider, following the same pattern used by existing providers like DeepSeek, xAI, and OpenRouter. The changes are minimal — just the new component module, registration in the components init, and a sidebar entry. cc @jordanrfrazier @edwinjosechittilappilly @ogabrielluiz — would appreciate a review when you get a chance. Thanks! |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThe pull request adds comprehensive support for Avian LLM integration by introducing a new AvianModelComponent. The component is registered across the frontend UI bundle options and backend component system, with lazy loading for on-demand module initialization. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 3 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 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 `@src/lfx/src/lfx/components/avian/avian.py`:
- Around line 95-99: The code in the models fetch block (the list comprehension
returning [model["id"] for model in model_list.get("data", [])]) assumes each
item is a dict with an "id" key and can raise KeyError/AttributeError/TypeError
for malformed entries; update the logic in the same try block (where model_list
is produced) to defensively validate each item (use isinstance(item, dict) and
item.get("id")) before including it, skip and optionally log malformed entries,
and broaden the exception handling to also catch/handle
KeyError/AttributeError/TypeError so malformed responses don't bypass the
RequestException handler; ensure the function still returns AVIAN_DEFAULT_MODELS
if no valid ids are found.
- Around line 132-143: The _get_exception_message method currently returns None
for non-BadRequestError cases and unsafely assumes e.body is a dict; update
_get_exception_message to (1) safely handle e.body which may be dict, string, or
None by checking its type before accessing .get("message"), (2) extract the
message from a dict body if present, or from a string body when applicable, and
(3) if no message is found return str(e) as a fallback so LCModelComponent
receives the base error message; reference the _get_exception_message function,
the BadRequestError import/instance check, and the e.body usage when making the
changes.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/frontend/src/utils/styleUtils.tssrc/lfx/src/lfx/components/__init__.pysrc/lfx/src/lfx/components/avian/__init__.pysrc/lfx/src/lfx/components/avian/avian.py
e2c57f8 to
2779045
Compare
cf079b7 to
5f293b9
Compare
|
Friendly follow-up — this PR is still active and ready for review. Would appreciate a look when you get a chance! cc @ogabrielluiz @Adam-Aghili |
|
Friendly follow-up — this PR is still active and ready for review. All feedback has been addressed. Would appreciate a look when you get a chance! cc @Adam-Aghili @keval718 |
|
Hey @ogabrielluiz @anovazzi1 — friendly follow-up on this PR. Avian is an OpenAI-compatible inference provider that's already live and powering apps like ISEKAI ZERO. This is a lightweight integration (standard OpenAI-compatible endpoint) and we're happy to address any feedback or make adjustments. Would love to get this merged if you have a moment to review. Thanks! |
Add AvianModelComponent with OpenAI-compatible API integration: - Model dropdown with dynamic fetch from /v1/models endpoint - Defensive validation of API responses (handles malformed data) - Safe exception message extraction for BadRequestError - JSON mode, temperature, seed, and max_tokens configuration - Fallback to default models on API errors - Frontend sidebar entry and component index registration
14 tests covering: - Component initialization and template generation - build_model with parametrized temperature/max_tokens - JSON mode binding - get_models: success, no API key, API error, malformed response, empty data - Error handling for ChatOpenAI exceptions - _get_exception_message with dict/string/None body types - update_build_config triggers and field filtering
5f293b9 to
de6bc26
Compare
|
Fixed Ruff PERF403 lint error: converted the for-loop dict population in |
Resolved SHA256 hash conflict in component_index.json by recalculating the integrity hash for the merged component index content. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Merged latest upstream main to resolve merge conflicts. Recalculated component_index.json integrity hash for the merged state. |
|
Addressed feedback: added to component registry and fixed display name |
|
CI status update: all 3 failures are unrelated to this PR's changes.
95 of 98 CI checks pass, including all backend tests, unit tests, integration tests, lint, ruff, Docker, and templates. Ready for review. |
|
Addressed feedback: registered component in init.py and added integration test. |
|
Fixed Ruff lint: removed unused mock argument in integration test. |
|
Resolved merge conflicts with latest upstream. |
Summary
Add Avian as a new LLM provider component. Avian is an OpenAI-compatible inference API offering access to frontier models at competitive pricing.
Supported models:
deepseek/deepseek-v3.2— 164K context, $0.26/$0.38 per M tokensmoonshotai/kimi-k2.5— 131K context, $0.45/$2.20 per M tokensz-ai/glm-5— 131K context, $0.30/$2.55 per M tokensminimax/minimax-m2.5— 1M context, $0.30/$1.10 per M tokensCapabilities: Chat completions, streaming, function calling/tools, tool_choice, response_format (JSON mode).
Changes
src/lfx/src/lfx/components/avian/— Avian model component usingChatOpenAIwith Avian's base URL (https://api.avian.io/v1), following the same pattern as DeepSeek/xAI/OpenRouter componentssrc/lfx/src/lfx/components/__init__.py— Registeravianmodulesrc/frontend/src/utils/styleUtils.ts— Add Avian to sidebar categories (usesBirdlucide icon as placeholder)Auth is via
AVIAN_API_KEYenvironment variable. The component supports dynamic model fetching from the/modelsendpoint when an API key is provided.Test plan
Summary by CodeRabbit
Release Notes