Skip to content

feat: add Avian as an LLM provider#11929

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

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

Conversation

@avianion
Copy link
Copy Markdown

@avianion avianion commented Feb 27, 2026

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
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 27, 2026

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

Run ID: 49abc2c1-767f-4f26-aa6f-aaaa4a0eed39

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 and usage tips.

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

@coderabbitai coderabbitai Bot left a comment

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
Copy link
Copy Markdown
Author

avianion commented Mar 5, 2026

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
Copy link
Copy Markdown
Author

avianion commented Mar 5, 2026

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
Copy link
Copy Markdown
Author

avianion commented Mar 5, 2026

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 and others added 4 commits March 6, 2026 21:11
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
@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 removed the enhancement New feature or request label Mar 6, 2026
@avianion
Copy link
Copy Markdown
Author

Fixed Ruff PERF403 lint error: converted the for-loop dict population in setup.py:68 to a dictionary comprehension. This was a pre-existing upstream lint issue that was blocking CI.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Mar 25, 2026
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>
@avianion
Copy link
Copy Markdown
Author

avianion commented Apr 4, 2026

Merged latest upstream main to resolve merge conflicts. Recalculated component_index.json integrity hash for the merged state.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 4, 2026
@avianion
Copy link
Copy Markdown
Author

Addressed feedback: added to component registry and fixed display name

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels May 11, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels May 13, 2026
@avianion
Copy link
Copy Markdown
Author

CI status update: all 3 failures are unrelated to this PR's changes.

  1. Update Component Index — fails on all fork PRs because the py_autofix.yml workflow checks out github.head_ref without specifying the fork repository. Same failure seen on recently-merged PR fix: OpenTelemetry trace context propagation #12962. The component index files in this PR are already correctly updated (verified manually).

  2. Playwright Shard 24/70 — the failing test (assistant-panel.spec.ts) was introduced in the latest main commit and consistently fails on Linux CI. Unrelated to the Avian provider changes.

  3. Coverage Reports — downstream of Shard 24 failure.

95 of 98 CI checks pass, including all backend tests, unit tests, integration tests, lint, ruff, Docker, and templates. Ready for review.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels May 14, 2026
@avianion
Copy link
Copy Markdown
Author

Addressed feedback: registered component in init.py and added integration test.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels May 14, 2026
@avianion
Copy link
Copy Markdown
Author

Fixed Ruff lint: removed unused mock argument in integration test.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels May 17, 2026
@avianion
Copy link
Copy Markdown
Author

Resolved merge conflicts with latest upstream.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels May 20, 2026
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