-
Notifications
You must be signed in to change notification settings - Fork 8.2k
feat:add oceanbase vector store support #10638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis PR adds comprehensive OceanBase vector store support to the project, including new Python dependencies, a React icon component, integration with icon loading systems, sidebar configuration, and a backend component that manages OceanBase connections, indexing strategies, and document search operations. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant LFX as LFX UI
participant Component as OceanBaseVectorStoreComponent
participant DB as OceanBase
participant Langchain as langchain-oceanbase
User->>LFX: Configure OceanBase Vector Store
LFX->>Component: build_vector_store()
Component->>Component: Validate pymysql available
Component->>DB: Test connection
DB-->>Component: Connection OK
Component->>Component: _get_index_params() for selected type
Component->>Langchain: Create OceanbaseVectorStore
Langchain->>DB: Initialize with parameters
DB-->>Langchain: Ready
Langchain-->>Component: Return instance
Component-->>LFX: Vector store ready
User->>LFX: Search documents
LFX->>Component: search_documents()
Component->>Component: _get_search_params() for index type
Component->>Langchain: similarity_search_with_score()
Langchain->>DB: Query vectors
DB-->>Langchain: Results with scores
Langchain-->>Component: Results
Component->>Component: Filter by score_threshold
Component->>Component: Convert to Data objects
Component-->>LFX: Return search results
LFX-->>User: Display results
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related issues
Suggested reviewers
Pre-merge checks and finishing touchesImportant Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 3 warnings)
✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/lfx/src/lfx/components/__init__.py (1)
9-109: Address the Ruff import formatting issue.The pipeline reports that the import block is un-sorted or un-formatted. While the
oceanbaseadditions appear correctly placed, please run the Ruff formatter to resolve this issue.#!/bin/bash # Run Ruff to fix the import formatting issue ruff check --select I --fix src/lfx/src/lfx/components/__init__.py
🧹 Nitpick comments (3)
pyproject.toml (1)
98-100: Verify new OceanBase dependencies and consider making them optional.The additions of
langchain-oceanbase>=0.2.3andpymysql>=1.1.1look aligned with the new component, but they make OceanBase support mandatory for all installs. Please double‑check version compatibility with the currentlangchainstack and deployment environment, and consider movinglangchain-oceanbase(and possiblypymysql) into an optional extra if OceanBase is not a core/default backend.src/frontend/src/icons/OceanBase/OceanBase.jsx (1)
1-29: SVG style override and theming behaviour.Current implementation always applies
filter: "none"after spreadingstyle, which overrides any caller‑providedfilter. If you want to preserve external styling (e.g., future dark‑mode adjustments), considerstyle={{ filter: "none", ...style }}or dropping the override entirely if unnecessary. Also, to align with the existing icon conventions, it would be good to support an optionalisdarkprop (even if it only tweaks basic styling around the raster logo) onceSvgOceanBaseis updated to useforwardRefas mentioned in the wrapper review.src/lfx/src/lfx/components/oceanbase/oceanbase.py (1)
239-265: Minor simplification opportunity in threshold gating.The guard
if self.score_threshold is not None and str(self.score_threshold).strip():plus a latertry: float(self.score_threshold)is defensive but slightly noisy givenscore_thresholdis already aFloatInput. You could simplify to:
- Treat
Noneas “no threshold” and skip thestr(...).strip()check.- Convert once up front and bail out on
ValueError/TypeError.This would keep behaviour identical while tightening the control flow.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
src/frontend/src/assets/oceanbase_logo.pngis excluded by!**/*.pnguv.lockis excluded by!**/*.lock
📒 Files selected for processing (9)
pyproject.toml(1 hunks)src/frontend/src/icons/OceanBase/OceanBase.jsx(1 hunks)src/frontend/src/icons/OceanBase/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/components/__init__.py(3 hunks)src/lfx/src/lfx/components/oceanbase/__init__.py(1 hunks)src/lfx/src/lfx/components/oceanbase/oceanbase.py(1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 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-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/OceanBase/index.tsx
📚 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/OceanBase/index.tsxsrc/frontend/src/icons/OceanBase/OceanBase.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: 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/OceanBase/index.tsxsrc/frontend/src/icons/OceanBase/OceanBase.jsx
📚 Learning: 2025-06-23T12:46:42.048Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-23T12:46:42.048Z
Learning: Custom React Flow node types should be implemented as memoized components, using Handle components for connection points and supporting optional icons and labels.
Applied to files:
src/frontend/src/icons/OceanBase/index.tsx
🧬 Code graph analysis (4)
src/frontend/src/icons/eagerIconImports.ts (1)
src/frontend/src/icons/OceanBase/index.tsx (1)
OceanBaseIcon(5-10)
src/frontend/src/icons/OceanBase/index.tsx (1)
src/frontend/src/icons/OceanBase/OceanBase.jsx (2)
SvgOceanBase(3-26)SvgOceanBase(3-26)
src/lfx/src/lfx/components/oceanbase/__init__.py (1)
src/lfx/src/lfx/components/oceanbase/oceanbase.py (1)
OceanBaseVectorStoreComponent(9-274)
src/lfx/src/lfx/components/oceanbase/oceanbase.py (2)
src/backend/base/langflow/helpers/data.py (1)
docs_to_data(14-23)src/lfx/src/lfx/schema/data.py (2)
Data(26-288)to_lc_document(142-152)
🪛 GitHub Actions: Ruff Style Check
src/lfx/src/lfx/components/__init__.py
[error] 9-9: Ruff: I001 Import block is un-sorted or un-formatted.
🪛 GitHub Check: Ruff Style Check (3.13)
src/lfx/src/lfx/components/oceanbase/oceanbase.py
[failure] 256-256: Ruff (SLF001)
src/lfx/src/lfx/components/oceanbase/oceanbase.py:256:46: SLF001 Private member accessed: _select_relevance_score_fn
[failure] 223-223: Ruff (RET505)
src/lfx/src/lfx/components/oceanbase/oceanbase.py:223:9: RET505 Unnecessary elif after return statement
[failure] 199-199: Ruff (RET505)
src/lfx/src/lfx/components/oceanbase/oceanbase.py:199:9: RET505 Unnecessary elif after return statement
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
- GitHub Check: Run Frontend Tests / Playwright Tests - Shard 5/13
- GitHub Check: Run Frontend Tests / Playwright Tests - Shard 7/13
- GitHub Check: Run Frontend Tests / Playwright Tests - Shard 9/13
- GitHub Check: Run Frontend Tests / Playwright Tests - Shard 12/13
- GitHub Check: Run Frontend Tests / Playwright Tests - Shard 10/13
- GitHub Check: Run Frontend Tests / Playwright Tests - Shard 13/13
- GitHub Check: Run Frontend Tests / Playwright Tests - Shard 11/13
- GitHub Check: Run Frontend Tests / Playwright Tests - Shard 8/13
- GitHub Check: Run Frontend Tests / Playwright Tests - Shard 2/13
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
- GitHub Check: Lint Backend / Run Mypy (3.12)
- GitHub Check: Lint Backend / Run Mypy (3.11)
- GitHub Check: Lint Backend / Run Mypy (3.13)
- GitHub Check: Lint Backend / Run Mypy (3.10)
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
- GitHub Check: Run Backend Tests / LFX Tests - Python 3.10
- GitHub Check: Run Backend Tests / Integration Tests - Python 3.10
- GitHub Check: Test Starter Templates
- GitHub Check: Update Component Index
- GitHub Check: Update Starter Projects
🔇 Additional comments (13)
src/frontend/src/icons/eagerIconImports.ts (1)
73-73: OceanBase eager icon wiring looks consistent.The eager import and
eagerIconsMappingentry forOceanBasematch the backendicon = "OceanBase"and the style utils mapping, so the icon should resolve correctly in eager paths.Also applies to: 193-193
src/frontend/src/icons/lazyIconImports.ts (1)
338-339: Lazy icon mapping for OceanBase is correct and consistent.The
OceanBaselazy entry follows the existing pattern and matches the icon key used in the backend and eager mappings, so lazy loading should work as expected.src/frontend/src/utils/styleUtils.ts (1)
300-300: OceanBase sidebar bundle and node icon mapping are consistent.The new
SIDEBAR_BUNDLESentry andnodeIconToDisplayIconMap["OceanBaseVectorStore"] = "OceanBase"correctly align with the backend component’snameandiconvalues, so the OceanBase vector store should render with the intended icon in both the sidebar and node views.Also applies to: 462-462
src/lfx/src/lfx/components/oceanbase/oceanbase.py (2)
9-90: Overall component design is solid; verify external API assumptions.The component wiring (inputs,
name,icon,priority, andrecommended) and the high‑level flow inbuild_vector_store/search_documentslook coherent and consistent with other vector store components: you validate the DB connection early, normalize ingest data toDocuments, derive index/search params, and expose a handle-basedembeddinginput plus result controls. The main functional dependency is onlangchain_oceanbase.OceanbaseVectorStorecorrectly supporting:
from_texts(texts, embedding, metadatas, table_name, connection_args, vidx_metric_type, vidx_algo_params, drop_old, normalize, index_type, **kwargs)__init__(embedding_function, table_name, connection_args, vidx_metric_type, vidx_algo_params, drop_old, normalize, index_type, **kwargs)similarity_search/similarity_search_with_score(..., param=search_params)Please double‑check the exact keyword names (
connection_args,vidx_metric_type,vidx_algo_params,index_type,param) against the currentlangchain-oceanbaseAPI, since any mismatch will only show up at runtime.
115-187: Ingest and metadata handling look correct and robust.The conversion of
self.ingest_dataintoDocuments, plus the deep‑copy andmodel_dump()normalization for complex metadata, should play well withdocs_to_dataand downstream consumers. This design avoids mutating the original documents while producing JSON‑serializable metadata for storage.src/frontend/src/icons/OceanBase/index.tsx (1)
1-10: Ref is not actually forwarded to the<svg>element.
OceanBaseIconusesforwardRef, butSvgOceanBaseis a plain function component inOceanBase.jsx, sorefwill not attach to the underlying<svg>and may trigger React “function components cannot be given refs” warnings. To match the existing icon pattern, you should makeSvgOceanBaseitself aforwardRef<SVGSVGElement, React.SVGProps<SVGSVGElement> & { isdark?: boolean }>and pass therefdirectly to the<svg>element, then haveOceanBaseIconwrap that, as done for other icons.⛔ Skipped due to learnings
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/.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.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.src/lfx/src/lfx/components/__init__.py (3)
72-72: LGTM! TYPE_CHECKING import correctly added.The
oceanbaseimport is properly placed in alphabetical order within the TYPE_CHECKING block.
177-177: LGTM! Dynamic import mapping correctly configured.The
oceanbasemodule is properly registered in the dynamic imports dictionary with the"__module__"value, enabling lazy loading.
308-308: LGTM! Public API export correctly added.The
oceanbasemodule is properly added to the__all__list in alphabetical order.src/lfx/src/lfx/components/oceanbase/__init__.py (4)
1-8: LGTM! Imports and TYPE_CHECKING setup are correct.The import structure follows the established lazy-loading pattern, with TYPE_CHECKING imports for static analysis without runtime overhead.
10-16: LGTM! Dynamic imports and public API correctly configured.The
_dynamic_importsmapping and__all__list are properly set up to enable lazy loading ofOceanBaseVectorStoreComponent.
19-30: LGTM! Lazy loading implementation is correct.The
__getattr__function properly implements lazy loading with appropriate error handling and caching. The simpler implementation compared to the parent module is appropriate for a single-component module.
33-34: LGTM!__dir__implementation is correct.The
__dir__function properly returns the public API list, enabling introspection of the module.
07902bf to
ad7e095
Compare
OceanBase Database is a distributed relational database.
It is developed entirely by Ant Group. The OceanBase Database is built on a common server cluster.
Based on the Paxos protocol and its distributed structure, the OceanBase Database provides high availability and linear scalability.
Oceanbase supports vector storage and querying, and has strong vector ecological capabilities

Summary by CodeRabbit
Release Notes
New Features
Chores