Skip to content

feat: add Avian as an LLM provider - #11929

Open
avianion wants to merge 14 commits into
langflow-ai:mainfrom
avianion:feat/add-avian-provider
Open

feat: add Avian as an LLM provider#11929
avianion wants to merge 14 commits into
langflow-ai:mainfrom
avianion:feat/add-avian-provider

Conversation

@avianion

@avianion avianion commented Feb 27, 2026

Copy link
Copy Markdown

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 tokens
  • moonshotai/kimi-k2.5 — 131K context, $0.45/$2.20 per M tokens
  • z-ai/glm-5 — 131K context, $0.30/$2.55 per M tokens
  • minimax/minimax-m2.5 — 1M context, $0.30/$1.10 per M tokens

Capabilities: Chat completions, streaming, function calling/tools, tool_choice, response_format (JSON mode).

Changes

  • New: src/lfx/src/lfx/components/avian/ — Avian model component using ChatOpenAI with Avian's base URL (https://api.avian.io/v1), following the same pattern as DeepSeek/xAI/OpenRouter components
  • Modified: src/lfx/src/lfx/components/__init__.py — Register avian module
  • Modified: src/frontend/src/utils/styleUtils.ts — Add Avian to sidebar categories (uses Bird lucide icon as placeholder)

Auth is via AVIAN_API_KEY environment variable. The component supports dynamic model fetching from the /models endpoint when an API key is provided.

Test plan

  • Verify component loads in the Langflow UI sidebar under "Avian"
  • Verify model dropdown populates with default models
  • Test chat completion with a valid Avian API key
  • Verify streaming works
  • Verify JSON mode works

Summary by CodeRabbit

Release Notes

  • New Features
    • Avian bundle now available in the sidebar menu.
    • New Avian LLM model component enables integration with Avian language models, supporting model selection, temperature, token limits, API credentials, and JSON response formatting.

@github-actions github-actions Bot added the community Pull Request from an external contributor label Feb 27, 2026
@avianion

Copy link
Copy Markdown
Author

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!

@coderabbitai

coderabbitai Bot commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8b55af04-5132-4363-b19d-52fdbc225f7d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The 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

Cohort / File(s) Summary
Frontend UI Bundle
src/frontend/src/utils/styleUtils.ts
Added Avian to SIDEBAR_BUNDLES list with display name "Avian", internal name "avian", and Bird icon.
Component Module Registration
src/lfx/src/lfx/components/__init__.py
Registered avian as a discoverable component module by adding it to TYPE_CHECKING imports, _dynamic_imports mapping, and __all__ exports.
Avian Module Initialization
src/lfx/src/lfx/components/avian/__init__.py
Implemented lazy dynamic import system with __getattr__ and __dir__ to enable on-demand loading of AvianModelComponent with error handling.
Avian Model Component
src/lfx/src/lfx/components/avian/avian.py
Introduced AvianModelComponent class extending LCModelComponent with input schema (max_tokens, model_kwargs, json_mode, model_name, api_base, api_key, temperature, seed), dynamic model retrieval via API with fallback defaults, configuration updates on API credential changes, and ChatOpenAI model building with langchain_openai integration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 3 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error PR introduces 175 lines of new Avian LLM provider code with zero test files, violating established project pattern where similar components have comprehensive unit tests. Create test file src/backend/tests/unit/components/languagemodels/test_avian.py with tests for initialization, template structure, build_model(), get_models() API calls, update_build_config(), and error handling.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Quality And Coverage ⚠️ Warning New Avian LLM provider component added with 178 lines of code but no corresponding test files found in the repository. Add comprehensive pytest test coverage for AvianModelComponent including API calls, error handling, model building, and edge cases.
Test File Naming And Structure ⚠️ Warning PR introduces AvianModelComponent (143 lines) with API interactions and error handling but lacks any test file coverage following project's established patterns. Create test file src/backend/tests/unit/components/languagemodels/test_avian.py with unit tests for component initialization, get_models(), build_model(), _get_exception_message(), and update_build_config() methods.
Excessive Mock Usage Warning ❓ Inconclusive Unable to assess PR mock usage without access to PR details, modified files, or test file content from the repository. Provide the PR identifier, repository path, specific test files to analyze, or the actual code changes to evaluate mock usage patterns.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding Avian as a new LLM provider component, which aligns with all file modifications across frontend, component registration, and the new Avian component implementation.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Feb 27, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6e95b7c and 05ec333.

📒 Files selected for processing (4)
  • src/frontend/src/utils/styleUtils.ts
  • src/lfx/src/lfx/components/__init__.py
  • src/lfx/src/lfx/components/avian/__init__.py
  • src/lfx/src/lfx/components/avian/avian.py

Comment thread src/lfx/src/lfx/components/avian/avian.py
Comment thread src/lfx/src/lfx/components/avian/avian.py Outdated
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Feb 27, 2026
@avianion
avianion force-pushed the feat/add-avian-provider branch from e2c57f8 to 2779045 Compare February 27, 2026 21:22
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Feb 27, 2026
@avianion
avianion force-pushed the feat/add-avian-provider branch from cf079b7 to 5f293b9 Compare February 28, 2026 19:25
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Feb 28, 2026
@avianion

avianion commented Mar 5, 2026

Copy link
Copy Markdown
Author

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

@avianion

avianion commented Mar 5, 2026

Copy link
Copy Markdown
Author

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

@avianion

avianion commented Mar 5, 2026

Copy link
Copy Markdown
Author

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!

@avianion
avianion force-pushed the feat/add-avian-provider branch from 5f293b9 to de6bc26 Compare March 6, 2026 21:11
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Mar 6, 2026
@avianion

Copy link
Copy Markdown
Author

Addressed feedback: hardened model parsing and exception handling

Verified both CodeRabbit findings against the current code:

  1. Model parsing (get_models) — Already hardened. The code uses isinstance(model_list, dict) before .get("data"), filters with isinstance(m, dict) and m.get("id"), catches (RequestException, ValueError, TypeError), and falls back to AVIAN_DEFAULT_MODELS when the result is empty.

  2. Exception handling (_get_exception_message) — Already hardened. The code uses getattr(e, "body", None) and isinstance(body, dict) before accessing .get("message"), and falls back to super()._get_exception_message(e) instead of returning None.

Both patterns are actually more defensive than the existing providers (deepseek, openai) which still use the raw model["id"] and e.body.get("message") patterns that CodeRabbit flagged. No changes needed.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 17, 2026
@avianion

Copy link
Copy Markdown
Author

Rebased and regenerated component index to fix CI

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 20, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Aug 1, 2026
@avianion

avianion commented Aug 8, 2026

Copy link
Copy Markdown
Author

Resolved merge conflicts with latest upstream main.

@avianion

Copy link
Copy Markdown
Author

CI Failure Analysis & Fix

PR-specific failures (fixed in 3fda46c)

  1. Ruff I001 import sortingavian.py had imports in wrong order (third-party before first-party). Fixed import ordering.

  2. ModuleNotFoundError: No module named 'lfx.components.avian' — Tests import from lfx.components.avian but the component lives in lfx_bundles.avian. Added the compatibility shim at src/lfx/src/lfx/components/avian/__init__.py (same pattern as deepseek, xai, etc) and registered avian in lfx.components.__init__.py.

  3. Migration table missing avian entriestest_provider_components_have_migration_targets[avian] failed because migration_table.json had no ext:avian:... targets. Added bare_class_name, import_path, and legacy_slot entries.

  4. pyproject.toml missing avian extra — The lfx-bundles pyproject.toml didn't list avian as an optional dependency or include it in the all/all-no-torch extras. Added it.

  5. Component index outdatedcomponent_index.json needs regeneration. The autofix.ci bot should handle this automatically on the next run.

Pre-existing failures (not caused by this PR)

  • Playwright Shard 47/70 — Also fails on other branches (e.g. kb-sidecar-weening). Flaky test, not related to this PR.
  • Docker image test — Runner received shutdown signal. Infra issue.
  • Bundled component registry empty — These LFX tests (test_upgrade_flow_check_passes_clean_real_flow_without_registry_mock, test_load_bundled_registry_is_populated, test_check_defaults_to_bundled_registry_for_clean_flow) fail because the component index hasn't been regenerated yet. Should resolve once the autofix bot commits the updated component_index.json.

@avianion

Copy link
Copy Markdown
Author

Addressed CI failures: added avian to frozen_component_dirs.txt baseline and fixed import/__all__ ordering in lfx/components/__init__.py to resolve Ruff I001 and RUF022 violations.

@avianion

Copy link
Copy Markdown
Author

Fixed the alphabetical ordering of avian vs assemblyai in the component index — assemblyai now correctly appears before avian in all three lists (TYPE_CHECKING imports, _dynamic_imports, all).

@avianion

Copy link
Copy Markdown
Author

Rebased on latest main and regenerated uv.lock. CI autofix should handle the component index and starter project updates.

@avianion

Copy link
Copy Markdown
Author

Resolved merge conflicts with latest upstream main.

@avianion

Copy link
Copy Markdown
Author

Resolved merge conflicts with latest upstream main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Pull Request from an external contributor enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant