Skip to content

feat:Add unified models API endpoint and tests#9215

Merged
edwinjosechittilappilly merged 12 commits into
model-credentialfrom
models-api
Jul 28, 2025
Merged

feat:Add unified models API endpoint and tests#9215
edwinjosechittilappilly merged 12 commits into
model-credentialfrom
models-api

Conversation

@edwinjosechittilappilly
Copy link
Copy Markdown
Collaborator

Introduces a new /models endpoint to the API for listing and filtering models across providers (OpenAI, Anthropic, Google Generative AI). Adds unified model metadata, filtering by provider, type, and other attributes, and includes unit tests for both the API and unified model logic.

lucaseduoli and others added 10 commits July 26, 2025 01:16
* Store mcp server headers

* Add headers on pre check url and is valid url

* adds validation of headers according to RFC 7230

* Fixed sanitized value

* Added backend tests for mcp util.py to increase coverage

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* make key pair input use flatmap id on data test ids

* added testids

* added random test names and added tests for persistence

* fix ruff lint

* [autofix.ci] apply automated fixes

* Fix mypy lint errors

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix(frontend): make entire sidebar non-selectable, clean up redundant select-none, keep cursor-default on headers/labels

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
* refactor: Standardize import statements and improve code formatting in reactflowUtils.ts

* [autofix.ci] apply automated fixes

* refactor: Standardize string quotes and improve test readability across multiple test files

- Updated string quotes from double to single in various test files for consistency.
- Enhanced test readability by replacing specific text selectors with test IDs.
- Adjusted wait conditions and element interactions to align with updated selectors.
- Ensured all tests maintain functionality while improving code clarity.

* [autofix.ci] apply automated fixes

* test: Add comprehensive Jest tests for createNewFlow function

- Introduced a new test file for the createNewFlow function to validate its behavior.
- Covered various scenarios including default value handling, flow parameter processing, edge cases, and special property handling.
- Ensured immutability of input parameters and consistency of output for the same inputs.
- Mocked dependencies to isolate the function's logic and improve test reliability.

* [autofix.ci] apply automated fixes

* test: Standardize string quotes and improve readability in auto-save and MCP server tests

- Updated string quotes from double to single for consistency across test files.
- Enhanced test readability by utilizing test IDs for element selection.
- Adjusted wait conditions and interactions to align with updated selectors while maintaining test functionality.

* [autofix.ci] apply automated fixes

* chore: update ESLint configuration and improve test selectors in auto-save-off.spec.ts

- Simplified ESLint configuration by removing unnecessary plugins and options.
- Enhanced test selectors in auto-save-off.spec.ts to use test IDs for better reliability and clarity.

* chore: enhance ESLint configuration with Prettier integration and improved rules

- Added Prettier as a plugin to the ESLint configuration for better code formatting.
- Updated parser options and extended rules for improved code quality and consistency.
- Ensured compatibility with TypeScript and React environments.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* audit details

* tabs pt 1

* tabs pt 2

* tabs pt 3

* tabs to details
* feat: Add smoke tests workflow for PR validation

- Adds smoke-test label trigger for running tests without API keys
- Runs backend tests excluding api_key_required markers
- Runs full frontend test suite with mocked APIs
- Provides fast feedback (~10-15 min) before lgtm label
- Enables external contributors to validate changes without API costs
- Comments results back to PR automatically

Usage: Add 'smoke-test' label to any PR to trigger

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Fix YAML indentation in smoke-tests workflow script block

* refactor: Focus smoke tests on critical functionality only

- Run only 10 essential backend test files (version, schema, serialization, etc.)
- Run only frontend unit tests (skip integration/e2e)
- Reduce timeout from 15 to 8 minutes
- Target critical functionality without external dependencies
- Avoid problematic database/API-dependent tests

* fix: Use correct Jest CLI option --testPathPatterns

* add frontend tests

* add tests

* change to essential tests

* fix: Create superuser in test_load_bundles_from_urls test

The test_load_bundles_from_urls test was failing because the load_bundles_from_urls
function expects a superuser to exist in the database, but the test client fixture
sets LANGFLOW_AUTO_LOGIN=false by default, which doesn't create a superuser.

This fix creates a superuser in the test database before calling the function,
resolving the 'Superuser not found in the database' error.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* add on conditions

* fix: Check PR labels correctly for smoke test trigger

Change condition from github.event.label.name to
github.event.pull_request.labels.*.name to work with all trigger
events (synchronize, opened, etc), not just labeled events.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* add workdispatch

* remove initial test

* adding timeout minutes

* edit env var

---------

Co-authored-by: Claude <noreply@anthropic.com>
* add template tests

* remove files

* adding validate flow build

* add validate endpoint and flow execution

* Update .github/workflows/template-tests.yml

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update src/backend/base/langflow/utils/template_validation.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* [autofix.ci] apply automated fixes

* change workflow running

* add ci

* fix test

* fix test

* delete when push

* fix: Exclude template tests from unit test bundle

Template tests are already run separately in CI via the test-templates job.
This change prevents duplicate execution and eliminates timeout failures
in the unit test suite by excluding slow template execution tests.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Exclude template tests from unit test bundle

Template tests are already run separately in CI via the test-templates job.
This change prevents duplicate execution and eliminates timeout failures
in the unit test suite by excluding slow template execution tests.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Exclude template tests from unit test bundle

Template tests are already run separately in CI via the test-templates job.
This change prevents duplicate execution and eliminates timeout failures
in the unit test suite by excluding slow template execution tests.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Remove remaining merge conflict markers

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Improve validate.py unit tests to eliminate CI failures

Fixed 4 failing tests in test_validate.py:
- test_code_with_syntax_error: Better error message handling for syntax errors
- test_raises_error_for_missing_function: Handle StopIteration along with ValueError
- test_creates_simple_class: Use optional constructor parameter to avoid TypeError
- test_handles_validation_error: Use proper ValidationError constructor from pydantic_core
- test_creates_context_with_langflow_imports: Remove invalid module patching
- test_creates_mock_classes_on_import_failure: Use proper import mocking

All 50 validate tests now pass consistently, improving CI stability.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* enhance: Add comprehensive edge case tests for template_validation.py

Added 6 additional test cases to improve coverage of template_validation.py:
- test_validate_stream_exception: Tests Graph.validate_stream() exception handling
- test_code_validation_other_exceptions: Tests TypeError/KeyError/AttributeError handling
- test_vertices_sorted_without_end_vertex_events: Tests variable usage tracking
- test_vertex_count_tracking: Tests vertex_count increment paths
- test_empty_lines_in_stream: Tests empty line handling in event streams
- test_event_stream_validation_exception: Tests exception handling in _validate_event_stream

These tests target the remaining 7 uncovered lines to maximize coverage percentage.
Total tests: 40 (all passing)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
* clean-up-and-clarify

* code-review

* correct-dockerfile
* ♻️ (components.py): refactor get_and_cache_all_types_dict function to filter out base components path and only load custom components for traditional full loading. This improves code readability and maintainability.

* ✨ (test_component_loading_fix.py): Add tests for the component loading fix that filters out BASE_COMPONENTS_PATH from custom components.

* [autofix.ci] apply automated fixes

* 🐛 (test_component_loading_fix.py): remove unnecessary test case for GitHub issue #8967 and fix test_component_merging_logic method to handle custom component loading failure properly
♻️ (test_component_loading_fix.py): refactor test_component_loading_fix.py to improve readability and remove redundant try-except block in test_component_merging_logic

* [autofix.ci] apply automated fixes

* ♻️ (components.py): refactor _process_single_module function to simplify create_component_template call and improve code readability
♻️ (components.py): refactor _determine_loading_strategy function to handle component loading strategy based on lazy_load_components setting and improve code structure

* 📝 (components.py): add comments and improve readability in _process_single_module function
✨ (components.py): introduce _determine_loading_strategy function to determine and execute the appropriate component loading strategy based on settings service

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Introduces a new /models endpoint to the API for listing and filtering models across providers (OpenAI, Anthropic, Google Generative AI). Adds unified model metadata, filtering by provider, type, and other attributes, and includes unit tests for both the API and unified model logic.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 28, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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.

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

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch models-api

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@edwinjosechittilappilly edwinjosechittilappilly changed the title Add unified models API endpoint and tests feat:Add unified models API endpoint and tests Jul 28, 2025
@SonicDMG SonicDMG temporarily deployed to models-api - langflow-manual-install PR #9215 July 28, 2025 19:36 — with Render Destroyed
@edwinjosechittilappilly edwinjosechittilappilly changed the base branch from main to model-credential July 28, 2025 19:36
@SonicDMG SonicDMG temporarily deployed to models-api - langflow-manual-install PR #9215 July 28, 2025 19:37 — with Render Destroyed
@SonicDMG SonicDMG temporarily deployed to models-api - langflow-manual-install PR #9215 July 28, 2025 19:37 — with Render Destroyed
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
5.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 28, 2025

Build successful! ✅
Deploying docs draft.
Deploy successful! View draft

@edwinjosechittilappilly
Copy link
Copy Markdown
Collaborator Author

Screenshot 2025-07-28 at 3 40 22 PM

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 28, 2025

Build successful! ✅
Deploying docs draft.
Deploy successful! View draft

@edwinjosechittilappilly edwinjosechittilappilly merged commit 2444dc3 into model-credential Jul 28, 2025
17 of 22 checks passed
@edwinjosechittilappilly edwinjosechittilappilly deleted the models-api branch July 28, 2025 20:07
HimavarshaVS pushed a commit that referenced this pull request Oct 21, 2025
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Rodrigo Nader <rodrigosilvanader@gmail.com>
Co-authored-by: Deon Sanchez <69873175+deon-sanchez@users.noreply.github.com>
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
Co-authored-by: Yuqi Tang <yuqi.tang@datastax.com>
fix: store mcp sse headers and use them on connection (#9148)
fix: prevent unintentional sidebar text selection (#8895)
fix: Exclude base path from custom component loading (#9098)
fix.py): remove unnecessary test case for GitHub issue #8967 and fix test_component_merging_logic method to handle custom component loading failure properly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants