Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
17d475c
refactor: update default behavior for components path in Settings class
ogabrielluiz Jun 6, 2025
a762ae4
feat: Implement importing of Langflow components
ogabrielluiz Jun 6, 2025
4cff048
feat: Enhance component handling in custom utils for better flexibility
ogabrielluiz Jun 6, 2025
7232284
refactor: Simplify component retrieval logic and enhance error handling
ogabrielluiz Jun 6, 2025
785d08e
refactor: Remove unnecessary 'required_inputs' field from multiple st…
ogabrielluiz Jun 6, 2025
64536d9
refactor: Change error handling to warning for component instantiatio…
ogabrielluiz Jun 6, 2025
9f485d9
refactor: Improve component type checking in get_component_instance a…
ogabrielluiz Jun 6, 2025
b28924f
refactor: Update subclass check for custom_component in run_build_con…
ogabrielluiz Jun 6, 2025
8586823
refactor: Update component name retrieval logic to prioritize class name
ogabrielluiz Jun 6, 2025
ea21d59
refactor: Replace settings service call with direct BASE_COMPONENTS_P…
ogabrielluiz Jun 6, 2025
9c86542
refactor: Update required inputs and improve model name info across s…
ogabrielluiz Jun 6, 2025
f0215d6
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 6, 2025
fd83816
📝 Add docstrings to `fix-component-loading` (#8397)
coderabbitai[bot] Jun 6, 2025
31b8eed
Build and log fixes
jordanrfrazier Jun 6, 2025
c1a5c9f
refactor: Improve type checking for custom component instances in `ge…
ogabrielluiz Jun 6, 2025
2a49275
refactor: Enhance type checking for custom components in `run_build_c…
ogabrielluiz Jun 6, 2025
fcc6c01
refactor: Clean up docstrings in component loading functions for clarity
ogabrielluiz Jun 6, 2025
04eff15
refactor: Rename `get_langflow_components_list` to `import_langflow_c…
ogabrielluiz Jun 6, 2025
c2aecda
refactor: Exclude deactivated modules and improve class checking in c…
ogabrielluiz Jun 7, 2025
9ca8a28
test: Add component differences analysis for import_langflow_componen…
ogabrielluiz Jun 7, 2025
5482318
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 7, 2025
6af4909
refactor: Simplify assert statements and improve logging in component…
ogabrielluiz Jun 7, 2025
ca32307
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 9, 2025
6bc04ba
refactor: Consolidate __all__ declaration for retriever components
ogabrielluiz Jun 9, 2025
2faf03e
refactor: Improve comments for clarity in run_build_config function
ogabrielluiz Jun 9, 2025
5e57bee
Merge branch 'main' into fix-component-loading
jordanrfrazier Jun 9, 2025
36a1077
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 9, 2025
f814ba6
refactor: Enhance module validation logic in _get_langflow_components…
ogabrielluiz Jun 9, 2025
4bf78dc
refactor: Update debug log message for clarity in get_and_cache_all_t…
ogabrielluiz Jun 9, 2025
5dac3e5
refactor: Enhance parallel processing of Langflow components import a…
ogabrielluiz Jun 9, 2025
26a8d69
refactor: Improve performance testing by adding warm-up runs and clar…
ogabrielluiz Jun 9, 2025
cacf7ff
refactor: Improve assertion clarity in component loading tests and ad…
ogabrielluiz Jun 9, 2025
1a75971
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 9, 2025
516a37a
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Jun 9, 2025
232809c
[autofix.ci] apply automated fixes (attempt 3/3)
autofix-ci[bot] Jun 9, 2025
2fd61f9
Use Component base class instead of custom component for a few compon…
jordanrfrazier Jun 9, 2025
6a529c3
⚡️ Speed up function `get_component_instance` by 365% in PR #8395 (`f…
codeflash-ai[bot] Jun 9, 2025
6222405
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 9, 2025
38f514b
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Jun 9, 2025
1ca5f80
refactor: update debug log message for components cache building
ogabrielluiz Jun 9, 2025
b4c350a
refactor: update required inputs to use 'api_key' for multiple starte…
ogabrielluiz Jun 9, 2025
3479168
refactor: update import statement for BaseFileComponent in nvidia_ing…
ogabrielluiz Jun 9, 2025
235ea72
refactor: simplify timing results print statement in test_load_compon…
ogabrielluiz Jun 9, 2025
9ecf621
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 9, 2025
11ebd23
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Jun 9, 2025
b03f7b4
refactor: improve assertion readability and error handling in test_lo…
ogabrielluiz Jun 9, 2025
29148d1
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 9, 2025
38e095d
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Jun 9, 2025
7c1f493
[autofix.ci] apply automated fixes (attempt 3/3)
autofix-ci[bot] Jun 9, 2025
a3516ff
feat: allow os.stat in pkgutil for component loading in blockbuster f…
ogabrielluiz Jun 9, 2025
e1ed5e8
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 9, 2025
ec6389b
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Jun 9, 2025
e348334
[autofix.ci] apply automated fixes (attempt 3/3)
autofix-ci[bot] Jun 9, 2025
2cad1f6
updates few components to new template
jordanrfrazier Jun 9, 2025
5e75980
import fixes
jordanrfrazier Jun 9, 2025
18e5663
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 9, 2025
16d3bdd
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Jun 9, 2025
07af9ed
[autofix.ci] apply automated fixes (attempt 3/3)
autofix-ci[bot] Jun 9, 2025
110baf7
remove unused VectaraSelfQueryRetriverComponent from vectorstores __a…
ogabrielluiz Jun 10, 2025
0fb2016
Update starter project configurations to require 'api_key' as a manda…
ogabrielluiz Jun 10, 2025
9f72055
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 10, 2025
276d06f
Refactor JSONDocumentBuilder by removing TYPE_CHECKING import and upd…
ogabrielluiz Jun 10, 2025
6d139d7
⚡️ Speed up function `_process_single_module` by 1,017% in PR #8395 (…
codeflash-ai[bot] Jun 10, 2025
5e1685a
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 10, 2025
03cffd7
Remove unnecessary call to `_set_output_required_inputs` in `Componen…
ogabrielluiz Jun 10, 2025
cc7b253
Revert "Use Component base class instead of custom component for a fe…
ogabrielluiz Jun 10, 2025
0aa17a2
move components to deactivated folder
ogabrielluiz Jun 10, 2025
09176d2
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 10, 2025
2d3b664
Merge branch 'main' into fix-component-loading
ogabrielluiz Jun 10, 2025
c2178b7
Revert "move components to deactivated folder"
ogabrielluiz Jun 10, 2025
661e1e3
Implement multiple new components in the deactivated folder, includin…
ogabrielluiz Jun 10, 2025
fc130e2
feat: Enhance starter project loading with improved logging and error…
ogabrielluiz Jun 10, 2025
47cc0d2
refactor: Remove debug logging for module processing in import_langfl…
ogabrielluiz Jun 10, 2025
90777c7
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 10, 2025
05bede7
fix: Disable mypy error for undefined attributes in deactivated compo…
ogabrielluiz Jun 10, 2025
f474c36
feat: Enhance blocking behavior in blockbuster tests with additional …
ogabrielluiz Jun 10, 2025
93d76c7
fix: Add import error handling for boto3 in S3BucketUploaderComponent
ogabrielluiz Jun 10, 2025
505d4b4
refactor: Add debug logging for module processing in components
ogabrielluiz Jun 10, 2025
3ad4e4e
fix: Temporarily disable auto-use for blockbuster fixture until block…
ogabrielluiz Jun 10, 2025
2236488
feat: Add utility function to check for preimported components
ogabrielluiz Jun 11, 2025
84b60d5
fix: Update get_component_instance to accept both CustomComponent and…
ogabrielluiz Jun 11, 2025
2e23ba2
fix: Update import error message for boto3 installation instructions
ogabrielluiz Jun 11, 2025
3165d2a
fix: Correct class name from VectoStoreRetrieverComponent to VectorSt…
ogabrielluiz Jun 11, 2025
d9b51e2
fix: Update Vectara type hints and import statements for consistency
ogabrielluiz Jun 11, 2025
20b2f05
fix: Refactor get_component_instance and build_custom_component_templ…
ogabrielluiz Jun 11, 2025
aec8f8a
Merge branch 'main' into fix-component-loading
ogabrielluiz Jun 11, 2025
8bfd09e
fix: Remove debug logging from _process_single_module to streamline m…
ogabrielluiz Jun 11, 2025
e1627bc
⚡️ Speed up function `is_a_preimported_component` by 24% in PR #8395 …
codeflash-ai[bot] Jun 11, 2025
2ee4d92
✨ (freeze.spec.ts): introduce new function addFlowToTestOnEmptyLangfl…
Cristhianzl Jun 11, 2025
c506398
Merge branch 'main' into fix-component-loading
ogabrielluiz Jun 11, 2025
d87837f
merge fix
Cristhianzl Jun 11, 2025
6879a33
merge fix
Cristhianzl Jun 11, 2025
b7027ca
✨ (freeze.spec.ts): increase timeout value for waiting for "built suc…
Cristhianzl Jun 11, 2025
5654676
✨ (freeze.spec.ts): refactor code to check if firstRunLangflow is gre…
Cristhianzl Jun 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from pathlib import Path
from typing import Any

import boto3

from langflow.custom.custom_component.component import Component
from langflow.io import (
BoolInput,
Expand Down Expand Up @@ -175,6 +173,12 @@ def _s3_client(self) -> Any:
Returns:
Any: A boto3 S3 client instance.
"""
try:
import boto3
except ImportError as e:
msg = "boto3 is not installed. Please install it using `uv pip install boto3`."
raise ImportError(msg) from e

return boto3.client(
"s3",
aws_access_key_id=self.aws_access_key_id,
Expand Down
66 changes: 66 additions & 0 deletions src/backend/base/langflow/components/deactivated/amazon_kendra.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# mypy: disable-error-code="attr-defined"
from langchain_community.retrievers import AmazonKendraRetriever

from langflow.base.vectorstores.model import check_cached_vector_store
from langflow.custom.custom_component.custom_component import CustomComponent
from langflow.io import DictInput, IntInput, StrInput
Comment thread
ogabrielluiz marked this conversation as resolved.


class AmazonKendraRetrieverComponent(CustomComponent):
display_name: str = "Amazon Kendra Retriever"
description: str = "Retriever that uses the Amazon Kendra API."
name = "AmazonKendra"
icon = "Amazon"
legacy = True

inputs = [
StrInput(
name="index_id",
display_name="Index ID",
),
StrInput(
name="region_name",
display_name="Region Name",
),
StrInput(
name="credentials_profile_name",
display_name="Credentials Profile Name",
),
DictInput(
name="attribute_filter",
display_name="Attribute Filter",
),
IntInput(
name="top_k",
display_name="Top K",
value=3,
),
DictInput(
Comment thread
ogabrielluiz marked this conversation as resolved.
name="user_context",
display_name="User Context",
),
]

@check_cached_vector_store
def build_vector_store(self) -> AmazonKendraRetriever:
"""Builds the Amazon Kendra Retriever."""
try:
from langchain_community.retrievers import AmazonKendraRetriever
except ImportError as e:
msg = "Could not import AmazonKendraRetriever. Please install it with `pip install langchain-community`."
raise ImportError(msg) from e

try:
output = AmazonKendraRetriever(
index_id=self.index_id,
top_k=self.top_k,
region_name=self.region_name,
credentials_profile_name=self.credentials_profile_name,
attribute_filter=self.attribute_filter,
user_context=self.user_context,
)
except Exception as e:
msg = "Could not connect to AmazonKendra API."
raise ValueError(msg) from e

return output
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,33 @@

# - **Document:** The Document containing the JSON object.


from langchain_core.documents import Document

from langflow.custom.custom_component.custom_component import CustomComponent
from langflow.io import HandleInput, StrInput
from langflow.services.database.models.base import orjson_dumps


class JSONDocumentBuilder(CustomComponent):
display_name: str = "JSON Document Builder"
description: str = "Build a Document containing a JSON object using a key and another Document page content."
name = "JSONDocumentBuilder"
legacy: bool = True

output_types: list[str] = ["Document"]
documentation: str = "https://docs.langflow.org/components/utilities#json-document-builder"

field_config = {
"key": {"display_name": "Key"},
"document": {"display_name": "Document"},
}
legacy = True

inputs = [
StrInput(
name="key",
display_name="Key",
required=True,
),
HandleInput(
name="document",
display_name="Document",
required=True,
),
]

def build(
self,
Expand All @@ -46,5 +54,6 @@ def build(
else:
msg = f"Expected Document or list of Documents, got {type(document)}"
raise TypeError(msg)

self.repr_value = documents
return documents
54 changes: 54 additions & 0 deletions src/backend/base/langflow/components/deactivated/metal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# mypy: disable-error-code="attr-defined"
from langchain_community.retrievers import MetalRetriever

from langflow.base.vectorstores.model import check_cached_vector_store
from langflow.custom.custom_component.custom_component import CustomComponent
from langflow.io import DictInput, SecretStrInput, StrInput
Comment thread
ogabrielluiz marked this conversation as resolved.


class MetalRetrieverComponent(CustomComponent):
display_name: str = "Metal Retriever"
description: str = "Retriever that uses the Metal API."
name = "MetalRetriever"
legacy = True

inputs = [
SecretStrInput(
name="api_key",
display_name="API Key",
required=True,
),
SecretStrInput(
name="client_id",
display_name="Client ID",
required=True,
),
StrInput(
name="index_id",
display_name="Index ID",
required=True,
),
DictInput(
name="params",
display_name="Parameters",
required=False,
),
]
Comment thread
ogabrielluiz marked this conversation as resolved.

@check_cached_vector_store
def build_vector_store(self) -> MetalRetriever:
"""Builds the Metal Retriever."""
try:
from langchain_community.retrievers import MetalRetriever
from metal_sdk.metal import Metal
except ImportError as e:
msg = "Could not import Metal. Please install it with `pip install metal-sdk langchain-community`."
raise ImportError(msg) from e

try:
metal = Metal(api_key=self.api_key, client_id=self.client_id, index_id=self.index_id)
except Exception as e:
msg = "Could not connect to Metal API."
raise ValueError(msg) from e

return MetalRetriever(client=metal, params=self.params or {})
59 changes: 59 additions & 0 deletions src/backend/base/langflow/components/deactivated/multi_query.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from langchain.prompts import PromptTemplate
from langchain.retrievers import MultiQueryRetriever

from langflow.custom.custom_component.custom_component import CustomComponent
from langflow.field_typing import BaseRetriever, LanguageModel, Text
from langflow.inputs.inputs import HandleInput, StrInput


class MultiQueryRetrieverComponent(CustomComponent):
display_name = "MultiQueryRetriever"
description = "Initialize from llm using default template."
documentation = "https://python.langchain.com/docs/modules/data_connection/retrievers/how_to/MultiQueryRetriever"
name = "MultiQueryRetriever"
legacy = True

inputs = [
HandleInput(
name="llm",
display_name="LLM",
input_types=["LanguageModel"],
required=True,
),
HandleInput(
name="retriever",
display_name="Retriever",
input_types=["BaseRetriever"],
required=True,
),
StrInput(
name="prompt",
display_name="Prompt",
value="You are an AI language model assistant. Your task is \n"
"to generate 3 different versions of the given user \n"
"question to retrieve relevant documents from a vector database. \n"
"By generating multiple perspectives on the user question, \n"
"your goal is to help the user overcome some of the limitations \n"
"of distance-based similarity search. Provide these alternative \n"
"questions separated by newlines. Original question: {question}",
required=False,
),
StrInput(
name="parser_key",
display_name="Parser Key",
value="lines",
required=False,
),
]

def build(
self,
llm: LanguageModel,
retriever: BaseRetriever,
prompt: Text | None = None,
parser_key: str = "lines",
) -> MultiQueryRetriever:
if not prompt:
return MultiQueryRetriever.from_llm(llm=llm, retriever=retriever, parser_key=parser_key)
prompt_template = PromptTemplate.from_template(prompt)
return MultiQueryRetriever.from_llm(llm=llm, retriever=retriever, prompt=prompt_template, parser_key=parser_key)
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,37 @@

from langflow.custom.custom_component.custom_component import CustomComponent
from langflow.field_typing import BaseRetriever, Tool
from langflow.io import HandleInput, StrInput


class RetrieverToolComponent(CustomComponent):
display_name = "RetrieverTool"
description = "Tool for interacting with retriever"
name = "RetrieverTool"
legacy = True
icon = "LangChain"
legacy = True

def build_config(self):
return {
"retriever": {
"display_name": "Retriever",
"info": "Retriever to interact with",
"type": BaseRetriever,
"input_types": ["Retriever"],
},
"name": {"display_name": "Name", "info": "Name of the tool"},
"description": {"display_name": "Description", "info": "Description of the tool"},
}
inputs = [
HandleInput(
name="retriever",
display_name="Retriever",
info="Retriever to interact with",
input_types=["Retriever"],
required=True,
),
StrInput(
name="name",
display_name="Name",
info="Name of the tool",
required=True,
),
StrInput(
name="description",
display_name="Description",
info="Description of the tool",
required=True,
),
]

def build(self, retriever: BaseRetriever, name: str, description: str, **kwargs) -> Tool:
_ = kwargs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# mypy: disable-error-code="attr-defined"
import json

from langchain.chains.query_constructor.base import AttributeInfo
from langchain.retrievers.self_query.base import SelfQueryRetriever

from langflow.base.vectorstores.model import check_cached_vector_store
from langflow.custom.custom_component.custom_component import CustomComponent
from langflow.io import HandleInput, StrInput


class VectaraSelfQueryRetriverComponent(CustomComponent):
Comment thread
ogabrielluiz marked this conversation as resolved.
"""A custom component for implementing Vectara Self Query Retriever using a vector store."""

display_name: str = "Vectara Self Query Retriever"
description: str = "Implementation of Vectara Self Query Retriever"
name = "VectaraSelfQueryRetriver"
icon = "Vectara"
legacy = True

inputs = [
HandleInput(
name="vectorstore",
display_name="Vector Store",
info="Input Vectara Vector Store",
),
HandleInput(
name="llm",
display_name="LLM",
info="For self query retriever",
),
StrInput(
name="document_content_description",
display_name="Document Content Description",
info="For self query retriever",
),
StrInput(
name="metadata_field_info",
display_name="Metadata Field Info",
info="Each metadata field info is a string in the form of key value pair dictionary containing "
"additional search metadata.\n"
'Example input: {"name":"speech","description":"what name of the speech","type":'
'"string or list[string]"}.\n'
"The keys should remain constant(name, description, type)",
),
]

@check_cached_vector_store
def build_vector_store(self):
"""Builds the Vectara Self Query Retriever."""
try:
from langchain_community.vectorstores import Vectara # noqa: F401
except ImportError as e:
msg = "Could not import Vectara. Please install it with `pip install langchain-community`."
raise ImportError(msg) from e

metadata_field_obj = []
for meta in self.metadata_field_info:
meta_obj = json.loads(meta)
if "name" not in meta_obj or "description" not in meta_obj or "type" not in meta_obj:
msg = "Incorrect metadata field info format."
raise ValueError(msg)
Comment thread
ogabrielluiz marked this conversation as resolved.
attribute_info = AttributeInfo(
name=meta_obj["name"],
description=meta_obj["description"],
type=meta_obj["type"],
)
metadata_field_obj.append(attribute_info)

return SelfQueryRetriever.from_llm(
self.llm, # noqa: ignore[attr-defined]
self.vectorstore, # noqa: ignore[attr-defined]
self.document_content_description, # noqa: ignore[attr-defined]
metadata_field_obj,
verbose=True,
)
Loading
Loading