fix: update node logic (#2515)

* Fixed bug where updating the node does not remove edited status

* Fixed order of edited override

* Made all node-changing functions to alter type the right way

* Update StoreMessageComponent for enhanced message handling

- Changed base class from CustomComponent to Component
- Added multiple input fields: message, sender, sender_name, session_id
- Included output field for stored messages
- Improved logic to handle both string and Message types
- Enhanced error handling and validation for message storage

* Apply Ruff formatting

* Update StoreMessageComponent for enhanced message handling

* Apply Ruff formatting

* Feat: add more types

* Format code

* feat: Add CreateListComponent for creating a list of texts

This commit adds a new component called CreateListComponent, which is responsible for creating a list of texts. The component takes in one or more texts as input and outputs a list of Data objects. This component is useful for scenarios where a list of texts needs to be processed or manipulated.

The CreateListComponent class is added to the helpers module in the langflow.components package. It includes the necessary inputs and outputs, as well as a create_list method that generates the list of Data objects based on the input texts.

This commit also includes some minor changes to other files, such as renaming the UUIDGeneratorComponent to IDGeneratorComponent and updating import statements.

* [autofix.ci] apply automated fixes

* Changed native categories to use the keys of the style utils categories, which is updated

* change component name

* chore: add the name attribute to the CustomComponent

* chore: assign the value of name to the components

* chore: change the logic of the type value returned

* chore: extract code to new func

* chore: change component_name value

* [autofix.ci] apply automated fixes

* Formatted files

---------

Co-authored-by: Rodrigo <rodrigosilvanader@gmail.com>
Co-authored-by: rodrigosnader <rodrigosnader@users.noreply.github.com>
Co-authored-by: igorrCarvalho <igorsilvabhz6@gmail.com>
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
This commit is contained in:
Lucas Oliveira 2024-07-03 17:55:01 -03:00 • committed by GitHub
commit 17b730b6cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
143 changed files with 179 additions and 37 deletions

View file

@ -22,7 +22,7 @@ from langflow.api.v1.schemas import (
UploadFileResponse, UploadFileResponse,
) )
from langflow.custom.custom_component.component import Component from langflow.custom.custom_component.component import Component
from langflow.custom.utils import build_custom_component_template from langflow.custom.utils import build_custom_component_template, get_instance_name
from langflow.graph.graph.base import Graph from langflow.graph.graph.base import Graph
from langflow.graph.schema import RunOutputs from langflow.graph.schema import RunOutputs
from langflow.helpers.flow import get_flow_by_id_or_endpoint_name from langflow.helpers.flow import get_flow_by_id_or_endpoint_name
@ -519,7 +519,9 @@ async def custom_component(
built_frontend_node, component_instance = build_custom_component_template(component, user_id=user.id) built_frontend_node, component_instance = build_custom_component_template(component, user_id=user.id)
if raw_code.frontend_node is not None: if raw_code.frontend_node is not None:
built_frontend_node = component_instance.post_code_processing(built_frontend_node, raw_code.frontend_node) built_frontend_node = component_instance.post_code_processing(built_frontend_node, raw_code.frontend_node)
return CustomComponentResponse(data=built_frontend_node, type=component_instance.__class__.__name__)
_type = get_instance_name(component_instance)
return CustomComponentResponse(data=built_frontend_node, type=_type)
@router.post("/custom_component/update", status_code=HTTPStatus.OK) @router.post("/custom_component/update", status_code=HTTPStatus.OK)

View file

@ -8,6 +8,7 @@ class CSVAgentComponent(CustomComponent):
display_name = "CSVAgent" display_name = "CSVAgent"
description = "Construct a CSV agent from a CSV and tools." description = "Construct a CSV agent from a CSV and tools."
documentation = "https://python.langchain.com/docs/modules/agents/toolkits/csv" documentation = "https://python.langchain.com/docs/modules/agents/toolkits/csv"
name = "CSVAgent"
def build_config(self): def build_config(self):
return { return {

View file

@ -9,6 +9,7 @@ from langflow.field_typing import LanguageModel
class JsonAgentComponent(CustomComponent): class JsonAgentComponent(CustomComponent):
display_name = "JsonAgent" display_name = "JsonAgent"
description = "Construct a json agent from an LLM and tools." description = "Construct a json agent from an LLM and tools."
name = "JsonAgent"
def build_config(self): def build_config(self):
return { return {

View file

@ -12,6 +12,7 @@ from langflow.field_typing import LanguageModel
class SQLAgentComponent(CustomComponent): class SQLAgentComponent(CustomComponent):
display_name = "SQLAgent" display_name = "SQLAgent"
description = "Construct an SQL agent from an LLM and tools." description = "Construct an SQL agent from an LLM and tools."
name = "SQLAgent"
def build_config(self): def build_config(self):
return { return {

View file

@ -15,6 +15,7 @@ class ToolCallingAgentComponent(Component):
description: str = "Agent that uses tools. Only models that are compatible with function calling are supported." description: str = "Agent that uses tools. Only models that are compatible with function calling are supported."
icon = "LangChain" icon = "LangChain"
beta = True beta = True
name = "ToolCallingAgent"
inputs = [ inputs = [
MessageTextInput( MessageTextInput(

View file

@ -10,6 +10,7 @@ from langflow.field_typing import LanguageModel
class VectorStoreAgentComponent(CustomComponent): class VectorStoreAgentComponent(CustomComponent):
display_name = "VectorStoreAgent" display_name = "VectorStoreAgent"
description = "Construct an agent from a Vector Store." description = "Construct an agent from a Vector Store."
name = "VectorStoreAgent"
def build_config(self): def build_config(self):
return { return {

View file

@ -10,6 +10,7 @@ from langflow.custom import CustomComponent
class VectorStoreRouterAgentComponent(CustomComponent): class VectorStoreRouterAgentComponent(CustomComponent):
display_name = "VectorStoreRouterAgent" display_name = "VectorStoreRouterAgent"
description = "Construct an agent from a Vector Store Router." description = "Construct an agent from a Vector Store Router."
name = "VectorStoreRouterAgent"
def build_config(self): def build_config(self):
return { return {

View file

@ -11,6 +11,7 @@ from langflow.schema import Data
class XMLAgentComponent(LCAgentComponent): class XMLAgentComponent(LCAgentComponent):
display_name = "XMLAgent" display_name = "XMLAgent"
description = "Construct an XML agent from an LLM and tools." description = "Construct an XML agent from an LLM and tools."
name = "XMLAgent"
def build_config(self): def build_config(self):
return { return {

View file

@ -9,6 +9,7 @@ from langflow.field_typing import BaseMemory, LanguageModel, Text
class ConversationChainComponent(CustomComponent): class ConversationChainComponent(CustomComponent):
display_name = "ConversationChain" display_name = "ConversationChain"
description = "Chain to have a conversation and load context from memory." description = "Chain to have a conversation and load context from memory."
name = "ConversationChain"
def build_config(self): def build_config(self):
return { return {

View file

@ -10,6 +10,7 @@ from langflow.field_typing import BaseMemory, LanguageModel, Text
class LLMChainComponent(CustomComponent): class LLMChainComponent(CustomComponent):
display_name = "LLMChain" display_name = "LLMChain"
description = "Chain to run queries against LLMs" description = "Chain to run queries against LLMs"
name = "LLMChain"
def build_config(self): def build_config(self):
return { return {

View file

@ -8,6 +8,7 @@ class LLMCheckerChainComponent(CustomComponent):
display_name = "LLMCheckerChain" display_name = "LLMCheckerChain"
description = "" description = ""
documentation = "https://python.langchain.com/docs/modules/chains/additional/llm_checker" documentation = "https://python.langchain.com/docs/modules/chains/additional/llm_checker"
name = "LLMCheckerChain"
def build_config(self): def build_config(self):
return { return {

View file

@ -10,6 +10,7 @@ class LLMMathChainComponent(CustomComponent):
display_name = "LLMMathChain" display_name = "LLMMathChain"
description = "Chain that interprets a prompt and executes python code to do math." description = "Chain that interprets a prompt and executes python code to do math."
documentation = "https://python.langchain.com/docs/modules/chains/additional/llm_math" documentation = "https://python.langchain.com/docs/modules/chains/additional/llm_math"
name = "LLMMathChain"
def build_config(self): def build_config(self):
return { return {

View file

@ -11,6 +11,7 @@ from langflow.schema import Data
class RetrievalQAComponent(CustomComponent): class RetrievalQAComponent(CustomComponent):
display_name = "Retrieval QA" display_name = "Retrieval QA"
description = "Chain for question-answering against an index." description = "Chain for question-answering against an index."
name = "RetrievalQA"
def build_config(self): def build_config(self):
return { return {

View file

@ -10,6 +10,7 @@ from langflow.field_typing import BaseMemory, BaseRetriever, LanguageModel, Text
class RetrievalQAWithSourcesChainComponent(CustomComponent): class RetrievalQAWithSourcesChainComponent(CustomComponent):
display_name = "RetrievalQAWithSourcesChain" display_name = "RetrievalQAWithSourcesChain"
description = "Question-answering with sources over an index." description = "Question-answering with sources over an index."
name = "RetrievalQAWithSourcesChain"
def build_config(self): def build_config(self):
return { return {

View file

@ -12,6 +12,7 @@ from langflow.field_typing import LanguageModel, Text
class SQLGeneratorComponent(CustomComponent): class SQLGeneratorComponent(CustomComponent):
display_name = "Natural Language to SQL" display_name = "Natural Language to SQL"
description = "Generate SQL from natural language." description = "Generate SQL from natural language."
name = "SQLGenerator"
def build_config(self): def build_config(self):
return { return {

View file

@ -22,6 +22,7 @@ class APIRequestComponent(Component):
"**Note:** Check advanced options for more settings." "**Note:** Check advanced options for more settings."
) )
icon = "Globe" icon = "Globe"
name = "APIRequest"
inputs = [ inputs = [
MessageTextInput( MessageTextInput(

View file

@ -11,6 +11,7 @@ class DirectoryComponent(Component):
display_name = "Directory" display_name = "Directory"
description = "Recursively load files from a directory." description = "Recursively load files from a directory."
icon = "folder" icon = "folder"
name = "Directory"
inputs = [ inputs = [
MessageTextInput( MessageTextInput(

View file

@ -10,6 +10,7 @@ class FileComponent(Component):
display_name = "File" display_name = "File"
description = "A generic file loader." description = "A generic file loader."
icon = "file-text" icon = "file-text"
name = "File"
inputs = [ inputs = [
FileInput( FileInput(

View file

@ -11,6 +11,7 @@ class URLComponent(Component):
display_name = "URL" display_name = "URL"
description = "Fetch content from one or more URLs." description = "Fetch content from one or more URLs."
icon = "layout-template" icon = "layout-template"
name = "URL"
inputs = [ inputs = [
MessageTextInput( MessageTextInput(

View file

@ -8,6 +8,7 @@ from langflow.schema import Data
class WebhookComponent(Component): class WebhookComponent(Component):
display_name = "Webhook Input" display_name = "Webhook Input"
description = "Defines a webhook input for the flow." description = "Defines a webhook input for the flow."
name = "Webhook"
inputs = [ inputs = [
MultilineInput( MultilineInput(

View file

@ -23,6 +23,7 @@ class AgentComponent(LCAgentComponent):
"memory", "memory",
"input_value", "input_value",
] ]
name = "AgentComponent"
def build_config(self): def build_config(self):
return { return {

View file

@ -7,6 +7,7 @@ from langflow.field_typing import Input, Output, Text
class CodeBlockExtractor(Component): class CodeBlockExtractor(Component):
display_name = "Code Block Extractor" display_name = "Code Block Extractor"
description = "Extracts code block from text." description = "Extracts code block from text."
name = "CodeBlockExtractor"
inputs = [Input(name="text", field_type=Text, description="Text to extract code blocks from.")] inputs = [Input(name="text", field_type=Text, description="Text to extract code blocks from.")]

View file

@ -10,6 +10,7 @@ class DocumentsToDataComponent(CustomComponent):
display_name = "Documents ⇢ Data" display_name = "Documents ⇢ Data"
description = "Convert LangChain Documents into Data." description = "Convert LangChain Documents into Data."
icon = "LangChain" icon = "LangChain"
name = "DocumentsToData"
field_config = { field_config = {
"documents": {"display_name": "Documents"}, "documents": {"display_name": "Documents"},

View file

@ -5,6 +5,7 @@ from langflow.schema import Data
class EmbedComponent(CustomComponent): class EmbedComponent(CustomComponent):
display_name = "Embed Texts" display_name = "Embed Texts"
name = "Embed"
def build_config(self): def build_config(self):
return {"texts": {"display_name": "Texts"}, "embbedings": {"display_name": "Embeddings"}} return {"texts": {"display_name": "Texts"}, "embbedings": {"display_name": "Embeddings"}}

View file

@ -6,6 +6,7 @@ class ExtractKeyFromDataComponent(CustomComponent):
display_name = "Extract Key From Data" display_name = "Extract Key From Data"
description = "Extracts a key from a data." description = "Extracts a key from a data."
beta: bool = True beta: bool = True
name = "ExtractKeyFromData"
field_config = { field_config = {
"data": {"display_name": "Data"}, "data": {"display_name": "Data"},

View file

@ -9,6 +9,7 @@ class ListFlowsComponent(CustomComponent):
description = "A component to list all available flows." description = "A component to list all available flows."
icon = "ListFlows" icon = "ListFlows"
beta: bool = True beta: bool = True
name = "ListFlows"
def build_config(self): def build_config(self):
return {} return {}

View file

@ -6,6 +6,7 @@ class MergeDataComponent(CustomComponent):
display_name = "Merge Data" display_name = "Merge Data"
description = "Merges data." description = "Merges data."
beta: bool = True beta: bool = True
name = "MergeData"
field_config = { field_config = {
"data": {"display_name": "Data"}, "data": {"display_name": "Data"},

View file

@ -7,6 +7,7 @@ from langflow.schema.message import Message
class MessageComponent(CustomComponent): class MessageComponent(CustomComponent):
display_name = "Message" display_name = "Message"
description = "Creates a Message object given a Session ID." description = "Creates a Message object given a Session ID."
name = "Message"
def build_config(self): def build_config(self):
return { return {

View file

@ -7,6 +7,7 @@ class SelectivePassThroughComponent(Component):
display_name = "Selective Pass Through" display_name = "Selective Pass Through"
description = "Passes the specified value if a specified condition is met." description = "Passes the specified value if a specified condition is met."
icon = "filter" icon = "filter"
name = "SelectivePassThrough"
inputs = [ inputs = [
MessageTextInput( MessageTextInput(

View file

@ -8,6 +8,7 @@ from langflow.field_typing import LanguageModel, Text
class ShouldRunNextComponent(CustomComponent): class ShouldRunNextComponent(CustomComponent):
display_name = "Should Run Next" display_name = "Should Run Next"
description = "Determines if a vertex is runnable." description = "Determines if a vertex is runnable."
name = "ShouldRunNext"
def build(self, llm: LanguageModel, question: str, context: str, retries: int = 3) -> Text: def build(self, llm: LanguageModel, question: str, context: str, retries: int = 3) -> Text:
template = "Given the following question and the context below, answer with a yes or no.\n\n{error_message}\n\nQuestion: {question}\n\nContext: {context}\n\nAnswer:" template = "Given the following question and the context below, answer with a yes or no.\n\n{error_message}\n\nQuestion: {question}\n\nContext: {context}\n\nAnswer:"

View file

@ -12,6 +12,7 @@ class SplitTextComponent(Component):
display_name: str = "Split Text" display_name: str = "Split Text"
description: str = "Split text into chunks based on specified criteria." description: str = "Split text into chunks based on specified criteria."
icon = "scissors-line-dashed" icon = "scissors-line-dashed"
name = "SplitText"
inputs = [ inputs = [
HandleInput( HandleInput(

View file

@ -6,6 +6,7 @@ from langflow.schema.message import Message
class StoreMessageComponent(CustomComponent): class StoreMessageComponent(CustomComponent):
display_name = "Store Message" display_name = "Store Message"
description = "Stores a chat message." description = "Stores a chat message."
name = "StoreMessage"
def build_config(self): def build_config(self):
return { return {

View file

@ -19,6 +19,7 @@ class SubFlowComponent(CustomComponent):
) )
beta: bool = True beta: bool = True
field_order = ["flow_name"] field_order = ["flow_name"]
name = "SubFlow"
def get_flow_names(self) -> List[str]: def get_flow_names(self) -> List[str]:
flow_datas = self.list_flows() flow_datas = self.list_flows()

View file

@ -10,6 +10,7 @@ class AmazonBedrockEmbeddingsComponent(LCModelComponent):
description: str = "Generate embeddings using Amazon Bedrock models." description: str = "Generate embeddings using Amazon Bedrock models."
documentation = "https://python.langchain.com/docs/modules/data_connection/text_embedding/integrations/bedrock" documentation = "https://python.langchain.com/docs/modules/data_connection/text_embedding/integrations/bedrock"
icon = "Amazon" icon = "Amazon"
name = "AmazonBedrockEmbeddings"
inputs = [ inputs = [
DropdownInput( DropdownInput(

View file

@ -9,6 +9,7 @@ class AstraVectorize(Component):
description: str = "Configuration options for Astra Vectorize server-side embeddings." description: str = "Configuration options for Astra Vectorize server-side embeddings."
documentation: str = "https://docs.datastax.com/en/astra-db-serverless/databases/embedding-generation.html" documentation: str = "https://docs.datastax.com/en/astra-db-serverless/databases/embedding-generation.html"
icon = "AstraDB" icon = "AstraDB"
name = "AstraVectorize"
VECTORIZE_PROVIDERS_MAPPING = { VECTORIZE_PROVIDERS_MAPPING = {
"Azure OpenAI": ["azureOpenAI", ["text-embedding-3-small", "text-embedding-3-large", "text-embedding-ada-002"]], "Azure OpenAI": ["azureOpenAI", ["text-embedding-3-small", "text-embedding-3-large", "text-embedding-ada-002"]],

View file

@ -11,6 +11,7 @@ class AzureOpenAIEmbeddingsComponent(LCModelComponent):
description: str = "Generate embeddings using Azure OpenAI models." description: str = "Generate embeddings using Azure OpenAI models."
documentation: str = "https://python.langchain.com/docs/integrations/text_embedding/azureopenai" documentation: str = "https://python.langchain.com/docs/integrations/text_embedding/azureopenai"
icon = "Azure" icon = "Azure"
name = "AzureOpenAIEmbeddings"
API_VERSION_OPTIONS = [ API_VERSION_OPTIONS = [
"2022-12-01", "2022-12-01",

View file

@ -9,6 +9,8 @@ class CohereEmbeddingsComponent(LCModelComponent):
display_name = "Cohere Embeddings" display_name = "Cohere Embeddings"
description = "Generate embeddings using Cohere models." description = "Generate embeddings using Cohere models."
icon = "Cohere" icon = "Cohere"
name = "CohereEmbeddings"
inputs = [ inputs = [
SecretStrInput(name="cohere_api_key", display_name="Cohere API Key"), SecretStrInput(name="cohere_api_key", display_name="Cohere API Key"),
DropdownInput( DropdownInput(

View file

@ -12,6 +12,7 @@ class HuggingFaceEmbeddingsComponent(LCModelComponent):
"https://python.langchain.com/docs/modules/data_connection/text_embedding/integrations/sentence_transformers" "https://python.langchain.com/docs/modules/data_connection/text_embedding/integrations/sentence_transformers"
) )
icon = "HuggingFace" icon = "HuggingFace"
name = "HuggingFaceEmbeddings"
inputs = [ inputs = [
MessageTextInput(name="cache_folder", display_name="Cache Folder", advanced=True), MessageTextInput(name="cache_folder", display_name="Cache Folder", advanced=True),

View file

@ -11,6 +11,7 @@ class HuggingFaceInferenceAPIEmbeddingsComponent(LCModelComponent):
description = "Generate embeddings using Hugging Face Inference API models." description = "Generate embeddings using Hugging Face Inference API models."
documentation = "https://github.com/huggingface/text-embeddings-inference" documentation = "https://github.com/huggingface/text-embeddings-inference"
icon = "HuggingFace" icon = "HuggingFace"
name = "HuggingFaceInferenceAPIEmbeddings"
inputs = [ inputs = [
SecretStrInput(name="api_key", display_name="API Key", advanced=True), SecretStrInput(name="api_key", display_name="API Key", advanced=True),

View file

@ -10,6 +10,7 @@ class MistralAIEmbeddingsComponent(LCModelComponent):
display_name = "MistralAI Embeddings" display_name = "MistralAI Embeddings"
description = "Generate embeddings using MistralAI models." description = "Generate embeddings using MistralAI models."
icon = "MistralAI" icon = "MistralAI"
name = "MistalAIEmbeddings"
inputs = [ inputs = [
DropdownInput( DropdownInput(

View file

@ -10,6 +10,7 @@ class OllamaEmbeddingsComponent(LCModelComponent):
description: str = "Generate embeddings using Ollama models." description: str = "Generate embeddings using Ollama models."
documentation = "https://python.langchain.com/docs/integrations/text_embedding/ollama" documentation = "https://python.langchain.com/docs/integrations/text_embedding/ollama"
icon = "Ollama" icon = "Ollama"
name = "OllamaEmbeddings"
inputs = [ inputs = [
MessageTextInput( MessageTextInput(

View file

@ -9,6 +9,8 @@ class OpenAIEmbeddingsComponent(LCEmbeddingsModel):
display_name = "OpenAI Embeddings" display_name = "OpenAI Embeddings"
description = "Generate embeddings using OpenAI models." description = "Generate embeddings using OpenAI models."
icon = "OpenAI" icon = "OpenAI"
name = "OpenAIEmbeddings"
inputs = [ inputs = [
DictInput( DictInput(
name="default_headers", name="default_headers",

View file

@ -7,6 +7,7 @@ class VertexAIEmbeddingsComponent(LCModelComponent):
display_name = "VertexAI Embeddings" display_name = "VertexAI Embeddings"
description = "Generate embeddings using Google Cloud VertexAI models." description = "Generate embeddings using Google Cloud VertexAI models."
icon = "VertexAI" icon = "VertexAI"
name = "VertexAIEmbeddings"
inputs = [ inputs = [
FileInput( FileInput(

View file

@ -7,6 +7,7 @@ class CombineTextComponent(Component):
display_name = "Combine Text" display_name = "Combine Text"
description = "Concatenate two text sources into a single text chunk using a specified delimiter." description = "Concatenate two text sources into a single text chunk using a specified delimiter."
icon = "merge" icon = "merge"
name = "CombineText"
inputs = [ inputs = [
MessageTextInput( MessageTextInput(

View file

@ -8,6 +8,7 @@ class CreateListComponent(Component):
display_name = "Create List" display_name = "Create List"
description = "Creates a list of texts." description = "Creates a list of texts."
icon = "list" icon = "list"
name = "CreateList"
inputs = [ inputs = [
StrInput( StrInput(

View file

@ -9,6 +9,7 @@ class CustomComponent(Component):
description = "Use as a template to create your own component." description = "Use as a template to create your own component."
documentation: str = "http://docs.langflow.org/components/custom" documentation: str = "http://docs.langflow.org/components/custom"
icon = "custom_components" icon = "custom_components"
name = "CustomComponent"
inputs = [ inputs = [
MessageTextInput(name="input_value", display_name="Input Value", value="Hello, World!"), MessageTextInput(name="input_value", display_name="Input Value", value="Hello, World!"),

View file

@ -10,6 +10,7 @@ class FilterDataComponent(Component):
description = "Filters a Data object based on a list of keys." description = "Filters a Data object based on a list of keys."
icon = "filter" icon = "filter"
beta = True beta = True
name = "FilterData"
inputs = [ inputs = [
DataInput( DataInput(

View file

@ -8,6 +8,7 @@ from langflow.schema.dotdict import dotdict
class IDGeneratorComponent(CustomComponent): class IDGeneratorComponent(CustomComponent):
display_name = "ID Generator" display_name = "ID Generator"
description = "Generates a unique ID." description = "Generates a unique ID."
name = "IDGenerator"
def update_build_config( # type: ignore def update_build_config( # type: ignore
self, build_config: dotdict, field_value: Any, field_name: Optional[str] = None self, build_config: dotdict, field_value: Any, field_name: Optional[str] = None

View file

@ -10,6 +10,7 @@ class MemoryComponent(Component):
display_name = "Chat Memory" display_name = "Chat Memory"
description = "Retrieves stored chat messages." description = "Retrieves stored chat messages."
icon = "message-square-more" icon = "message-square-more"
name = "Memory"
inputs = [ inputs = [
DropdownInput( DropdownInput(

View file

@ -6,6 +6,7 @@ class MergeDataComponent(CustomComponent):
display_name = "Merge Data" display_name = "Merge Data"
description = "Combines multiple data sources into a single unified Data object." description = "Combines multiple data sources into a single unified Data object."
beta: bool = True beta: bool = True
name = "MergeData"
field_config = { field_config = {
"data": {"display_name": "Data"}, "data": {"display_name": "Data"},

View file

@ -8,6 +8,7 @@ class ParseDataComponent(Component):
display_name = "Parse Data" display_name = "Parse Data"
description = "Convert Data into plain text following a specified template." description = "Convert Data into plain text following a specified template."
icon = "braces" icon = "braces"
name = "ParseData"
inputs = [ inputs = [
DataInput(name="data", display_name="Data", info="The data to convert to text."), DataInput(name="data", display_name="Data", info="The data to convert to text."),

View file

@ -12,6 +12,7 @@ class SplitTextComponent(Component):
display_name: str = "Split Text" display_name: str = "Split Text"
description: str = "Split text into chunks based on specified criteria." description: str = "Split text into chunks based on specified criteria."
icon = "scissors-line-dashed" icon = "scissors-line-dashed"
name = "SplitText"
inputs = [ inputs = [
HandleInput( HandleInput(

View file

@ -9,6 +9,7 @@ class StoreMessageComponent(Component):
display_name = "Store Message" display_name = "Store Message"
description = "Stores a chat message or text." description = "Stores a chat message or text."
icon = "save" icon = "save"
name = "StoreMessage"
inputs = [ inputs = [
MessageInput(name="message", display_name="Message", info="The chat message to be stored.", required=True), MessageInput(name="message", display_name="Message", info="The chat message to be stored.", required=True),

View file

@ -8,6 +8,7 @@ class ChatInput(ChatComponent):
display_name = "Chat Input" display_name = "Chat Input"
description = "Get chat inputs from the Playground." description = "Get chat inputs from the Playground."
icon = "ChatInput" icon = "ChatInput"
name = "ChatInput"
inputs = [ inputs = [
MultilineInput( MultilineInput(

View file

@ -7,6 +7,7 @@ class TextInputComponent(TextComponent):
display_name = "Text Input" display_name = "Text Input"
description = "Get text inputs from the Playground." description = "Get text inputs from the Playground."
icon = "type" icon = "type"
name = "TextInput"
inputs = [ inputs = [
MessageTextInput( MessageTextInput(

View file

@ -9,6 +9,7 @@ from langflow.custom import CustomComponent
class BingSearchAPIWrapperComponent(CustomComponent): class BingSearchAPIWrapperComponent(CustomComponent):
display_name = "BingSearchAPIWrapper" display_name = "BingSearchAPIWrapper"
description = "Wrapper for Bing Search API." description = "Wrapper for Bing Search API."
name = "BingSearchAPIWrapper"
def build_config(self): def build_config(self):
return { return {

View file

@ -8,6 +8,8 @@ from langflow.schema import Data
class FirecrawlCrawlApi(CustomComponent): class FirecrawlCrawlApi(CustomComponent):
display_name: str = "FirecrawlCrawlApi" display_name: str = "FirecrawlCrawlApi"
description: str = "Firecrawl Crawl API." description: str = "Firecrawl Crawl API."
name = "FirecrawlCrawlApi"
output_types: list[str] = ["Document"] output_types: list[str] = ["Document"]
documentation: str = "https://docs.firecrawl.dev/api-reference/endpoint/crawl" documentation: str = "https://docs.firecrawl.dev/api-reference/endpoint/crawl"
field_config = { field_config = {

View file

@ -7,6 +7,8 @@ from langflow.schema import Data
class FirecrawlScrapeApi(CustomComponent): class FirecrawlScrapeApi(CustomComponent):
display_name: str = "FirecrawlScrapeApi" display_name: str = "FirecrawlScrapeApi"
description: str = "Firecrawl Scrape API." description: str = "Firecrawl Scrape API."
name = "FirecrawlScrapeApi"
output_types: list[str] = ["Document"] output_types: list[str] = ["Document"]
documentation: str = "https://docs.firecrawl.dev/api-reference/endpoint/scrape" documentation: str = "https://docs.firecrawl.dev/api-reference/endpoint/scrape"
field_config = { field_config = {

View file

@ -8,6 +8,7 @@ from langflow.custom import CustomComponent
class GoogleSearchAPIWrapperComponent(CustomComponent): class GoogleSearchAPIWrapperComponent(CustomComponent):
display_name = "GoogleSearchAPIWrapper" display_name = "GoogleSearchAPIWrapper"
description = "Wrapper for Google Search API." description = "Wrapper for Google Search API."
name = "GoogleSearchAPIWrapper"
def build_config(self): def build_config(self):
return { return {

View file

@ -10,6 +10,7 @@ from langflow.custom import CustomComponent
class GoogleSerperAPIWrapperComponent(CustomComponent): class GoogleSerperAPIWrapperComponent(CustomComponent):
display_name = "GoogleSerperAPIWrapper" display_name = "GoogleSerperAPIWrapper"
description = "Wrapper around the Serper.dev Google Search API." description = "Wrapper around the Serper.dev Google Search API."
name = "GoogleSerperAPIWrapper"
def build_config(self) -> Dict[str, Dict]: def build_config(self) -> Dict[str, Dict]:
return { return {

View file

@ -20,6 +20,8 @@ from langflow.services.database.models.base import orjson_dumps
class JSONDocumentBuilder(CustomComponent): class JSONDocumentBuilder(CustomComponent):
display_name: str = "JSON Document Builder" display_name: str = "JSON Document Builder"
description: str = "Build a Document containing a JSON object using a key and another Document page content." description: str = "Build a Document containing a JSON object using a key and another Document page content."
name = "JSONDocumentBuilder"
output_types: list[str] = ["Document"] output_types: list[str] = ["Document"]
documentation: str = "https://docs.langflow.org/components/utilities#json-document-builder" documentation: str = "https://docs.langflow.org/components/utilities#json-document-builder"

View file

@ -6,6 +6,7 @@ from langflow.custom import CustomComponent
class SQLDatabaseComponent(CustomComponent): class SQLDatabaseComponent(CustomComponent):
display_name = "SQLDatabase" display_name = "SQLDatabase"
description = "SQL Database" description = "SQL Database"
name = "SQLDatabase"
def build_config(self): def build_config(self):
return { return {

View file

@ -10,6 +10,8 @@ from langflow.services.database.models.base import orjson_dumps
class SearchApi(CustomComponent): class SearchApi(CustomComponent):
display_name: str = "SearchApi" display_name: str = "SearchApi"
description: str = "Real-time search engine results API." description: str = "Real-time search engine results API."
name = "SearchApi"
output_types: list[str] = ["Document"] output_types: list[str] = ["Document"]
documentation: str = "https://www.searchapi.io/docs/google" documentation: str = "https://www.searchapi.io/docs/google"
field_config = { field_config = {

View file

@ -8,6 +8,7 @@ from langflow.custom import CustomComponent
class SearxSearchWrapperComponent(CustomComponent): class SearxSearchWrapperComponent(CustomComponent):
display_name = "SearxSearchWrapper" display_name = "SearxSearchWrapper"
description = "Wrapper for Searx API." description = "Wrapper for Searx API."
name = "SearxSearchWrapper"
def build_config(self): def build_config(self):
return { return {

View file

@ -8,6 +8,7 @@ from langflow.custom import CustomComponent
class SerpAPIWrapperComponent(CustomComponent): class SerpAPIWrapperComponent(CustomComponent):
display_name = "SerpAPIWrapper" display_name = "SerpAPIWrapper"
description = "Wrapper around SerpAPI" description = "Wrapper around SerpAPI"
name = "SerpAPIWrapper"
def build_config(self): def build_config(self):
return { return {

View file

@ -12,6 +12,7 @@ from langflow.custom import CustomComponent
class WikipediaAPIWrapperComponent(CustomComponent): class WikipediaAPIWrapperComponent(CustomComponent):
display_name = "WikipediaAPIWrapper" display_name = "WikipediaAPIWrapper"
description = "Wrapper around WikipediaAPI." description = "Wrapper around WikipediaAPI."
name = "WikipediaAPIWrapper"
def build_config(self): def build_config(self):
return {} return {}

View file

@ -11,6 +11,7 @@ from langflow.custom import CustomComponent
class WolframAlphaAPIWrapperComponent(CustomComponent): class WolframAlphaAPIWrapperComponent(CustomComponent):
display_name = "WolframAlphaAPIWrapper" display_name = "WolframAlphaAPIWrapper"
description = "Wrapper for Wolfram Alpha." description = "Wrapper for Wolfram Alpha."
name = "WolframAlphaAPIWrapper"
def build_config(self): def build_config(self):
return {"appid": {"display_name": "App ID", "type": "str", "password": True}} return {"appid": {"display_name": "App ID", "type": "str", "password": True}}

View file

@ -7,6 +7,7 @@ from langflow.schema import Data
class AstraDBMessageReaderComponent(BaseMemoryComponent): class AstraDBMessageReaderComponent(BaseMemoryComponent):
display_name = "Astra DB Message Reader" display_name = "Astra DB Message Reader"
description = "Retrieves stored chat messages from Astra DB." description = "Retrieves stored chat messages from Astra DB."
name = "AstraDBMessageReader"
def build_config(self): def build_config(self):
return { return {

View file

@ -9,6 +9,7 @@ from langflow.schema import Data
class AstraDBMessageWriterComponent(BaseMemoryComponent): class AstraDBMessageWriterComponent(BaseMemoryComponent):
display_name = "Astra DB Message Writer" display_name = "Astra DB Message Writer"
description = "Writes a message to Astra DB." description = "Writes a message to Astra DB."
name = "AstraDBMessageWriter"
def build_config(self): def build_config(self):
return { return {

View file

@ -9,6 +9,7 @@ from langflow.schema.data import Data
class CassandraMessageReaderComponent(BaseMemoryComponent): class CassandraMessageReaderComponent(BaseMemoryComponent):
display_name = "Cassandra Message Reader" display_name = "Cassandra Message Reader"
description = "Retrieves stored chat messages from a Cassandra table on Astra DB." description = "Retrieves stored chat messages from a Cassandra table on Astra DB."
name = "CassandraMessageReader"
def build_config(self): def build_config(self):
return { return {

View file

@ -10,6 +10,7 @@ from langflow.schema.data import Data
class CassandraMessageWriterComponent(BaseMemoryComponent): class CassandraMessageWriterComponent(BaseMemoryComponent):
display_name = "Cassandra Message Writer" display_name = "Cassandra Message Writer"
description = "Writes a message to a Cassandra table on Astra DB." description = "Writes a message to a Cassandra table on Astra DB."
name = "CassandraMessageWriter"
def build_config(self): def build_config(self):
return { return {

View file

@ -10,6 +10,7 @@ from langflow.schema import Data
class ZepMessageReaderComponent(BaseMemoryComponent): class ZepMessageReaderComponent(BaseMemoryComponent):
display_name = "Zep Message Reader" display_name = "Zep Message Reader"
description = "Retrieves stored chat messages from Zep." description = "Retrieves stored chat messages from Zep."
name = "ZepMessageReader"
def build_config(self): def build_config(self):
return { return {

View file

@ -11,6 +11,7 @@ if TYPE_CHECKING:
class ZepMessageWriterComponent(BaseMemoryComponent): class ZepMessageWriterComponent(BaseMemoryComponent):
display_name = "Zep Message Writer" display_name = "Zep Message Writer"
description = "Writes a message to Zep." description = "Writes a message to Zep."
name = "ZepMessageWriter"
def build_config(self): def build_config(self):
return { return {

View file

@ -11,6 +11,7 @@ class AmazonBedrockComponent(LCModelComponent):
display_name: str = "Amazon Bedrock" display_name: str = "Amazon Bedrock"
description: str = "Generate text using Amazon Bedrock LLMs." description: str = "Generate text using Amazon Bedrock LLMs."
icon = "Amazon" icon = "Amazon"
name = "AmazonBedrockModel"
inputs = [ inputs = [
MessageInput(name="input_value", display_name="Input"), MessageInput(name="input_value", display_name="Input"),

View file

@ -11,6 +11,7 @@ class AnthropicModelComponent(LCModelComponent):
display_name = "Anthropic" display_name = "Anthropic"
description = "Generate text using Anthropic Chat&Completion LLMs with prefill support." description = "Generate text using Anthropic Chat&Completion LLMs with prefill support."
icon = "Anthropic" icon = "Anthropic"
name = "AnthropicModel"
inputs = [ inputs = [
MessageTextInput(name="input_value", display_name="Input"), MessageTextInput(name="input_value", display_name="Input"),

View file

@ -12,6 +12,7 @@ class AzureChatOpenAIComponent(LCModelComponent):
documentation: str = "https://python.langchain.com/docs/integrations/llms/azure_openai" documentation: str = "https://python.langchain.com/docs/integrations/llms/azure_openai"
beta = False beta = False
icon = "Azure" icon = "Azure"
name = "AzureOpenAIModel"
AZURE_OPENAI_API_VERSIONS = [ AZURE_OPENAI_API_VERSIONS = [
"2023-03-15-preview", "2023-03-15-preview",

View file

@ -12,6 +12,7 @@ class QianfanChatEndpointComponent(LCModelComponent):
description: str = "Generate text using Baidu Qianfan LLMs." description: str = "Generate text using Baidu Qianfan LLMs."
documentation: str = "https://python.langchain.com/docs/integrations/chat/baidu_qianfan_endpoint" documentation: str = "https://python.langchain.com/docs/integrations/chat/baidu_qianfan_endpoint"
icon = "BaiduQianfan" icon = "BaiduQianfan"
name = "BaiduQianfanChatModel"
inputs = [ inputs = [
MessageTextInput( MessageTextInput(

View file

@ -12,6 +12,7 @@ class CohereComponent(LCModelComponent):
description = "Generate text using Cohere LLMs." description = "Generate text using Cohere LLMs."
documentation = "https://python.langchain.com/docs/modules/model_io/models/llms/integrations/cohere" documentation = "https://python.langchain.com/docs/modules/model_io/models/llms/integrations/cohere"
icon = "Cohere" icon = "Cohere"
name = "CohereModel"
inputs = [ inputs = [
SecretStrInput( SecretStrInput(

View file

@ -10,6 +10,7 @@ class GoogleGenerativeAIComponent(LCModelComponent):
display_name = "Google Generative AI" display_name = "Google Generative AI"
description = "Generate text using Google Generative AI." description = "Generate text using Google Generative AI."
icon = "GoogleGenerativeAI" icon = "GoogleGenerativeAI"
name = "GoogleGenerativeAIModel"
inputs = [ inputs = [
MessageInput(name="input_value", display_name="Input"), MessageInput(name="input_value", display_name="Input"),

View file

@ -12,6 +12,7 @@ class GroqModel(LCModelComponent):
display_name: str = "Groq" display_name: str = "Groq"
description: str = "Generate text using Groq." description: str = "Generate text using Groq."
icon = "Groq" icon = "Groq"
name = "GroqModel"
inputs = [ inputs = [
SecretStrInput( SecretStrInput(

View file

@ -11,6 +11,7 @@ class HuggingFaceEndpointsComponent(LCModelComponent):
display_name: str = "Hugging Face API" display_name: str = "Hugging Face API"
description: str = "Generate text using Hugging Face Inference APIs." description: str = "Generate text using Hugging Face Inference APIs."
icon = "HuggingFace" icon = "HuggingFace"
name = "HuggingFaceModel"
inputs = [ inputs = [
MessageInput(name="input_value", display_name="Input"), MessageInput(name="input_value", display_name="Input"),

View file

@ -11,6 +11,7 @@ class MistralAIModelComponent(LCModelComponent):
display_name = "MistralAI" display_name = "MistralAI"
description = "Generates text using MistralAI LLMs." description = "Generates text using MistralAI LLMs."
icon = "MistralAI" icon = "MistralAI"
name = "MistralModel"
inputs = [ inputs = [
MessageInput(name="input_value", display_name="Input"), MessageInput(name="input_value", display_name="Input"),

View file

@ -13,6 +13,7 @@ class ChatOllamaComponent(LCModelComponent):
display_name = "Ollama" display_name = "Ollama"
description = "Generate text using Ollama Local LLMs." description = "Generate text using Ollama Local LLMs."
icon = "Ollama" icon = "Ollama"
name = "OllamaModel"
def update_build_config(self, build_config: dict, field_value: Any, field_name: str | None = None): def update_build_config(self, build_config: dict, field_value: Any, field_name: str | None = None):
if field_name == "mirostat": if field_name == "mirostat":

View file

@ -24,6 +24,7 @@ class OpenAIModelComponent(LCModelComponent):
display_name = "OpenAI" display_name = "OpenAI"
description = "Generates text using OpenAI LLMs." description = "Generates text using OpenAI LLMs."
icon = "OpenAI" icon = "OpenAI"
name = "OpenAIModel"
inputs = [ inputs = [
MessageInput(name="input_value", display_name="Input"), MessageInput(name="input_value", display_name="Input"),

View file

@ -10,6 +10,7 @@ class ChatVertexAIComponent(LCModelComponent):
display_name = "Vertex AI" display_name = "Vertex AI"
description = "Generate text using Vertex AI LLMs." description = "Generate text using Vertex AI LLMs."
icon = "VertexAI" icon = "VertexAI"
name = "VertexAiModel"
inputs = [ inputs = [
MessageInput(name="input_value", display_name="Input"), MessageInput(name="input_value", display_name="Input"),

View file

@ -7,6 +7,7 @@ class ChatOutput(ChatComponent):
display_name = "Chat Output" display_name = "Chat Output"
description = "Display a chat message in the Playground." description = "Display a chat message in the Playground."
icon = "ChatOutput" icon = "ChatOutput"
name = "ChatOutput"
inputs = [ inputs = [
MessageTextInput( MessageTextInput(

View file

@ -7,6 +7,7 @@ class TextOutputComponent(TextComponent):
display_name = "Text Output" display_name = "Text Output"
description = "Display a text output in the Playground." description = "Display a text output in the Playground."
icon = "type" icon = "type"
name = "TextOutput"
inputs = [ inputs = [
MessageTextInput( MessageTextInput(

View file

@ -10,6 +10,7 @@ class PromptComponent(Component):
description: str = "Create a prompt template with dynamic variables." description: str = "Create a prompt template with dynamic variables."
icon = "prompts" icon = "prompts"
trace_type = "prompt" trace_type = "prompt"
name = "Prompt"
inputs = [ inputs = [
PromptInput(name="template", display_name="Template"), PromptInput(name="template", display_name="Template"),

View file

@ -7,6 +7,7 @@ class ConditionalRouterComponent(Component):
display_name = "Conditional Router" display_name = "Conditional Router"
description = "Routes an input message to a corresponding output based on text comparison." description = "Routes an input message to a corresponding output based on text comparison."
icon = "equal" icon = "equal"
name = "ConditionalRouter"
inputs = [ inputs = [
MessageTextInput( MessageTextInput(

View file

@ -13,6 +13,7 @@ from langflow.template.field.base import Input
class CreateDataComponent(Component): class CreateDataComponent(Component):
display_name: str = "Create Data" display_name: str = "Create Data"
description: str = "Dynamically create a Data with a specified number of fields." description: str = "Dynamically create a Data with a specified number of fields."
name: str = "CreateData"
inputs = [ inputs = [
IntInput( IntInput(

View file

@ -16,6 +16,7 @@ class FlowToolComponent(CustomComponent):
description = "Construct a Tool from a function that runs the loaded Flow." description = "Construct a Tool from a function that runs the loaded Flow."
field_order = ["flow_name", "name", "description", "return_direct"] field_order = ["flow_name", "name", "description", "return_direct"]
trace_type = "tool" trace_type = "tool"
name = "FlowTool"
beta = True beta = True
def get_flow_names(self) -> List[str]: def get_flow_names(self) -> List[str]:

View file

@ -5,6 +5,7 @@ from langflow.schema import Data
class ListenComponent(CustomComponent): class ListenComponent(CustomComponent):
display_name = "Listen" display_name = "Listen"
description = "A component to listen for a notification." description = "A component to listen for a notification."
name = "Listen"
beta: bool = True beta: bool = True
def build_config(self): def build_config(self):

View file

@ -8,6 +8,7 @@ class NotifyComponent(CustomComponent):
display_name = "Notify" display_name = "Notify"
description = "A component to generate a notification to Get Notified component." description = "A component to generate a notification to Get Notified component."
icon = "Notify" icon = "Notify"
name = "Notify"
beta: bool = True beta: bool = True
def build_config(self): def build_config(self):

View file

@ -7,6 +7,7 @@ from langflow.template import Output
class PassMessageComponent(Component): class PassMessageComponent(Component):
display_name = "Pass" display_name = "Pass"
description = "Forwards the input message, unchanged." description = "Forwards the input message, unchanged."
name = "Pass"
icon = "arrow-right" icon = "arrow-right"
inputs = [ inputs = [

View file

@ -9,6 +9,7 @@ class PythonFunctionComponent(CustomComponent):
display_name = "Python Function" display_name = "Python Function"
description = "Define a Python function." description = "Define a Python function."
icon = "Python" icon = "Python"
name = "PythonFunction"
beta = True beta = True
def build_config(self): def build_config(self):

View file

@ -10,6 +10,7 @@ from langflow.schema import Data, dotdict
class RunFlowComponent(CustomComponent): class RunFlowComponent(CustomComponent):
display_name = "Run Flow" display_name = "Run Flow"
description = "A component to run a flow." description = "A component to run a flow."
name = "RunFlow"
beta: bool = True beta: bool = True
def get_flow_names(self) -> List[str]: def get_flow_names(self) -> List[str]:

View file

@ -7,6 +7,7 @@ from langflow.field_typing import Text
class RunnableExecComponent(CustomComponent): class RunnableExecComponent(CustomComponent):
description = "Execute a runnable. It will try to guess the input and output keys." description = "Execute a runnable. It will try to guess the input and output keys."
display_name = "Runnable Executor" display_name = "Runnable Executor"
name = "RunnableExecutor"
beta: bool = True beta: bool = True
field_order = [ field_order = [
"input_key", "input_key",

View file

@ -8,6 +8,7 @@ from langflow.field_typing import Text
class SQLExecutorComponent(CustomComponent): class SQLExecutorComponent(CustomComponent):
display_name = "SQL Executor" display_name = "SQL Executor"
description = "Execute SQL query." description = "Execute SQL query."
name = "SQLExecutor"
beta: bool = True beta: bool = True
def build_config(self): def build_config(self):

View file

@ -17,6 +17,7 @@ class SubFlowComponent(CustomComponent):
description = ( description = (
"Dynamically Generates a Component from a Flow. The output is a list of data with keys 'result' and 'message'." "Dynamically Generates a Component from a Flow. The output is a list of data with keys 'result' and 'message'."
) )
name = "SubFlow"
beta: bool = True beta: bool = True
field_order = ["flow_name"] field_order = ["flow_name"]

View file

@ -5,6 +5,7 @@ from langflow.schema import Data
class UpdateDataComponent(CustomComponent): class UpdateDataComponent(CustomComponent):
display_name = "Update Data" display_name = "Update Data"
description = "Update Data with text-based key/value pairs, similar to updating a Python dictionary." description = "Update Data with text-based key/value pairs, similar to updating a Python dictionary."
name = "UpdateData"
def build_config(self): def build_config(self):
return { return {

Some files were not shown because too many files have changed in this diff Show more