Skip to content

feat: Add a GigaChat Bundle#10464

Open
krakenalt wants to merge 90 commits into
langflow-ai:mainfrom
krakenalt:feature/add_gigachat_bundle
Open

feat: Add a GigaChat Bundle#10464
krakenalt wants to merge 90 commits into
langflow-ai:mainfrom
krakenalt:feature/add_gigachat_bundle

Conversation

@krakenalt
Copy link
Copy Markdown

@krakenalt krakenalt commented Oct 31, 2025

Fixes: #11349
This pull request adds support for the GigaChat integration. The changes introduce GigaChat model and embedding components, update constants and metadata, add frontend icon support, and provide thorough documentation and tests for the new features.

Backend: GigaChat Component Integration

  • Added GigaChatComponent and GigaChatEmbeddingsComponent classes for model and embedding support, with dynamic imports and full parameterization for API usage
  • Defined GigaChat model and scope constants, including metadata for all supported and deprecated models
  • Added langchain-gigachat to the backend dependencies for model support.

Testing

  • Added unit tests for GigaChat constants and component integration, including parameter validation and model instantiation

Frontend: Icon and Sidebar Integration

  • Added a new GigaChat icon and integrated it into the eager and lazy icon import systems
  • Updated sidebar and node icon mappings to include GigaChat

Documentation

  • Added a documentation page for the GigaChat bundle

Summary by CodeRabbit

Release Notes

  • New Features
    • Added GigaChat language model component for generating text with adjustable parameters including model selection, temperature, max tokens, and more
    • Added GigaChat embeddings component for creating text embeddings
    • GigaChat bundle is now fully integrated into the component library with comprehensive documentation and visual support

@github-actions github-actions Bot added the community Pull Request from an external contributor label Oct 31, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 31, 2025

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.

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

Walkthrough

This PR introduces a comprehensive GigaChat integration including backend components for text generation and embeddings, frontend icons and sidebar registration, configuration constants, unit tests, and documentation pages with a new runtime dependency.

Changes

Cohort / File(s) Summary
Documentation
docs/docs/Components/bundles-gigachat.mdx, docs/sidebars.js
New documentation page describing GigaChat text generation and embeddings with parameter tables; sidebar entry added to Bundles section.
Dependency Management
pyproject.toml
Added runtime dependency langchain-gigachat>=0.3.12 to project dependencies.
Frontend Icons
src/frontend/src/icons/GigaChat/GigaChatIcon.jsx, src/frontend/src/icons/GigaChat/index.tsx, src/frontend/src/icons/eagerIconImports.ts, src/frontend/src/icons/lazyIconImports.ts
New SVG icon component and forwardRef wrapper; registered in both eager and lazy icon import mappings.
Frontend UI Integration
src/frontend/src/utils/styleUtils.ts
Added GigaChat entry to SIDEBAR_BUNDLES and mapped GigaChatModel and GigaChatEmbeddings to GigaChat icon in nodeIconToDisplayIconMap.
Backend Constants
src/lfx/src/lfx/base/models/gigachat_constants.py
New module defining GigaChat model metadata, chat model names, scopes, and embedding model names.
Backend Components
src/lfx/src/lfx/components/gigachat/gigachat_models.py, src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py
New GigaChatComponent and GigaChatEmbeddingsComponent classes with configurable inputs and build methods.
Component Registration
src/lfx/src/lfx/components/__init__.py, src/lfx/src/lfx/components/gigachat/__init__.py
Added gigachat to component discovery and lazy-loading infrastructure; package-level init with dynamic imports for component exposure.
Unit Tests
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py, src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
New test modules validating GigaChat constants (models, scopes) and component template/model building.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • GigaChatComponent and GigaChatEmbeddingsComponent: Verify parameter handling, defaults, and GigaChat instantiation logic align with langchain-gigachat API expectations
  • Unit test coverage: Ensure test assertions comprehensively cover edge cases for model names, scopes, and component template generation
  • Lazy import mechanism in src/lfx/src/lfx/components/gigachat/__init__.py: Confirm getattr and dir implementation follows established patterns and handles import errors gracefully
  • Frontend icon registration consistency: Verify GigaChat icon is correctly wired across eager, lazy, and sidebar mappings without duplication or naming mismatches

Possibly related PRs

Suggested labels

size:L, python, lgtm

Suggested reviewers

  • edwinjosechittilappilly
  • jordanrfrazier
  • Adam-Aghili
🚥 Pre-merge checks | ✅ 3 | ❌ 4
❌ Failed checks (1 error, 3 warnings)
Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error The PR introduces two new public components (GigaChatComponent and GigaChatEmbeddingsComponent), constants, documentation, and frontend icons. Test coverage includes 7 tests for constants and 2 tests for the model component. However, a critical gap exists: GigaChatEmbeddingsComponent is exported in __all__ and has a public build_embeddings() method with multiple inputs and parameters, but has no corresponding test file. The embeddings component requires similar test coverage to the model component (template validation, parameter inputs, model instantiation). Additionally, frontend icon components lack tests. When compared to similar bundles (CometAPI has 13 model tests), the coverage is incomplete. The PR review comments identify several unfixed issues (docstring error, wrong URL in test, Russian text), indicating testing gaps were not addressed. Add a test file src/backend/tests/unit/components/bundles/gigachat/test_gigachat_embeddings.py that mirrors the model component tests, verifying GigaChatEmbeddingsComponent's template generation and the build_embeddings() method returns a valid GigaChatEmbeddings instance. Include fixture definitions for model, scope, credentials, and other embeddings inputs. Additionally, consider adding frontend tests for the GigaChat icon components and ensure all review comment issues are addressed before merging.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Test Quality And Coverage ⚠️ Warning The test suite for the GigaChat bundle is significantly incomplete and lacks adequate coverage. The constants tests are reasonably comprehensive with 7 tests covering model lists, duplicates, and required scopes. However, the component tests are severely lacking: only 2 tests exist for the GigaChatComponent (test_template and test_build_model_integration), compared to 13 tests for the similar CometAPI component. More critically, there are zero tests for the GigaChatEmbeddingsComponent despite it being a full implementation with 9 input parameters and a build_embeddings method—this is a complete omission. The existing component tests are primarily smoke tests that don't validate parameter handling, error scenarios, streaming behavior, or optional parameter combinations. Additionally, one test uses an incorrect OpenAI URL instead of a GigaChat-appropriate URL, and the constants test has a copy-paste docstring error. There are no frontend tests for the new GigaChatIcon component either. The test coverage follows the project's pytest patterns but falls short of the CometAPI bundle's testing comprehensiveness, which includes parameter validation, error handling, JSON mode tests, streaming tests, and integration tests. To pass this check, the PR should include: (1) comprehensive tests for GigaChatEmbeddingsComponent with parameter validation and build_embeddings integration tests; (2) additional GigaChatComponent tests covering parameter handling, optional fields, error scenarios, and streaming behavior; (3) correct test data (use GigaChat API URLs instead of OpenAI URLs); (4) fix the docstring copy-paste error in test_gigachat_constants.py; and (5) consider adding basic frontend tests or unit tests for the GigaChatIcon component to match coverage expectations of similar PRs. The test suite should move beyond smoke tests to validate actual functional behavior and parameter combinations.
Test File Naming And Structure ⚠️ Warning The test file naming and structure partially comply with the requirements but have significant gaps. Backend tests follow the correct test_*.py naming convention and proper pytest structure with descriptive test function names organized into classes with fixtures. However, the test suite is incomplete: no tests exist for the GigaChatEmbeddingsComponent despite being a primary component added in this PR, no negative or error scenario tests are included, and edge cases are not covered. More critically, frontend tests are completely absent despite the PR adding icon components and utility mappings; the codebase has established Playwright test patterns that should be applied here. The existing integration test also uses an incorrect URL for GigaChat testing. Add comprehensive test coverage by: (1) creating test_gigachat_embeddings.py in the same test directory to cover the GigaChatEmbeddingsComponent with positive and negative scenarios, (2) adding frontend tests using Playwright for the GigaChat icon components and icon import/mapping changes, (3) including edge case and error condition tests for both backends (e.g., invalid models, missing credentials, malformed parameters), and (4) fixing the integration test to use a correct GigaChat API URL instead of the OpenAI URL.
✅ Passed checks (3 passed)
Check name Status Explanation
Excessive Mock Usage Warning ✅ Passed The GigaChat test suite demonstrates good test design practices. The constants test contains no mocks and validates real data structures. The component tests create real GigaChatComponent instances and call actual methods like build_model() and build_custom_component_template(), validating that they return real GigaChat objects and template dictionaries. While the base test class includes infrastructure mocks for framework dependencies (vertex, graph, logging), these are legitimate external dependencies used to provide test context, not business logic mocks. The tests do not obscure functionality through excessive mocking and focus on validating real component behavior and object instantiation.
Title check ✅ Passed The title 'feat: Add a GigaChat Bundle' directly and clearly summarizes the main change—introducing GigaChat integration as a new bundle with components, constants, testing, frontend UI, and documentation.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 Oct 31, 2025
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: 4

🧹 Nitpick comments (3)
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py (1)

30-45: Consider adding test for max_tokens range validation.

The component defines max_tokens with a range of 0-128000, but the test doesn't verify that this constraint is properly enforced in the template. Consider adding a test case to validate the range_spec is correctly set.

src/lfx/src/lfx/components/gigachat/gigachat_models.py (1)

70-77: Clarify the default "USERNAME" value.

The default value "USERNAME" for the user input is a string literal placeholder, which might be confusing. Consider using None as the default and updating the info text to clarify that a username should be provided if required by the API.

Consider this adjustment:

         StrInput(
             name="user",
             display_name="GigaChat User",
-            info="The GigaChat API Username to use.",
+            info="The GigaChat API Username to use (if required by your authentication method).",
             advanced=True,
-            value="USERNAME",
+            value=None,
             required=False,
         ),
src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py (1)

59-66: Clarify the default "USERNAME" value.

Similar to the models component, the default value "USERNAME" is a string literal placeholder that might be confusing. Consider using None and updating the info text to clarify when a username is needed.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4e77ad and 47482f2.

⛔ Files ignored due to path filters (2)
  • src/frontend/src/icons/GigaChat/gigachat.svg is excluded by !**/*.svg
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (15)
  • docs/docs/Components/bundles-gigachat.mdx (1 hunks)
  • docs/sidebars.js (1 hunks)
  • pyproject.toml (2 hunks)
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py (1 hunks)
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py (1 hunks)
  • src/frontend/src/icons/GigaChat/GigaChatIcon.jsx (1 hunks)
  • src/frontend/src/icons/GigaChat/index.tsx (1 hunks)
  • src/frontend/src/icons/eagerIconImports.ts (2 hunks)
  • src/frontend/src/icons/lazyIconImports.ts (1 hunks)
  • src/frontend/src/utils/styleUtils.ts (2 hunks)
  • src/lfx/src/lfx/base/models/gigachat_constants.py (1 hunks)
  • src/lfx/src/lfx/components/__init__.py (3 hunks)
  • src/lfx/src/lfx/components/gigachat/__init__.py (1 hunks)
  • src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py (1 hunks)
  • src/lfx/src/lfx/components/gigachat/gigachat_models.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (17)
docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)

docs/**/*.{md,mdx}: All Markdown/MDX pages must start with front matter including at least title and description; include sidebar_position for docs pages when applicable
Code blocks must specify a language and may include a title (```lang title="…")
Use sentence case for headings and keep paragraphs short and scannable
Write in second person, present tense, with a professional but approachable tone
Use inline code with backticks for code terms; use bold for UI elements and italics for emphasis; keep lists in parallel structure
Ensure internal links are functional and navigation works (update cross-references as needed)
Verify all code examples in docs and blog actually run as shown
Use correct terminology capitalization: Langflow, Component, Flow, API, JSON
Reference images with absolute paths under /img/... and provide descriptive alt text

Files:

  • docs/docs/Components/bundles-gigachat.mdx
docs/docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)

Use Docusaurus admonitions (:::+tip|warning|danger) instead of custom callouts in docs pages

Files:

  • docs/docs/Components/bundles-gigachat.mdx
src/frontend/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)

src/frontend/src/**/*.{ts,tsx,js,jsx}: All frontend TypeScript and JavaScript code should be located under src/frontend/src/ and organized into components, pages, icons, stores, types, utils, hooks, services, and assets directories as per the specified directory layout.
Use React 18 with TypeScript for all UI components in the frontend.
Format all TypeScript and JavaScript code using the make format_frontend command.
Lint all TypeScript and JavaScript code using the make lint command.

Files:

  • src/frontend/src/icons/eagerIconImports.ts
  • src/frontend/src/icons/lazyIconImports.ts
  • src/frontend/src/icons/GigaChat/index.tsx
  • src/frontend/src/utils/styleUtils.ts
  • src/frontend/src/icons/GigaChat/GigaChatIcon.jsx
src/frontend/src/icons/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)

Use Lucide React for icons in the frontend.

Files:

  • src/frontend/src/icons/eagerIconImports.ts
  • src/frontend/src/icons/lazyIconImports.ts
  • src/frontend/src/icons/GigaChat/index.tsx
  • src/frontend/src/icons/GigaChat/GigaChatIcon.jsx
src/frontend/src/icons/lazyIconImports.ts

📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)

Add your icon to the lazyIconsMapping object in src/frontend/src/icons/lazyIconImports.ts with a key that matches the backend icon string exactly.

Files:

  • src/frontend/src/icons/lazyIconImports.ts
src/frontend/src/icons/*/*.@(js|jsx|ts|tsx)

📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)

Create a new directory for your icon in src/frontend/src/icons/YourIconName/ and add your SVG as a React component (e.g., YourIconName.jsx). The SVG component must use the isDark prop to support both light and dark mode.

Files:

  • src/frontend/src/icons/GigaChat/index.tsx
  • src/frontend/src/icons/GigaChat/GigaChatIcon.jsx
src/frontend/src/icons/*/index.tsx

📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)

Create an index.tsx in your icon directory that exports your icon using forwardRef and passes the isDark prop.

Files:

  • src/frontend/src/icons/GigaChat/index.tsx
docs/sidebars.js

📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)

Keep sidebars.js updated to include new/changed docs sections and items using Docusaurus category structure

Files:

  • docs/sidebars.js
src/frontend/src/utils/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)

All utility functions should be placed in the utils directory.

Files:

  • src/frontend/src/utils/styleUtils.ts
src/backend/tests/unit/components/**/*.py

📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)

src/backend/tests/unit/components/**/*.py: Mirror the component directory structure for unit tests in src/backend/tests/unit/components/
Use ComponentTestBaseWithClient or ComponentTestBaseWithoutClient as base classes for component unit tests
Provide file_names_mapping for backward compatibility in component tests
Create comprehensive unit tests for all new components

Files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
{src/backend/**/*.py,tests/**/*.py,Makefile}

📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)

{src/backend/**/*.py,tests/**/*.py,Makefile}: Run make format_backend to format Python code before linting or committing changes
Run make lint to perform linting checks on backend Python code

Files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
src/backend/tests/unit/**/*.py

📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)

Test component integration within flows using create_flow, build_flow, and get_build_events utilities

Files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
src/backend/tests/**/*.py

📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)

src/backend/tests/**/*.py: Unit tests for backend code must be located in the 'src/backend/tests/' directory, with component tests organized by component subdirectory under 'src/backend/tests/unit/components/'.
Test files should use the same filename as the component under test, with an appropriate test prefix or suffix (e.g., 'my_component.py' → 'test_my_component.py').
Use the 'client' fixture (an async httpx.AsyncClient) for API tests in backend Python tests, as defined in 'src/backend/tests/conftest.py'.
When writing component tests, inherit from the appropriate base class in 'src/backend/tests/base.py' (ComponentTestBase, ComponentTestBaseWithClient, or ComponentTestBaseWithoutClient) and provide the required fixtures: 'component_class', 'default_kwargs', and 'file_names_mapping'.
Each test in backend Python test files should have a clear docstring explaining its purpose, and complex setups or mocks should be well-commented.
Test both sync and async code paths in backend Python tests, using '@pytest.mark.asyncio' for async tests.
Mock external dependencies appropriately in backend Python tests to isolate unit tests from external services.
Test error handling and edge cases in backend Python tests, including using 'pytest.raises' and asserting error messages.
Validate input/output behavior and test component initialization and configuration in backend Python tests.
Use the 'no_blockbuster' pytest marker to skip the blockbuster plugin in tests when necessary.
Be aware of ContextVar propagation in async tests; test both direct event loop execution and 'asyncio.to_thread' scenarios to ensure proper context isolation.
Test error handling by mocking internal functions using monkeypatch in backend Python tests.
Test resource cleanup in backend Python tests by using fixtures that ensure proper initialization and cleanup of resources.
Test timeout and performance constraints in backend Python tests using 'asyncio.wait_for' and timing assertions.
Test Langflow's Messag...

Files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
src/backend/**/*component*.py

📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)

In your Python component class, set the icon attribute to a string matching the frontend icon mapping exactly (case-sensitive).

Files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
src/backend/**/components/**/*.py

📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)

In your Python component class, set the icon attribute to a string matching the frontend icon mapping exactly (case-sensitive).

Files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
**/{test_*.py,*.test.ts,*.test.tsx}

📄 CodeRabbit inference engine (coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt)

**/{test_*.py,*.test.ts,*.test.tsx}: Check if tests have too many mock objects that obscure what’s actually being tested
Warn when mocks are used instead of testing real behavior and interactions
Suggest using real objects or simpler test doubles when mocks become excessive
Ensure mocks are used only for external dependencies, not core business logic
Recommend integration tests when unit tests become overly mocked
Check that test files follow the project’s naming conventions (backend: test_*.py; frontend: *.test.ts/tsx)
Verify that tests actually exercise the new or changed functionality, not placeholder assertions
Test files should have descriptive test function names explaining what is being tested
Organize tests logically with proper setup and teardown
Include edge cases and error conditions for comprehensive coverage
Verify tests cover both positive (success) and negative (failure) scenarios
Ensure tests are not mere smoke tests; they should validate behavior thoroughly
Ensure tests follow the project’s testing frameworks (pytest for backend, Playwright for frontend)

Files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
**/test_*.py

📄 CodeRabbit inference engine (coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt)

**/test_*.py: Backend tests must be named test_*.py and use proper pytest structure (fixtures, assertions)
For async backend code, use proper pytest async patterns (e.g., pytest-asyncio)
For API endpoints, include tests for both success and error responses

Files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
🧠 Learnings (29)
📚 Learning: 2025-09-07T05:44:46.715Z
Learnt from: TensorNull
Repo: langflow-ai/langflow PR: 9735
File: docs/docs/Components/bundles-cometapi.mdx:9-9
Timestamp: 2025-09-07T05:44:46.715Z
Learning: In Langflow bundle documentation files (docs/docs/Components/bundles-*.mdx), the standard link pattern for referencing the main Bundles page is [Bundles](/components-bundle-components), not /components-bundles. This pattern is used consistently across all 37+ bundle documentation files.

Applied to files:

  • docs/docs/Components/bundles-gigachat.mdx
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Use 'MockLanguageModel' for testing language model components without external API calls in backend Python tests.

Applied to files:

  • src/lfx/src/lfx/components/gigachat/gigachat_models.py
📚 Learning: 2025-08-11T16:52:26.755Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 9336
File: src/backend/base/langflow/base/models/openai_constants.py:29-33
Timestamp: 2025-08-11T16:52:26.755Z
Learning: The "gpt-5-chat-latest" model in the OpenAI models configuration does not support tool calling, so tool_calling should be set to False for this model in src/backend/base/langflow/base/models/openai_constants.py.

Applied to files:

  • src/lfx/src/lfx/components/gigachat/gigachat_models.py
📚 Learning: 2025-07-28T15:56:47.865Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-07-28T15:56:47.865Z
Learning: Applies to src/frontend/src/icons/lazyIconImports.ts : Add your icon to the `lazyIconsMapping` object in `src/frontend/src/icons/lazyIconImports.ts` with a key that matches the backend icon string exactly.

Applied to files:

  • src/frontend/src/icons/eagerIconImports.ts
  • src/frontend/src/icons/lazyIconImports.ts
  • src/frontend/src/icons/GigaChat/index.tsx
  • src/frontend/src/utils/styleUtils.ts
📚 Learning: 2025-07-18T18:27:12.609Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-07-18T18:27:12.609Z
Learning: Applies to src/frontend/src/icons/**/*.{ts,tsx,js,jsx} : Use Lucide React for icons in the frontend.

Applied to files:

  • src/frontend/src/icons/eagerIconImports.ts
  • src/frontend/src/icons/lazyIconImports.ts
  • src/frontend/src/icons/GigaChat/index.tsx
  • src/frontend/src/utils/styleUtils.ts
  • src/frontend/src/icons/GigaChat/GigaChatIcon.jsx
📚 Learning: 2025-07-28T15:56:47.865Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-07-28T15:56:47.865Z
Learning: Applies to src/frontend/src/icons/*/index.tsx : Create an `index.tsx` in your icon directory that exports your icon using `forwardRef` and passes the `isDark` prop.

Applied to files:

  • src/frontend/src/icons/eagerIconImports.ts
  • src/frontend/src/icons/lazyIconImports.ts
  • src/frontend/src/icons/GigaChat/index.tsx
  • src/frontend/src/icons/GigaChat/GigaChatIcon.jsx
📚 Learning: 2025-07-28T15:56:47.865Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-07-28T15:56:47.865Z
Learning: Applies to src/frontend/src/icons/*/*.@(js|jsx|ts|tsx) : Create a new directory for your icon in `src/frontend/src/icons/YourIconName/` and add your SVG as a React component (e.g., `YourIconName.jsx`). The SVG component must use the `isDark` prop to support both light and dark mode.

Applied to files:

  • src/frontend/src/icons/eagerIconImports.ts
  • src/frontend/src/icons/lazyIconImports.ts
  • src/frontend/src/icons/GigaChat/index.tsx
  • src/frontend/src/icons/GigaChat/GigaChatIcon.jsx
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: The frontend icon mapping key (in 'lazyIconsMapping') must match the backend 'icon' attribute string exactly, including case sensitivity, to ensure correct icon rendering.

Applied to files:

  • src/frontend/src/icons/lazyIconImports.ts
📚 Learning: 2025-08-11T16:52:17.902Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 9336
File: src/backend/base/langflow/base/models/openai_constants.py:5-33
Timestamp: 2025-08-11T16:52:17.902Z
Learning: In the Langflow codebase (src/backend/base/langflow/base/models/openai_constants.py), GPT-5 series models (gpt-5, gpt-5-mini, gpt-5-nano, gpt-5-chat-latest) are reasoning models and should have the reasoning=True flag set, which places them in OPENAI_REASONING_MODEL_NAMES rather than OPENAI_CHAT_MODEL_NAMES.

Applied to files:

  • src/lfx/src/lfx/base/models/gigachat_constants.py
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: Export custom icon components in React using React.forwardRef to ensure proper ref forwarding and compatibility with parent components.

Applied to files:

  • src/frontend/src/icons/GigaChat/index.tsx
  • src/frontend/src/icons/GigaChat/GigaChatIcon.jsx
📚 Learning: 2025-06-16T11:14:04.200Z
Learnt from: dolfim-ibm
Repo: langflow-ai/langflow PR: 8394
File: src/frontend/src/icons/Docling/index.tsx:4-6
Timestamp: 2025-06-16T11:14:04.200Z
Learning: The Langflow codebase consistently uses `React.PropsWithChildren<{}>` as the prop type for all icon components using forwardRef, rather than `React.SVGProps<SVGSVGElement>`. This is an established pattern across hundreds of icon files in src/frontend/src/icons/.

Applied to files:

  • src/frontend/src/icons/GigaChat/index.tsx
  • src/frontend/src/icons/GigaChat/GigaChatIcon.jsx
📚 Learning: 2025-07-18T18:27:12.609Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-07-18T18:27:12.609Z
Learning: Applies to src/frontend/src/components/**/@(FlowGraph|nodes)/**/*.{ts,tsx,js,jsx} : Use React Flow for flow graph visualization components.

Applied to files:

  • src/frontend/src/icons/GigaChat/index.tsx
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: When implementing a new component icon in Langflow, ensure the icon name is clear, recognizable, and used consistently across both backend (Python 'icon' attribute) and frontend (React/TypeScript mapping).

Applied to files:

  • src/frontend/src/icons/GigaChat/index.tsx
📚 Learning: 2025-09-30T00:09:51.631Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-09-30T00:09:51.631Z
Learning: Applies to docs/sidebars.js : Keep sidebars.js updated to include new/changed docs sections and items using Docusaurus category structure

Applied to files:

  • docs/sidebars.js
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Applies to src/backend/base/langflow/components/**/__init__.py : Update __init__.py with alphabetical imports when adding new components

Applied to files:

  • src/lfx/src/lfx/components/gigachat/__init__.py
  • src/lfx/src/lfx/components/__init__.py
📚 Learning: 2025-07-28T15:56:47.865Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-07-28T15:56:47.865Z
Learning: Always use clear, recognizable, and consistent icon names for both backend and frontend (e.g., "AstraDB", "Postgres", "OpenAI").

Applied to files:

  • src/frontend/src/utils/styleUtils.ts
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: Custom SVG icon components in React should always support both light and dark mode by accepting an 'isdark' prop and adjusting colors accordingly.

Applied to files:

  • src/frontend/src/icons/GigaChat/GigaChatIcon.jsx
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Create comprehensive unit tests for all new components

Applied to files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : When writing component tests, inherit from the appropriate base class in 'src/backend/tests/base.py' (ComponentTestBase, ComponentTestBaseWithClient, or ComponentTestBaseWithoutClient) and provide the required fixtures: 'component_class', 'default_kwargs', and 'file_names_mapping'.

Applied to files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-08-05T22:51:27.961Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 0
File: :0-0
Timestamp: 2025-08-05T22:51:27.961Z
Learning: The TestComposioComponentAuth test in src/backend/tests/unit/components/bundles/composio/test_base_composio.py demonstrates proper integration testing patterns for external API components, including real API calls with mocking for OAuth completion, comprehensive resource cleanup, and proper environment variable handling with pytest.skip() fallbacks.

Applied to files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test component configuration updates in backend Python tests by asserting correct updates to build configuration objects.

Applied to files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Mirror the component directory structure for unit tests in src/backend/tests/unit/components/

Applied to files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Use ComponentTestBaseWithClient or ComponentTestBaseWithoutClient as base classes for component unit tests

Applied to files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-07-18T18:25:54.487Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.487Z
Learning: Applies to src/backend/tests/unit/**/*.py : Test component integration within flows using create_flow, build_flow, and get_build_events utilities

Applied to files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test components that require external APIs using appropriate pytest markers (e.g., 'api_key_required', 'no_blockbuster') and environment variables for API keys.

Applied to files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test files should use the same filename as the component under test, with an appropriate test prefix or suffix (e.g., 'my_component.py' → 'test_my_component.py').

Applied to files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Validate input/output behavior and test component initialization and configuration in backend Python tests.

Applied to files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test Langflow's Message objects and chat functionality in backend Python tests by asserting correct instantiation and property values.

Applied to files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Mock external dependencies appropriately in backend Python tests to isolate unit tests from external services.

Applied to files:

  • src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
🧬 Code graph analysis (6)
src/lfx/src/lfx/components/gigachat/gigachat_models.py (3)
src/lfx/src/lfx/base/models/model.py (1)
  • LCModelComponent (25-375)
src/lfx/src/lfx/inputs/inputs.py (7)
  • BoolInput (414-426)
  • DropdownInput (465-490)
  • FloatInput (379-411)
  • IntInput (344-376)
  • SecretStrInput (286-341)
  • SliderInput (642-643)
  • StrInput (126-182)
src/lfx/src/lfx/custom/custom_component/component.py (1)
  • get_base_inputs (167-170)
src/frontend/src/icons/eagerIconImports.ts (1)
src/frontend/src/icons/GigaChat/index.tsx (1)
  • GigaChatIcon (5-10)
src/frontend/src/icons/GigaChat/index.tsx (1)
src/frontend/src/icons/GigaChat/GigaChatIcon.jsx (1)
  • GigaChatSVG (1-17)
src/lfx/src/lfx/components/gigachat/__init__.py (2)
src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py (1)
  • GigaChatEmbeddingsComponent (11-103)
src/lfx/src/lfx/components/gigachat/gigachat_models.py (1)
  • GigaChatComponent (14-145)
src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py (2)
src/lfx/src/lfx/field_typing/constants.py (1)
  • Embeddings (49-50)
src/lfx/src/lfx/inputs/inputs.py (4)
  • BoolInput (414-426)
  • IntInput (344-376)
  • SecretStrInput (286-341)
  • StrInput (126-182)
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py (2)
src/lfx/src/lfx/components/gigachat/gigachat_models.py (2)
  • GigaChatComponent (14-145)
  • build_model (128-145)
src/backend/tests/base.py (1)
  • ComponentTestBaseWithoutClient (166-167)
🔇 Additional comments (14)
pyproject.toml (1)

140-140: LGTM! Dependency addition is correct.

The new langchain-gigachat>=0.3.12 dependency is properly added to support the GigaChat integration. The version constraint and alphabetical placement are appropriate.

src/lfx/src/lfx/base/models/gigachat_constants.py (1)

1-45: LGTM! Constants are well-structured and consistent.

The GigaChat model constants follow the established patterns in the codebase:

  • Deprecated models are properly flagged and filtered from GIGACHAT_CHAT_MODEL_NAMES
  • Current GigaChat-2 series models include tool_calling support
  • Provider, icon, and scope constants are consistently defined
  • Tests validate these constants comprehensively
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py (1)

12-49: LGTM! Comprehensive test coverage.

The test suite thoroughly validates the GigaChat constants:

  • Tests verify list is non-empty, contains strings, has no duplicates, and includes expected models
  • MODEL_NAMES alias is validated with both equality and identity checks
  • Scopes are validated to ensure required API scopes are present
src/frontend/src/icons/eagerIconImports.ts (1)

36-36: LGTM! Icon import follows conventions.

The GigaChat icon is correctly imported and mapped in eagerIconsMapping, maintaining alphabetical order and matching the backend icon string exactly.

Also applies to: 158-158

src/frontend/src/utils/styleUtils.ts (2)

280-280: LGTM! Sidebar bundle entry is correct.

The GigaChat bundle is properly added to SIDEBAR_BUNDLES with the correct structure and alphabetical placement.


442-443: LGTM! Node icon mappings are correct.

GigaChatModel and GigaChatEmbeddings are correctly mapped to the "GigaChat" icon, maintaining consistency with the backend component names and frontend icon system.

docs/sidebars.js (1)

316-316: LGTM! Documentation sidebar entry is correct.

The GigaChat bundle is properly added to the documentation sidebar in alphabetical order, following the established pattern for component bundles.

src/frontend/src/icons/lazyIconImports.ts (1)

168-169: LGTM! Lazy icon import follows conventions.

The GigaChat lazy import is correctly configured with the proper module path and export name, maintaining alphabetical order and consistency with the backend icon string. Based on learnings.

src/lfx/src/lfx/components/__init__.py (1)

46-46: LGTM! Component module integration is correct.

The gigachat module is properly integrated into the dynamic import system with:

  • TYPE_CHECKING import for static analysis
  • Dynamic import mapping for lazy loading
  • Public exposure via __all__

All additions maintain alphabetical order and follow established patterns.

Also applies to: 149-149, 280-280

docs/docs/Components/bundles-gigachat.mdx (1)

1-52: Documentation looks comprehensive and well-structured.

The documentation page follows Docusaurus conventions, includes proper front matter, uses correct link patterns, and provides clear descriptions of both text generation and embeddings components with complete parameter tables.

src/lfx/src/lfx/components/gigachat/gigachat_models.py (1)

14-145: Component implementation follows best practices.

The GigaChatComponent properly extends LCModelComponent, defines comprehensive inputs with appropriate constraints and defaults, and correctly implements build_model to construct the GigaChat instance with all configured parameters.

src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py (1)

11-103: Embeddings component structure is sound.

The component correctly extends LCEmbeddingsModel and implements build_embeddings with proper parameter passing. The input definitions are comprehensive and use appropriate UI components.

src/lfx/src/lfx/components/gigachat/__init__.py (1)

1-34: Lazy import mechanism is well-implemented.

The package initializer correctly implements lazy loading for GigaChat components using __getattr__ and __dir__, with proper error handling and TYPE_CHECKING guards. The pattern follows best practices for dynamic imports.

src/frontend/src/icons/GigaChat/index.tsx (1)

5-10: Ignore this review comment.

The index.tsx file is correctly structured and follows the established codebase pattern for icon exports. Analysis shows:

  1. Component naming error: The comment references "GigaChatSVG" but the actual SVG component is "GigaChatIcon.jsx"
  2. isDark prop not implemented: GigaChatIcon.jsx does not currently support an isDark prop—it only spreads {...props} and uses hardcoded colors
  3. Pattern matches codebase: Other icon index.tsx files (AIML, AWS, Anthropic) use identical prop-spreading patterns without explicit isDark forwarding
  4. No action needed: The current implementation is correct for the present codebase state

The actual work needed is on the SVG component (GigaChatIcon.jsx) to add dark mode support, not on index.tsx.

Likely an incorrect or invalid review comment.

Comment thread src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py Outdated
Comment thread src/frontend/src/icons/GigaChat/GigaChatIcon.jsx Outdated
Comment thread src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py
@krakenalt
Copy link
Copy Markdown
Author

@coderabbitai generate docstrings

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 31, 2025

✅ Actions performed

Initiated docstring generation; will generate only if new commits exist.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 31, 2025

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #10465

coderabbitai Bot added a commit that referenced this pull request Oct 31, 2025
Docstrings generation was requested by @krakenalt.

* #10464 (comment)

The following files were modified:

* `src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py`
* `src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py`
* `src/lfx/src/lfx/components/gigachat/__init__.py`
* `src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py`
* `src/lfx/src/lfx/components/gigachat/gigachat_models.py`
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Oct 31, 2025
@github-actions github-actions Bot removed the enhancement New feature or request label Oct 31, 2025
autofix-ci Bot and others added 24 commits December 12, 2025 07:53
…bundle

# Conflicts:
#	src/lfx/src/lfx/_assets/component_index.json
…bundle

# Conflicts:
#	src/lfx/src/lfx/_assets/component_index.json
…bundle

# Conflicts:
#	src/lfx/src/lfx/_assets/component_index.json
…bundle

# Conflicts:
#	src/lfx/src/lfx/_assets/component_index.json
…bundle

# Conflicts:
#	src/lfx/src/lfx/_assets/component_index.json
…bundle

# Conflicts:
#	src/lfx/src/lfx/_assets/component_index.json
…bundle

# Conflicts:
#	pyproject.toml
#	src/lfx/src/lfx/_assets/component_index.json
…bundle

# Conflicts:
#	src/lfx/src/lfx/_assets/component_index.json
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.

Feature: Add GigaChat bundle

1 participant