From 5f18baadb530bfbd15706e8e6febb73ffeafad2a Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 17 Jul 2024 12:48:35 -0300 Subject: [PATCH] feat: add two new starter projects (#2758) * feat: add sequential agent starter project * feat: add hierarchical agent starter project * update example * refactor: update newFlowModal examples for Sequential Agent, Hierarchical Agent, and Complex Agent --- .../starter_projects/Hierarchical Agent.json | 2711 +++++++++++++++ .../starter_projects/Sequential Agent.json | 3055 +++++++++++++++++ .../src/modals/newFlowModal/index.tsx | 10 +- 3 files changed, 5772 insertions(+), 4 deletions(-) create mode 100644 src/backend/base/langflow/initial_setup/starter_projects/Hierarchical Agent.json create mode 100644 src/backend/base/langflow/initial_setup/starter_projects/Sequential Agent.json diff --git a/src/backend/base/langflow/initial_setup/starter_projects/Hierarchical Agent.json b/src/backend/base/langflow/initial_setup/starter_projects/Hierarchical Agent.json new file mode 100644 index 000000000..2a4d75dd2 --- /dev/null +++ b/src/backend/base/langflow/initial_setup/starter_projects/Hierarchical Agent.json @@ -0,0 +1,2711 @@ +{ + "id": "6302081f-5af2-4b9f-bd19-2baaf7218ba6", + "data": { + "nodes": [ + { + "id": "HierarchicalCrewComponent-JNKGT", + "type": "genericNode", + "position": { + "x": 568, + "y": 352.296875 + }, + "data": { + "type": "HierarchicalCrewComponent", + "node": { + "template": { + "_type": "Component", + "agents": { + "trace_as_metadata": true, + "list": true, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "agents", + "display_name": "Agents", + "advanced": false, + "input_types": [ + "Agent" + ], + "dynamic": false, + "info": "", + "title_case": false, + "type": "other" + }, + "function_calling_llm": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "function_calling_llm", + "display_name": "Function Calling LLM", + "advanced": true, + "input_types": [ + "LanguageModel" + ], + "dynamic": false, + "info": "", + "title_case": false, + "type": "other" + }, + "manager_agent": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "manager_agent", + "display_name": "Manager Agent", + "advanced": false, + "input_types": [ + "Agent" + ], + "dynamic": false, + "info": "", + "title_case": false, + "type": "other" + }, + "manager_llm": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "manager_llm", + "display_name": "Manager LLM", + "advanced": false, + "input_types": [ + "LanguageModel" + ], + "dynamic": false, + "info": "", + "title_case": false, + "type": "other" + }, + "tasks": { + "trace_as_metadata": true, + "list": true, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "tasks", + "display_name": "Tasks", + "advanced": false, + "input_types": [ + "HierarchicalTask" + ], + "dynamic": false, + "info": "", + "title_case": false, + "type": "other" + }, + "code": { + "type": "code", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": true, + "value": "from crewai import Crew, Process # type: ignore\n\nfrom langflow.base.agents.crewai.crew import BaseCrewComponent\nfrom langflow.io import HandleInput\n\n\nclass HierarchicalCrewComponent(BaseCrewComponent):\n display_name: str = \"Hierarchical Crew\"\n description: str = (\n \"Represents a group of agents, defining how they should collaborate and the tasks they should perform.\"\n )\n\n inputs = BaseCrewComponent._base_inputs + [\n HandleInput(name=\"agents\", display_name=\"Agents\", input_types=[\"Agent\"], is_list=True),\n HandleInput(name=\"tasks\", display_name=\"Tasks\", input_types=[\"HierarchicalTask\"], is_list=True),\n HandleInput(name=\"manager_llm\", display_name=\"Manager LLM\", input_types=[\"LanguageModel\"], required=False),\n HandleInput(name=\"manager_agent\", display_name=\"Manager Agent\", input_types=[\"Agent\"], required=False),\n ]\n\n def build_crew(self) -> Crew:\n tasks, agents = self.get_tasks_and_agents()\n crew = Crew(\n agents=agents,\n tasks=tasks,\n process=Process.hierarchical,\n verbose=self.verbose,\n memory=self.memory,\n cache=self.use_cache,\n max_rpm=self.max_rpm,\n share_crew=self.share_crew,\n function_calling_llm=self.function_calling_llm,\n manager_agent=self.manager_agent,\n manager_llm=self.manager_llm,\n step_callback=self.get_step_callback(),\n task_callback=self.get_task_callback(),\n )\n return crew\n", + "fileTypes": [], + "file_path": "", + "password": false, + "name": "code", + "advanced": true, + "dynamic": true, + "info": "", + "load_from_db": false, + "title_case": false + }, + "max_rpm": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": 100, + "name": "max_rpm", + "display_name": "Max RPM", + "advanced": true, + "dynamic": false, + "info": "", + "title_case": false, + "type": "int" + }, + "memory": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": false, + "name": "memory", + "display_name": "Memory", + "advanced": true, + "dynamic": false, + "info": "", + "title_case": false, + "type": "bool" + }, + "share_crew": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": false, + "name": "share_crew", + "display_name": "Share Crew", + "advanced": true, + "dynamic": false, + "info": "", + "title_case": false, + "type": "bool" + }, + "use_cache": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": true, + "name": "use_cache", + "display_name": "Cache", + "advanced": true, + "dynamic": false, + "info": "", + "title_case": false, + "type": "bool" + }, + "verbose": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": 0, + "name": "verbose", + "display_name": "Verbose", + "advanced": true, + "dynamic": false, + "info": "", + "title_case": false, + "type": "int" + } + }, + "description": "Represents a group of agents, defining how they should collaborate and the tasks they should perform.", + "icon": "CrewAI", + "base_classes": [ + "Message" + ], + "display_name": "Hierarchical Crew", + "documentation": "", + "custom_fields": {}, + "output_types": [], + "pinned": false, + "conditional_paths": [], + "frozen": false, + "outputs": [ + { + "types": [ + "Message" + ], + "selected": "Message", + "name": "output", + "display_name": "Output", + "method": "build_output", + "value": "__UNDEFINED__", + "cache": true + } + ], + "field_order": [ + "verbose", + "memory", + "use_cache", + "max_rpm", + "share_crew", + "function_calling_llm", + "agents", + "tasks", + "manager_llm", + "manager_agent" + ], + "beta": false, + "edited": false + }, + "id": "HierarchicalCrewComponent-JNKGT", + "description": "Represents a group of agents, defining how they should collaborate and the tasks they should perform.", + "display_name": "Hierarchical Crew" + }, + "selected": false, + "width": 384, + "height": 459, + "dragging": false + }, + { + "id": "OpenAIModel-xoZ41", + "type": "genericNode", + "position": { + "x": -1222.8457213471152, + "y": 699.9983009041272 + }, + "data": { + "type": "OpenAIModel", + "node": { + "template": { + "_type": "Component", + "code": { + "type": "code", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": true, + "value": "import operator\nfrom functools import reduce\n\nfrom langchain_openai import ChatOpenAI\nfrom pydantic.v1 import SecretStr\n\nfrom langflow.base.constants import STREAM_INFO_TEXT\nfrom langflow.base.models.model import LCModelComponent\nfrom langflow.base.models.openai_constants import MODEL_NAMES\nfrom langflow.field_typing import LanguageModel\nfrom langflow.inputs import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageInput,\n SecretStrInput,\n StrInput,\n)\n\n\nclass OpenAIModelComponent(LCModelComponent):\n display_name = \"OpenAI\"\n description = \"Generates text using OpenAI LLMs.\"\n icon = \"OpenAI\"\n name = \"OpenAIModel\"\n\n inputs = [\n MessageInput(name=\"input_value\", display_name=\"Input\"),\n IntInput(\n name=\"max_tokens\",\n display_name=\"Max Tokens\",\n advanced=True,\n info=\"The maximum number of tokens to generate. Set to 0 for unlimited tokens.\",\n ),\n DictInput(name=\"model_kwargs\", display_name=\"Model Kwargs\", advanced=True),\n BoolInput(\n name=\"json_mode\",\n display_name=\"JSON Mode\",\n advanced=True,\n info=\"If True, it will output JSON regardless of passing a schema.\",\n ),\n DictInput(\n name=\"output_schema\",\n is_list=True,\n display_name=\"Schema\",\n advanced=True,\n info=\"The schema for the Output of the model. You must pass the word JSON in the prompt. If left blank, JSON mode will be disabled.\",\n ),\n DropdownInput(\n name=\"model_name\", display_name=\"Model Name\", advanced=False, options=MODEL_NAMES, value=MODEL_NAMES[0]\n ),\n StrInput(\n name=\"openai_api_base\",\n display_name=\"OpenAI API Base\",\n advanced=True,\n info=\"The base URL of the OpenAI API. Defaults to https://api.openai.com/v1. You can change this to use other APIs like JinaChat, LocalAI and Prem.\",\n ),\n SecretStrInput(\n name=\"openai_api_key\",\n display_name=\"OpenAI API Key\",\n info=\"The OpenAI API Key to use for the OpenAI model.\",\n advanced=False,\n value=\"OPENAI_API_KEY\",\n ),\n FloatInput(name=\"temperature\", display_name=\"Temperature\", value=0.1),\n BoolInput(name=\"stream\", display_name=\"Stream\", info=STREAM_INFO_TEXT, advanced=True),\n StrInput(\n name=\"system_message\",\n display_name=\"System Message\",\n info=\"System message to pass to the model.\",\n advanced=True,\n ),\n IntInput(\n name=\"seed\",\n display_name=\"Seed\",\n info=\"The seed controls the reproducibility of the job.\",\n advanced=True,\n value=1,\n ),\n ]\n\n def build_model(self) -> LanguageModel: # type: ignore[type-var]\n # self.output_schea is a list of dictionarie s\n # let's convert it to a dictionary\n output_schema_dict: dict[str, str] = reduce(operator.ior, self.output_schema or {}, {})\n openai_api_key = self.openai_api_key\n temperature = self.temperature\n model_name: str = self.model_name\n max_tokens = self.max_tokens\n model_kwargs = self.model_kwargs or {}\n openai_api_base = self.openai_api_base or \"https://api.openai.com/v1\"\n json_mode = bool(output_schema_dict) or self.json_mode\n seed = self.seed\n model_kwargs[\"seed\"] = seed\n\n if openai_api_key:\n api_key = SecretStr(openai_api_key)\n else:\n api_key = None\n output = ChatOpenAI(\n max_tokens=max_tokens or None,\n model_kwargs=model_kwargs,\n model=model_name,\n base_url=openai_api_base,\n api_key=api_key,\n temperature=temperature or 0.1,\n )\n if json_mode:\n if output_schema_dict:\n output = output.with_structured_output(schema=output_schema_dict, method=\"json_mode\") # type: ignore\n else:\n output = output.bind(response_format={\"type\": \"json_object\"}) # type: ignore\n\n return output # type: ignore\n\n def _get_exception_message(self, e: Exception):\n \"\"\"\n Get a message from an OpenAI exception.\n\n Args:\n exception (Exception): The exception to get the message from.\n\n Returns:\n str: The message from the exception.\n \"\"\"\n\n try:\n from openai import BadRequestError\n except ImportError:\n return\n if isinstance(e, BadRequestError):\n message = e.body.get(\"message\") # type: ignore\n if message:\n return message\n return\n", + "fileTypes": [], + "file_path": "", + "password": false, + "name": "code", + "advanced": true, + "dynamic": true, + "info": "", + "load_from_db": false, + "title_case": false + }, + "input_value": { + "trace_as_input": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "input_value", + "display_name": "Input", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "", + "title_case": false, + "type": "str" + }, + "json_mode": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": false, + "name": "json_mode", + "display_name": "JSON Mode", + "advanced": true, + "dynamic": false, + "info": "If True, it will output JSON regardless of passing a schema.", + "title_case": false, + "type": "bool" + }, + "max_tokens": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "max_tokens", + "display_name": "Max Tokens", + "advanced": true, + "dynamic": false, + "info": "The maximum number of tokens to generate. Set to 0 for unlimited tokens.", + "title_case": false, + "type": "int" + }, + "model_kwargs": { + "trace_as_input": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": {}, + "name": "model_kwargs", + "display_name": "Model Kwargs", + "advanced": true, + "dynamic": false, + "info": "", + "title_case": false, + "type": "dict" + }, + "model_name": { + "trace_as_metadata": true, + "options": [ + "gpt-4o", + "gpt-4-turbo", + "gpt-4-turbo-preview", + "gpt-4", + "gpt-3.5-turbo", + "gpt-3.5-turbo-0125" + ], + "required": false, + "placeholder": "", + "show": true, + "value": "gpt-3.5-turbo", + "name": "model_name", + "display_name": "Model Name", + "advanced": false, + "dynamic": false, + "info": "", + "title_case": false, + "type": "str" + }, + "openai_api_base": { + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "openai_api_base", + "display_name": "OpenAI API Base", + "advanced": true, + "dynamic": false, + "info": "The base URL of the OpenAI API. Defaults to https://api.openai.com/v1. You can change this to use other APIs like JinaChat, LocalAI and Prem.", + "title_case": false, + "type": "str" + }, + "openai_api_key": { + "load_from_db": true, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "openai_api_key", + "display_name": "OpenAI API Key", + "advanced": false, + "input_types": [], + "dynamic": false, + "info": "The OpenAI API Key to use for the OpenAI model.", + "title_case": false, + "password": true, + "type": "str" + }, + "output_schema": { + "trace_as_input": true, + "list": true, + "required": false, + "placeholder": "", + "show": true, + "value": {}, + "name": "output_schema", + "display_name": "Schema", + "advanced": true, + "dynamic": false, + "info": "The schema for the Output of the model. You must pass the word JSON in the prompt. If left blank, JSON mode will be disabled.", + "title_case": false, + "type": "dict" + }, + "seed": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": 1, + "name": "seed", + "display_name": "Seed", + "advanced": true, + "dynamic": false, + "info": "The seed controls the reproducibility of the job.", + "title_case": false, + "type": "int" + }, + "stream": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": false, + "name": "stream", + "display_name": "Stream", + "advanced": true, + "dynamic": false, + "info": "Stream the response from the model. Streaming works only in Chat.", + "title_case": false, + "type": "bool" + }, + "system_message": { + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "system_message", + "display_name": "System Message", + "advanced": true, + "dynamic": false, + "info": "System message to pass to the model.", + "title_case": false, + "type": "str" + }, + "temperature": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": 0.1, + "name": "temperature", + "display_name": "Temperature", + "advanced": false, + "dynamic": false, + "info": "", + "title_case": false, + "type": "float" + } + }, + "description": "Generates text using OpenAI LLMs.", + "icon": "OpenAI", + "base_classes": [ + "LanguageModel", + "Message" + ], + "display_name": "OpenAI", + "documentation": "", + "custom_fields": {}, + "output_types": [], + "pinned": false, + "conditional_paths": [], + "frozen": false, + "outputs": [ + { + "types": [ + "Message" + ], + "selected": "Message", + "name": "text_output", + "display_name": "Text", + "method": "text_response", + "value": "__UNDEFINED__", + "cache": true + }, + { + "types": [ + "LanguageModel" + ], + "selected": "LanguageModel", + "name": "model_output", + "display_name": "Language Model", + "method": "build_model", + "value": "__UNDEFINED__", + "cache": true + } + ], + "field_order": [ + "input_value", + "max_tokens", + "model_kwargs", + "json_mode", + "output_schema", + "model_name", + "openai_api_base", + "openai_api_key", + "temperature", + "stream", + "system_message", + "seed" + ], + "beta": false, + "edited": false + }, + "id": "OpenAIModel-xoZ41" + }, + "selected": false, + "width": 384, + "height": 623, + "positionAbsolute": { + "x": -1222.8457213471152, + "y": 699.9983009041272 + }, + "dragging": false + }, + { + "id": "ChatOutput-IACYe", + "type": "genericNode", + "position": { + "x": 1070.9148596889393, + "y": 499.80777483894144 + }, + "data": { + "type": "ChatOutput", + "node": { + "template": { + "_type": "Component", + "code": { + "type": "code", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": true, + "value": "from langflow.base.io.chat import ChatComponent\nfrom langflow.inputs import BoolInput\nfrom langflow.io import DropdownInput, MessageTextInput, Output\nfrom langflow.memory import store_message\nfrom langflow.schema.message import Message\n\n\nclass ChatOutput(ChatComponent):\n display_name = \"Chat Output\"\n description = \"Display a chat message in the Playground.\"\n icon = \"ChatOutput\"\n name = \"ChatOutput\"\n\n inputs = [\n MessageTextInput(\n name=\"input_value\",\n display_name=\"Text\",\n info=\"Message to be passed as output.\",\n ),\n BoolInput(\n name=\"should_store_message\",\n display_name=\"Store Messages\",\n info=\"Store the message in the history.\",\n value=True,\n advanced=True,\n ),\n DropdownInput(\n name=\"sender\",\n display_name=\"Sender Type\",\n options=[\"Machine\", \"User\"],\n value=\"Machine\",\n advanced=True,\n info=\"Type of sender.\",\n ),\n MessageTextInput(\n name=\"sender_name\", display_name=\"Sender Name\", info=\"Name of the sender.\", value=\"AI\", advanced=True\n ),\n MessageTextInput(\n name=\"session_id\", display_name=\"Session ID\", info=\"Session ID for the message.\", advanced=True\n ),\n MessageTextInput(\n name=\"data_template\",\n display_name=\"Data Template\",\n value=\"{text}\",\n advanced=True,\n info=\"Template to convert Data to Text. If left empty, it will be dynamically set to the Data's text key.\",\n ),\n ]\n outputs = [\n Output(display_name=\"Message\", name=\"message\", method=\"message_response\"),\n ]\n\n def message_response(self) -> Message:\n message = Message(\n text=self.input_value,\n sender=self.sender,\n sender_name=self.sender_name,\n session_id=self.session_id,\n )\n if (\n self.session_id\n and isinstance(message, Message)\n and isinstance(message.text, str)\n and self.should_store_message\n ):\n store_message(\n message,\n flow_id=self.graph.flow_id,\n )\n self.message.value = message\n\n self.status = message\n return message\n", + "fileTypes": [], + "file_path": "", + "password": false, + "name": "code", + "advanced": true, + "dynamic": true, + "info": "", + "load_from_db": false, + "title_case": false + }, + "data_template": { + "trace_as_input": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "{text}", + "name": "data_template", + "display_name": "Data Template", + "advanced": true, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "Template to convert Data to Text. If left empty, it will be dynamically set to the Data's text key.", + "title_case": false, + "type": "str" + }, + "input_value": { + "trace_as_input": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "input_value", + "display_name": "Text", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "Message to be passed as output.", + "title_case": false, + "type": "str" + }, + "sender": { + "trace_as_metadata": true, + "options": [ + "Machine", + "User" + ], + "required": false, + "placeholder": "", + "show": true, + "value": "Machine", + "name": "sender", + "display_name": "Sender Type", + "advanced": true, + "dynamic": false, + "info": "Type of sender.", + "title_case": false, + "type": "str" + }, + "sender_name": { + "trace_as_input": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "AI", + "name": "sender_name", + "display_name": "Sender Name", + "advanced": true, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "Name of the sender.", + "title_case": false, + "type": "str" + }, + "session_id": { + "trace_as_input": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "session_id", + "display_name": "Session ID", + "advanced": true, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "Session ID for the message.", + "title_case": false, + "type": "str" + }, + "should_store_message": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": true, + "name": "should_store_message", + "display_name": "Store Messages", + "advanced": true, + "dynamic": false, + "info": "Store the message in the history.", + "title_case": false, + "type": "bool" + } + }, + "description": "Display a chat message in the Playground.", + "icon": "ChatOutput", + "base_classes": [ + "Message" + ], + "display_name": "Chat Output", + "documentation": "", + "custom_fields": {}, + "output_types": [], + "pinned": false, + "conditional_paths": [], + "frozen": false, + "outputs": [ + { + "types": [ + "Message" + ], + "selected": "Message", + "name": "message", + "display_name": "Message", + "method": "message_response", + "value": "__UNDEFINED__", + "cache": true + } + ], + "field_order": [ + "input_value", + "should_store_message", + "sender", + "sender_name", + "session_id", + "data_template" + ], + "beta": false, + "edited": false + }, + "id": "ChatOutput-IACYe", + "description": "Display a chat message in the Playground.", + "display_name": "Chat Output" + }, + "selected": false, + "width": 384, + "height": 309, + "positionAbsolute": { + "x": 1070.9148596889393, + "y": 499.80777483894144 + }, + "dragging": false + }, + { + "id": "HierarchicalTaskComponent-vvJXu", + "type": "genericNode", + "position": { + "x": 63.673086094601445, + "y": -375.5883288441139 + }, + "data": { + "type": "HierarchicalTaskComponent", + "node": { + "template": { + "_type": "Component", + "tools": { + "trace_as_metadata": true, + "list": true, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "tools", + "display_name": "Tools", + "advanced": true, + "input_types": [ + "Tool" + ], + "dynamic": false, + "info": "List of tools/resources limited for task execution. Uses the Agent tools by default.", + "title_case": false, + "type": "other" + }, + "code": { + "type": "code", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": true, + "value": "from langflow.base.agents.crewai.tasks import HierarchicalTask\nfrom langflow.custom import Component\nfrom langflow.io import HandleInput, MultilineInput, Output\n\n\nclass HierarchicalTaskComponent(Component):\n display_name: str = \"Hierarchical Task\"\n description: str = \"Each task must have a description, an expected output and an agent responsible for execution.\"\n icon = \"CrewAI\"\n inputs = [\n MultilineInput(\n name=\"task_description\",\n display_name=\"Description\",\n info=\"Descriptive text detailing task's purpose and execution.\",\n ),\n MultilineInput(\n name=\"expected_output\",\n display_name=\"Expected Output\",\n info=\"Clear definition of expected task outcome.\",\n ),\n HandleInput(\n name=\"tools\",\n display_name=\"Tools\",\n input_types=[\"Tool\"],\n is_list=True,\n info=\"List of tools/resources limited for task execution. Uses the Agent tools by default.\",\n required=False,\n advanced=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Task\", name=\"task_output\", method=\"build_task\"),\n ]\n\n def build_task(self) -> HierarchicalTask:\n task = HierarchicalTask(\n description=self.task_description,\n expected_output=self.expected_output,\n tools=self.tools or [],\n )\n self.status = task\n return task\n", + "fileTypes": [], + "file_path": "", + "password": false, + "name": "code", + "advanced": true, + "dynamic": true, + "info": "", + "load_from_db": false, + "title_case": false + }, + "expected_output": { + "trace_as_input": true, + "multiline": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "Succinct response that answers the User's query.", + "name": "expected_output", + "display_name": "Expected Output", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "Clear definition of expected task outcome.", + "title_case": false, + "type": "str" + }, + "task_description": { + "trace_as_input": true, + "multiline": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "task_description", + "display_name": "Description", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "Descriptive text detailing task's purpose and execution.", + "title_case": false, + "type": "str" + } + }, + "description": "Each task must have a description, an expected output and an agent responsible for execution.", + "icon": "CrewAI", + "base_classes": [ + "HierarchicalTask" + ], + "display_name": "Hierarchical Task", + "documentation": "", + "custom_fields": {}, + "output_types": [], + "pinned": false, + "conditional_paths": [], + "frozen": false, + "outputs": [ + { + "types": [ + "HierarchicalTask" + ], + "selected": "HierarchicalTask", + "name": "task_output", + "display_name": "Task", + "method": "build_task", + "value": "__UNDEFINED__", + "cache": true + } + ], + "field_order": [ + "task_description", + "expected_output", + "tools" + ], + "beta": false, + "edited": false + }, + "id": "HierarchicalTaskComponent-vvJXu", + "description": "Each task must have a description, an expected output and an agent responsible for execution.", + "display_name": "Hierarchical Task" + }, + "selected": false, + "width": 384, + "height": 455, + "positionAbsolute": { + "x": 63.673086094601445, + "y": -375.5883288441139 + }, + "dragging": false + }, + { + "id": "CrewAIAgentComponent-XU5MB", + "type": "genericNode", + "position": { + "x": -479.3544836211363, + "y": 184.85118314299666 + }, + "data": { + "type": "CrewAIAgentComponent", + "node": { + "template": { + "_type": "Component", + "llm": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "llm", + "display_name": "Language Model", + "advanced": false, + "input_types": [ + "LanguageModel" + ], + "dynamic": false, + "info": "Language model that will run the agent.", + "title_case": false, + "type": "other" + }, + "tools": { + "trace_as_metadata": true, + "list": true, + "required": false, + "placeholder": "", + "show": true, + "value": [], + "name": "tools", + "display_name": "Tools", + "advanced": false, + "input_types": [ + "Tool" + ], + "dynamic": false, + "info": "Tools at agents disposal", + "title_case": false, + "type": "other" + }, + "allow_code_execution": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": false, + "name": "allow_code_execution", + "display_name": "Allow Code Execution", + "advanced": true, + "dynamic": false, + "info": "Whether the agent is allowed to execute code.", + "title_case": false, + "type": "bool" + }, + "allow_delegation": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": true, + "name": "allow_delegation", + "display_name": "Allow Delegation", + "advanced": false, + "dynamic": false, + "info": "Whether the agent is allowed to delegate tasks to other agents.", + "title_case": false, + "type": "bool" + }, + "backstory": { + "trace_as_input": true, + "multiline": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "You are a reliable researcher and journalist ", + "name": "backstory", + "display_name": "Backstory", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "The backstory of the agent.", + "title_case": false, + "type": "str" + }, + "code": { + "type": "code", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": true, + "value": "from crewai import Agent # type: ignore\n\nfrom langflow.custom import Component\nfrom langflow.io import BoolInput, DictInput, HandleInput, MultilineInput, Output\n\n\nclass CrewAIAgentComponent(Component):\n display_name = \"CrewAI Agent\"\n description = \"Represents an agent of CrewAI.\"\n documentation: str = \"https://docs.crewai.com/how-to/LLM-Connections/\"\n icon = \"CrewAI\"\n\n inputs = [\n MultilineInput(name=\"role\", display_name=\"Role\", info=\"The role of the agent.\"),\n MultilineInput(name=\"goal\", display_name=\"Goal\", info=\"The objective of the agent.\"),\n MultilineInput(name=\"backstory\", display_name=\"Backstory\", info=\"The backstory of the agent.\"),\n HandleInput(\n name=\"tools\",\n display_name=\"Tools\",\n input_types=[\"Tool\"],\n is_list=True,\n info=\"Tools at agents disposal\",\n value=[],\n ),\n HandleInput(\n name=\"llm\",\n display_name=\"Language Model\",\n info=\"Language model that will run the agent.\",\n input_types=[\"LanguageModel\"],\n ),\n BoolInput(\n name=\"memory\",\n display_name=\"Memory\",\n info=\"Whether the agent should have memory or not\",\n advanced=True,\n value=True,\n ),\n BoolInput(\n name=\"verbose\",\n display_name=\"Verbose\",\n advanced=True,\n value=False,\n ),\n BoolInput(\n name=\"allow_delegation\",\n display_name=\"Allow Delegation\",\n info=\"Whether the agent is allowed to delegate tasks to other agents.\",\n value=True,\n ),\n BoolInput(\n name=\"allow_code_execution\",\n display_name=\"Allow Code Execution\",\n info=\"Whether the agent is allowed to execute code.\",\n value=False,\n advanced=True,\n ),\n DictInput(\n name=\"kwargs\",\n display_name=\"kwargs\",\n info=\"kwargs of agent.\",\n is_list=True,\n advanced=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Agent\", name=\"output\", method=\"build_output\"),\n ]\n\n def build_output(self) -> Agent:\n kwargs = self.kwargs if self.kwargs else {}\n agent = Agent(\n role=self.role,\n goal=self.goal,\n backstory=self.backstory,\n llm=self.llm,\n verbose=self.verbose,\n memory=self.memory,\n tools=self.tools if self.tools else [],\n allow_delegation=self.allow_delegation,\n allow_code_execution=self.allow_code_execution,\n **kwargs,\n )\n self.status = repr(agent)\n return agent\n", + "fileTypes": [], + "file_path": "", + "password": false, + "name": "code", + "advanced": true, + "dynamic": true, + "info": "", + "load_from_db": false, + "title_case": false + }, + "goal": { + "trace_as_input": true, + "multiline": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "Search for information about the User's query and answer as best as you can", + "name": "goal", + "display_name": "Goal", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "The objective of the agent.", + "title_case": false, + "type": "str" + }, + "kwargs": { + "trace_as_input": true, + "list": true, + "required": false, + "placeholder": "", + "show": true, + "value": {}, + "name": "kwargs", + "display_name": "kwargs", + "advanced": true, + "dynamic": false, + "info": "kwargs of agent.", + "title_case": false, + "type": "dict" + }, + "memory": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": true, + "name": "memory", + "display_name": "Memory", + "advanced": true, + "dynamic": false, + "info": "Whether the agent should have memory or not", + "title_case": false, + "type": "bool" + }, + "role": { + "trace_as_input": true, + "multiline": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "Research", + "name": "role", + "display_name": "Role", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "The role of the agent.", + "title_case": false, + "type": "str" + }, + "verbose": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": false, + "name": "verbose", + "display_name": "Verbose", + "advanced": true, + "dynamic": false, + "info": "", + "title_case": false, + "type": "bool" + } + }, + "description": "Represents an agent of CrewAI.", + "icon": "CrewAI", + "base_classes": [ + "Agent" + ], + "display_name": "CrewAI Agent", + "documentation": "https://docs.crewai.com/how-to/LLM-Connections/", + "custom_fields": {}, + "output_types": [], + "pinned": false, + "conditional_paths": [], + "frozen": false, + "outputs": [ + { + "types": [ + "Agent" + ], + "selected": "Agent", + "name": "output", + "display_name": "Agent", + "method": "build_output", + "value": "__UNDEFINED__", + "cache": true + } + ], + "field_order": [ + "role", + "goal", + "backstory", + "tools", + "llm", + "memory", + "verbose", + "allow_delegation", + "allow_code_execution", + "kwargs" + ], + "beta": false, + "edited": false + }, + "id": "CrewAIAgentComponent-XU5MB", + "description": "Represents an agent of CrewAI.", + "display_name": "CrewAI Agent" + }, + "selected": false, + "width": 384, + "height": 665, + "positionAbsolute": { + "x": -479.3544836211363, + "y": 184.85118314299666 + }, + "dragging": false + }, + { + "id": "CrewAIAgentComponent-Trkfd", + "type": "genericNode", + "position": { + "x": -451.69853654304495, + "y": 1664.003205846104 + }, + "data": { + "type": "CrewAIAgentComponent", + "node": { + "template": { + "_type": "Component", + "llm": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "llm", + "display_name": "Language Model", + "advanced": false, + "input_types": [ + "LanguageModel" + ], + "dynamic": false, + "info": "Language model that will run the agent.", + "title_case": false, + "type": "other" + }, + "tools": { + "trace_as_metadata": true, + "list": true, + "required": false, + "placeholder": "", + "show": true, + "value": [], + "name": "tools", + "display_name": "Tools", + "advanced": false, + "input_types": [ + "Tool" + ], + "dynamic": false, + "info": "Tools at agents disposal", + "title_case": false, + "type": "other" + }, + "allow_code_execution": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": false, + "name": "allow_code_execution", + "display_name": "Allow Code Execution", + "advanced": true, + "dynamic": false, + "info": "Whether the agent is allowed to execute code.", + "title_case": false, + "type": "bool" + }, + "allow_delegation": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": true, + "name": "allow_delegation", + "display_name": "Allow Delegation", + "advanced": false, + "dynamic": false, + "info": "Whether the agent is allowed to delegate tasks to other agents.", + "title_case": false, + "type": "bool" + }, + "backstory": { + "trace_as_input": true, + "multiline": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "You are polite and helpful. You've always been a beacon of politeness.", + "name": "backstory", + "display_name": "Backstory", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "The backstory of the agent.", + "title_case": false, + "type": "str" + }, + "code": { + "type": "code", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": true, + "value": "from crewai import Agent # type: ignore\n\nfrom langflow.custom import Component\nfrom langflow.io import BoolInput, DictInput, HandleInput, MultilineInput, Output\n\n\nclass CrewAIAgentComponent(Component):\n display_name = \"CrewAI Agent\"\n description = \"Represents an agent of CrewAI.\"\n documentation: str = \"https://docs.crewai.com/how-to/LLM-Connections/\"\n icon = \"CrewAI\"\n\n inputs = [\n MultilineInput(name=\"role\", display_name=\"Role\", info=\"The role of the agent.\"),\n MultilineInput(name=\"goal\", display_name=\"Goal\", info=\"The objective of the agent.\"),\n MultilineInput(name=\"backstory\", display_name=\"Backstory\", info=\"The backstory of the agent.\"),\n HandleInput(\n name=\"tools\",\n display_name=\"Tools\",\n input_types=[\"Tool\"],\n is_list=True,\n info=\"Tools at agents disposal\",\n value=[],\n ),\n HandleInput(\n name=\"llm\",\n display_name=\"Language Model\",\n info=\"Language model that will run the agent.\",\n input_types=[\"LanguageModel\"],\n ),\n BoolInput(\n name=\"memory\",\n display_name=\"Memory\",\n info=\"Whether the agent should have memory or not\",\n advanced=True,\n value=True,\n ),\n BoolInput(\n name=\"verbose\",\n display_name=\"Verbose\",\n advanced=True,\n value=False,\n ),\n BoolInput(\n name=\"allow_delegation\",\n display_name=\"Allow Delegation\",\n info=\"Whether the agent is allowed to delegate tasks to other agents.\",\n value=True,\n ),\n BoolInput(\n name=\"allow_code_execution\",\n display_name=\"Allow Code Execution\",\n info=\"Whether the agent is allowed to execute code.\",\n value=False,\n advanced=True,\n ),\n DictInput(\n name=\"kwargs\",\n display_name=\"kwargs\",\n info=\"kwargs of agent.\",\n is_list=True,\n advanced=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Agent\", name=\"output\", method=\"build_output\"),\n ]\n\n def build_output(self) -> Agent:\n kwargs = self.kwargs if self.kwargs else {}\n agent = Agent(\n role=self.role,\n goal=self.goal,\n backstory=self.backstory,\n llm=self.llm,\n verbose=self.verbose,\n memory=self.memory,\n tools=self.tools if self.tools else [],\n allow_delegation=self.allow_delegation,\n allow_code_execution=self.allow_code_execution,\n **kwargs,\n )\n self.status = repr(agent)\n return agent\n", + "fileTypes": [], + "file_path": "", + "password": false, + "name": "code", + "advanced": true, + "dynamic": true, + "info": "", + "load_from_db": false, + "title_case": false + }, + "goal": { + "trace_as_input": true, + "multiline": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "You can answer general questions from the User and may call others for help if needed.", + "name": "goal", + "display_name": "Goal", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "The objective of the agent.", + "title_case": false, + "type": "str" + }, + "kwargs": { + "trace_as_input": true, + "list": true, + "required": false, + "placeholder": "", + "show": true, + "value": {}, + "name": "kwargs", + "display_name": "kwargs", + "advanced": true, + "dynamic": false, + "info": "kwargs of agent.", + "title_case": false, + "type": "dict" + }, + "memory": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": true, + "name": "memory", + "display_name": "Memory", + "advanced": true, + "dynamic": false, + "info": "Whether the agent should have memory or not", + "title_case": false, + "type": "bool" + }, + "role": { + "trace_as_input": true, + "multiline": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "Manager", + "name": "role", + "display_name": "Role", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "The role of the agent.", + "title_case": false, + "type": "str" + }, + "verbose": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": false, + "name": "verbose", + "display_name": "Verbose", + "advanced": true, + "dynamic": false, + "info": "", + "title_case": false, + "type": "bool" + } + }, + "description": "Represents an agent of CrewAI.", + "icon": "CrewAI", + "base_classes": [ + "Agent" + ], + "display_name": "CrewAI Agent", + "documentation": "https://docs.crewai.com/how-to/LLM-Connections/", + "custom_fields": {}, + "output_types": [], + "pinned": false, + "conditional_paths": [], + "frozen": false, + "outputs": [ + { + "types": [ + "Agent" + ], + "selected": "Agent", + "name": "output", + "display_name": "Agent", + "method": "build_output", + "value": "__UNDEFINED__", + "cache": true + } + ], + "field_order": [ + "role", + "goal", + "backstory", + "tools", + "llm", + "memory", + "verbose", + "allow_delegation", + "allow_code_execution", + "kwargs" + ], + "beta": false, + "edited": false + }, + "id": "CrewAIAgentComponent-Trkfd", + "description": "Represents an agent of CrewAI.", + "display_name": "CrewAI Agent" + }, + "selected": false, + "width": 384, + "height": 665, + "positionAbsolute": { + "x": -451.69853654304495, + "y": 1664.003205846104 + }, + "dragging": false + }, + { + "id": "OpenAIModel-0cqIu", + "type": "genericNode", + "position": { + "x": -1157.0105401589535, + "y": 1699.4665001507685 + }, + "data": { + "type": "OpenAIModel", + "node": { + "template": { + "_type": "Component", + "code": { + "type": "code", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": true, + "value": "import operator\nfrom functools import reduce\n\nfrom langchain_openai import ChatOpenAI\nfrom pydantic.v1 import SecretStr\n\nfrom langflow.base.constants import STREAM_INFO_TEXT\nfrom langflow.base.models.model import LCModelComponent\nfrom langflow.base.models.openai_constants import MODEL_NAMES\nfrom langflow.field_typing import LanguageModel\nfrom langflow.inputs import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageInput,\n SecretStrInput,\n StrInput,\n)\n\n\nclass OpenAIModelComponent(LCModelComponent):\n display_name = \"OpenAI\"\n description = \"Generates text using OpenAI LLMs.\"\n icon = \"OpenAI\"\n name = \"OpenAIModel\"\n\n inputs = [\n MessageInput(name=\"input_value\", display_name=\"Input\"),\n IntInput(\n name=\"max_tokens\",\n display_name=\"Max Tokens\",\n advanced=True,\n info=\"The maximum number of tokens to generate. Set to 0 for unlimited tokens.\",\n ),\n DictInput(name=\"model_kwargs\", display_name=\"Model Kwargs\", advanced=True),\n BoolInput(\n name=\"json_mode\",\n display_name=\"JSON Mode\",\n advanced=True,\n info=\"If True, it will output JSON regardless of passing a schema.\",\n ),\n DictInput(\n name=\"output_schema\",\n is_list=True,\n display_name=\"Schema\",\n advanced=True,\n info=\"The schema for the Output of the model. You must pass the word JSON in the prompt. If left blank, JSON mode will be disabled.\",\n ),\n DropdownInput(\n name=\"model_name\", display_name=\"Model Name\", advanced=False, options=MODEL_NAMES, value=MODEL_NAMES[0]\n ),\n StrInput(\n name=\"openai_api_base\",\n display_name=\"OpenAI API Base\",\n advanced=True,\n info=\"The base URL of the OpenAI API. Defaults to https://api.openai.com/v1. You can change this to use other APIs like JinaChat, LocalAI and Prem.\",\n ),\n SecretStrInput(\n name=\"openai_api_key\",\n display_name=\"OpenAI API Key\",\n info=\"The OpenAI API Key to use for the OpenAI model.\",\n advanced=False,\n value=\"OPENAI_API_KEY\",\n ),\n FloatInput(name=\"temperature\", display_name=\"Temperature\", value=0.1),\n BoolInput(name=\"stream\", display_name=\"Stream\", info=STREAM_INFO_TEXT, advanced=True),\n StrInput(\n name=\"system_message\",\n display_name=\"System Message\",\n info=\"System message to pass to the model.\",\n advanced=True,\n ),\n IntInput(\n name=\"seed\",\n display_name=\"Seed\",\n info=\"The seed controls the reproducibility of the job.\",\n advanced=True,\n value=1,\n ),\n ]\n\n def build_model(self) -> LanguageModel: # type: ignore[type-var]\n # self.output_schea is a list of dictionarie s\n # let's convert it to a dictionary\n output_schema_dict: dict[str, str] = reduce(operator.ior, self.output_schema or {}, {})\n openai_api_key = self.openai_api_key\n temperature = self.temperature\n model_name: str = self.model_name\n max_tokens = self.max_tokens\n model_kwargs = self.model_kwargs or {}\n openai_api_base = self.openai_api_base or \"https://api.openai.com/v1\"\n json_mode = bool(output_schema_dict) or self.json_mode\n seed = self.seed\n model_kwargs[\"seed\"] = seed\n\n if openai_api_key:\n api_key = SecretStr(openai_api_key)\n else:\n api_key = None\n output = ChatOpenAI(\n max_tokens=max_tokens or None,\n model_kwargs=model_kwargs,\n model=model_name,\n base_url=openai_api_base,\n api_key=api_key,\n temperature=temperature or 0.1,\n )\n if json_mode:\n if output_schema_dict:\n output = output.with_structured_output(schema=output_schema_dict, method=\"json_mode\") # type: ignore\n else:\n output = output.bind(response_format={\"type\": \"json_object\"}) # type: ignore\n\n return output # type: ignore\n\n def _get_exception_message(self, e: Exception):\n \"\"\"\n Get a message from an OpenAI exception.\n\n Args:\n exception (Exception): The exception to get the message from.\n\n Returns:\n str: The message from the exception.\n \"\"\"\n\n try:\n from openai import BadRequestError\n except ImportError:\n return\n if isinstance(e, BadRequestError):\n message = e.body.get(\"message\") # type: ignore\n if message:\n return message\n return\n", + "fileTypes": [], + "file_path": "", + "password": false, + "name": "code", + "advanced": true, + "dynamic": true, + "info": "", + "load_from_db": false, + "title_case": false + }, + "input_value": { + "trace_as_input": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "input_value", + "display_name": "Input", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "", + "title_case": false, + "type": "str" + }, + "json_mode": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": false, + "name": "json_mode", + "display_name": "JSON Mode", + "advanced": true, + "dynamic": false, + "info": "If True, it will output JSON regardless of passing a schema.", + "title_case": false, + "type": "bool" + }, + "max_tokens": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "max_tokens", + "display_name": "Max Tokens", + "advanced": true, + "dynamic": false, + "info": "The maximum number of tokens to generate. Set to 0 for unlimited tokens.", + "title_case": false, + "type": "int" + }, + "model_kwargs": { + "trace_as_input": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": {}, + "name": "model_kwargs", + "display_name": "Model Kwargs", + "advanced": true, + "dynamic": false, + "info": "", + "title_case": false, + "type": "dict" + }, + "model_name": { + "trace_as_metadata": true, + "options": [ + "gpt-4o", + "gpt-4-turbo", + "gpt-4-turbo-preview", + "gpt-4", + "gpt-3.5-turbo", + "gpt-3.5-turbo-0125" + ], + "required": false, + "placeholder": "", + "show": true, + "value": "gpt-4o", + "name": "model_name", + "display_name": "Model Name", + "advanced": false, + "dynamic": false, + "info": "", + "title_case": false, + "type": "str" + }, + "openai_api_base": { + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "openai_api_base", + "display_name": "OpenAI API Base", + "advanced": true, + "dynamic": false, + "info": "The base URL of the OpenAI API. Defaults to https://api.openai.com/v1. You can change this to use other APIs like JinaChat, LocalAI and Prem.", + "title_case": false, + "type": "str" + }, + "openai_api_key": { + "load_from_db": true, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "openai_api_key", + "display_name": "OpenAI API Key", + "advanced": false, + "input_types": [], + "dynamic": false, + "info": "The OpenAI API Key to use for the OpenAI model.", + "title_case": false, + "password": true, + "type": "str" + }, + "output_schema": { + "trace_as_input": true, + "list": true, + "required": false, + "placeholder": "", + "show": true, + "value": {}, + "name": "output_schema", + "display_name": "Schema", + "advanced": true, + "dynamic": false, + "info": "The schema for the Output of the model. You must pass the word JSON in the prompt. If left blank, JSON mode will be disabled.", + "title_case": false, + "type": "dict" + }, + "seed": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": 1, + "name": "seed", + "display_name": "Seed", + "advanced": true, + "dynamic": false, + "info": "The seed controls the reproducibility of the job.", + "title_case": false, + "type": "int" + }, + "stream": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": false, + "name": "stream", + "display_name": "Stream", + "advanced": true, + "dynamic": false, + "info": "Stream the response from the model. Streaming works only in Chat.", + "title_case": false, + "type": "bool" + }, + "system_message": { + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "system_message", + "display_name": "System Message", + "advanced": true, + "dynamic": false, + "info": "System message to pass to the model.", + "title_case": false, + "type": "str" + }, + "temperature": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": 0.1, + "name": "temperature", + "display_name": "Temperature", + "advanced": false, + "dynamic": false, + "info": "", + "title_case": false, + "type": "float" + } + }, + "description": "Generates text using OpenAI LLMs.", + "icon": "OpenAI", + "base_classes": [ + "LanguageModel", + "Message" + ], + "display_name": "OpenAI", + "documentation": "", + "custom_fields": {}, + "output_types": [], + "pinned": false, + "conditional_paths": [], + "frozen": false, + "outputs": [ + { + "types": [ + "Message" + ], + "selected": "Message", + "name": "text_output", + "display_name": "Text", + "method": "text_response", + "value": "__UNDEFINED__", + "cache": true + }, + { + "types": [ + "LanguageModel" + ], + "selected": "LanguageModel", + "name": "model_output", + "display_name": "Language Model", + "method": "build_model", + "value": "__UNDEFINED__", + "cache": true + } + ], + "field_order": [ + "input_value", + "max_tokens", + "model_kwargs", + "json_mode", + "output_schema", + "model_name", + "openai_api_base", + "openai_api_key", + "temperature", + "stream", + "system_message", + "seed" + ], + "beta": false, + "edited": false + }, + "id": "OpenAIModel-0cqIu" + }, + "selected": false, + "width": 384, + "height": 623, + "positionAbsolute": { + "x": -1157.0105401589535, + "y": 1699.4665001507685 + }, + "dragging": false + }, + { + "id": "Prompt-5o2wP", + "type": "genericNode", + "position": { + "x": -561.9017558579421, + "y": -433.5913161630874 + }, + "data": { + "type": "Prompt", + "node": { + "template": { + "_type": "Component", + "code": { + "type": "code", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": true, + "value": "from langflow.base.prompts.api_utils import process_prompt_template\nfrom langflow.custom import Component\nfrom langflow.io import Output, PromptInput\nfrom langflow.schema.message import Message\nfrom langflow.template.utils import update_template_values\n\n\nclass PromptComponent(Component):\n display_name: str = \"Prompt\"\n description: str = \"Create a prompt template with dynamic variables.\"\n icon = \"prompts\"\n trace_type = \"prompt\"\n name = \"Prompt\"\n\n inputs = [\n PromptInput(name=\"template\", display_name=\"Template\"),\n ]\n\n outputs = [\n Output(display_name=\"Prompt Message\", name=\"prompt\", method=\"build_prompt\"),\n ]\n\n async def build_prompt(\n self,\n ) -> Message:\n prompt = await Message.from_template_and_variables(**self._attributes)\n self.status = prompt.text\n return prompt\n\n def post_code_processing(self, new_frontend_node: dict, current_frontend_node: dict):\n \"\"\"\n This function is called after the code validation is done.\n \"\"\"\n frontend_node = super().post_code_processing(new_frontend_node, current_frontend_node)\n template = frontend_node[\"template\"][\"template\"][\"value\"]\n _ = process_prompt_template(\n template=template,\n name=\"template\",\n custom_fields=frontend_node[\"custom_fields\"],\n frontend_node_template=frontend_node[\"template\"],\n )\n # Now that template is updated, we need to grab any values that were set in the current_frontend_node\n # and update the frontend_node with those values\n update_template_values(new_template=frontend_node, previous_template=current_frontend_node[\"template\"])\n return frontend_node\n", + "fileTypes": [], + "file_path": "", + "password": false, + "name": "code", + "advanced": true, + "dynamic": true, + "info": "", + "load_from_db": false, + "title_case": false + }, + "template": { + "trace_as_input": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "User's query:\n{query}\n\nRespond to the user with as much as information as you can about the topic. Delete if needed. If it is just a general query (e.g a greeting) you can respond them directly.", + "name": "template", + "display_name": "Template", + "advanced": false, + "dynamic": false, + "info": "", + "title_case": false, + "type": "prompt" + }, + "query": { + "field_type": "str", + "required": false, + "placeholder": "", + "list": false, + "show": true, + "multiline": true, + "value": "", + "fileTypes": [], + "file_path": "", + "password": false, + "name": "query", + "display_name": "query", + "advanced": false, + "input_types": [ + "Message", + "Text" + ], + "dynamic": false, + "info": "", + "load_from_db": false, + "title_case": false, + "type": "str" + } + }, + "description": "Create a prompt template with dynamic variables.", + "icon": "prompts", + "is_input": null, + "is_output": null, + "is_composition": null, + "base_classes": [ + "Message" + ], + "name": "", + "display_name": "Prompt", + "documentation": "", + "custom_fields": { + "template": [ + "query" + ] + }, + "output_types": [], + "full_path": null, + "pinned": false, + "conditional_paths": [], + "frozen": false, + "outputs": [ + { + "types": [ + "Message" + ], + "selected": "Message", + "name": "prompt", + "hidden": null, + "display_name": "Prompt Message", + "method": "build_prompt", + "value": "__UNDEFINED__", + "cache": true + } + ], + "field_order": [ + "template" + ], + "beta": false, + "error": null, + "edited": false + }, + "id": "Prompt-5o2wP", + "description": "Create a prompt template with dynamic variables.", + "display_name": "Prompt" + }, + "selected": false, + "width": 384, + "height": 423, + "positionAbsolute": { + "x": -561.9017558579421, + "y": -433.5913161630874 + }, + "dragging": false + }, + { + "id": "ChatInput-kHOLm", + "type": "genericNode", + "position": { + "x": -1142.1418710409707, + "y": -372.98153583376074 + }, + "data": { + "type": "ChatInput", + "node": { + "template": { + "_type": "Component", + "files": { + "trace_as_metadata": true, + "file_path": "", + "fileTypes": [ + "txt", + "md", + "mdx", + "csv", + "json", + "yaml", + "yml", + "xml", + "html", + "htm", + "pdf", + "docx", + "py", + "sh", + "sql", + "js", + "ts", + "tsx", + "jpg", + "jpeg", + "png", + "bmp", + "image" + ], + "list": true, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "files", + "display_name": "Files", + "advanced": true, + "dynamic": false, + "info": "Files to be sent with the message.", + "title_case": false, + "type": "file" + }, + "code": { + "type": "code", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": true, + "value": "from langflow.base.data.utils import IMG_FILE_TYPES, TEXT_FILE_TYPES\nfrom langflow.base.io.chat import ChatComponent\nfrom langflow.inputs import BoolInput\nfrom langflow.io import DropdownInput, FileInput, MessageTextInput, MultilineInput, Output\nfrom langflow.memory import store_message\nfrom langflow.schema.message import Message\n\n\nclass ChatInput(ChatComponent):\n display_name = \"Chat Input\"\n description = \"Get chat inputs from the Playground.\"\n icon = \"ChatInput\"\n name = \"ChatInput\"\n\n inputs = [\n MultilineInput(\n name=\"input_value\",\n display_name=\"Text\",\n value=\"\",\n info=\"Message to be passed as input.\",\n ),\n BoolInput(\n name=\"should_store_message\",\n display_name=\"Store Messages\",\n info=\"Store the message in the history.\",\n value=True,\n advanced=True,\n ),\n DropdownInput(\n name=\"sender\",\n display_name=\"Sender Type\",\n options=[\"Machine\", \"User\"],\n value=\"User\",\n info=\"Type of sender.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"sender_name\",\n display_name=\"Sender Name\",\n info=\"Name of the sender.\",\n value=\"User\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"session_id\", display_name=\"Session ID\", info=\"Session ID for the message.\", advanced=True\n ),\n FileInput(\n name=\"files\",\n display_name=\"Files\",\n file_types=TEXT_FILE_TYPES + IMG_FILE_TYPES,\n info=\"Files to be sent with the message.\",\n advanced=True,\n is_list=True,\n ),\n ]\n outputs = [\n Output(display_name=\"Message\", name=\"message\", method=\"message_response\"),\n ]\n\n def message_response(self) -> Message:\n message = Message(\n text=self.input_value,\n sender=self.sender,\n sender_name=self.sender_name,\n session_id=self.session_id,\n files=self.files,\n )\n\n if (\n self.session_id\n and isinstance(message, Message)\n and isinstance(message.text, str)\n and self.should_store_message\n ):\n store_message(\n message,\n flow_id=self.graph.flow_id,\n )\n self.message.value = message\n\n self.status = message\n return message\n", + "fileTypes": [], + "file_path": "", + "password": false, + "name": "code", + "advanced": true, + "dynamic": true, + "info": "", + "load_from_db": false, + "title_case": false + }, + "input_value": { + "trace_as_input": true, + "multiline": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "What is Langflow?", + "name": "input_value", + "display_name": "Text", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "Message to be passed as input.", + "title_case": false, + "type": "str" + }, + "sender": { + "trace_as_metadata": true, + "options": [ + "Machine", + "User" + ], + "required": false, + "placeholder": "", + "show": true, + "value": "User", + "name": "sender", + "display_name": "Sender Type", + "advanced": true, + "dynamic": false, + "info": "Type of sender.", + "title_case": false, + "type": "str" + }, + "sender_name": { + "trace_as_input": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "User", + "name": "sender_name", + "display_name": "Sender Name", + "advanced": true, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "Name of the sender.", + "title_case": false, + "type": "str" + }, + "session_id": { + "trace_as_input": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "session_id", + "display_name": "Session ID", + "advanced": true, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "Session ID for the message.", + "title_case": false, + "type": "str" + }, + "should_store_message": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": true, + "name": "should_store_message", + "display_name": "Store Messages", + "advanced": true, + "dynamic": false, + "info": "Store the message in the history.", + "title_case": false, + "type": "bool" + } + }, + "description": "Get chat inputs from the Playground.", + "icon": "ChatInput", + "base_classes": [ + "Message" + ], + "display_name": "Chat Input", + "documentation": "", + "custom_fields": {}, + "output_types": [], + "pinned": false, + "conditional_paths": [], + "frozen": false, + "outputs": [ + { + "types": [ + "Message" + ], + "selected": "Message", + "name": "message", + "display_name": "Message", + "method": "message_response", + "value": "__UNDEFINED__", + "cache": true + } + ], + "field_order": [ + "input_value", + "should_store_message", + "sender", + "sender_name", + "session_id", + "files" + ], + "beta": false, + "edited": false + }, + "id": "ChatInput-kHOLm" + }, + "selected": false, + "width": 384, + "height": 309, + "positionAbsolute": { + "x": -1142.1418710409707, + "y": -372.98153583376074 + }, + "dragging": false + }, + { + "id": "SearchAPITool-fmETj", + "type": "genericNode", + "position": { + "x": -1200.258747181863, + "y": 206.70950310719434 + }, + "data": { + "type": "SearchAPITool", + "node": { + "template": { + "_type": "CustomComponent", + "api_key": { + "type": "str", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": false, + "fileTypes": [], + "file_path": "", + "password": true, + "name": "api_key", + "display_name": "API Key", + "advanced": false, + "dynamic": false, + "info": "The API key to use SearchApi.", + "load_from_db": false, + "title_case": false, + "input_types": [ + "Text" + ], + "value": "" + }, + "code": { + "type": "code", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": true, + "value": "from langchain_community.tools.searchapi import SearchAPIRun\nfrom langchain_community.utilities.searchapi import SearchApiAPIWrapper\n\nfrom langflow.custom import CustomComponent\nfrom langflow.field_typing import Tool\n\n\nclass SearchApiToolComponent(CustomComponent):\n display_name: str = \"SearchApi Tool\"\n description: str = \"Real-time search engine results API.\"\n name = \"SearchAPITool\"\n documentation: str = \"https://www.searchapi.io/docs/google\"\n field_config = {\n \"engine\": {\n \"display_name\": \"Engine\",\n \"field_type\": \"str\",\n \"info\": \"The search engine to use.\",\n },\n \"api_key\": {\n \"display_name\": \"API Key\",\n \"field_type\": \"str\",\n \"required\": True,\n \"password\": True,\n \"info\": \"The API key to use SearchApi.\",\n },\n }\n\n def build(\n self,\n engine: str,\n api_key: str,\n ) -> Tool:\n search_api_wrapper = SearchApiAPIWrapper(engine=engine, searchapi_api_key=api_key)\n\n tool = SearchAPIRun(api_wrapper=search_api_wrapper)\n\n self.status = tool\n return tool # type: ignore\n", + "fileTypes": [], + "file_path": "", + "password": false, + "name": "code", + "advanced": true, + "dynamic": true, + "info": "", + "load_from_db": false, + "title_case": false + }, + "engine": { + "type": "str", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": false, + "fileTypes": [], + "file_path": "", + "password": false, + "name": "engine", + "display_name": "Engine", + "advanced": false, + "dynamic": false, + "info": "The search engine to use.", + "load_from_db": false, + "title_case": false, + "input_types": [ + "Text" + ], + "value": "google" + } + }, + "description": "Real-time search engine results API.", + "base_classes": [ + "BaseTool", + "Generic", + "object", + "Runnable", + "RunnableSerializable", + "Serializable", + "Tool" + ], + "display_name": "SearchApi Tool", + "documentation": "https://www.searchapi.io/docs/google", + "custom_fields": { + "engine": null, + "api_key": null + }, + "output_types": [ + "Tool" + ], + "pinned": false, + "conditional_paths": [], + "frozen": false, + "outputs": [ + { + "types": [ + "Tool" + ], + "selected": "Tool", + "name": "tool", + "hidden": null, + "display_name": "Tool", + "method": null, + "value": "__UNDEFINED__", + "cache": true + } + ], + "field_order": [ + "engine", + "api_key" + ], + "beta": false, + "edited": false + }, + "id": "SearchAPITool-fmETj" + }, + "selected": false, + "width": 384, + "height": 403, + "positionAbsolute": { + "x": -1200.258747181863, + "y": 206.70950310719434 + }, + "dragging": false + }, + { + "id": "CrewAIAgentComponent-V2kfR", + "type": "genericNode", + "position": { + "x": -397.2627184897183, + "y": 892.6280687419107 + }, + "data": { + "type": "CrewAIAgentComponent", + "node": { + "template": { + "_type": "Component", + "llm": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "", + "name": "llm", + "display_name": "Language Model", + "advanced": false, + "input_types": [ + "LanguageModel" + ], + "dynamic": false, + "info": "Language model that will run the agent.", + "title_case": false, + "type": "other" + }, + "tools": { + "trace_as_metadata": true, + "list": true, + "required": false, + "placeholder": "", + "show": true, + "value": [], + "name": "tools", + "display_name": "Tools", + "advanced": false, + "input_types": [ + "Tool" + ], + "dynamic": false, + "info": "Tools at agents disposal", + "title_case": false, + "type": "other" + }, + "allow_code_execution": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": false, + "name": "allow_code_execution", + "display_name": "Allow Code Execution", + "advanced": true, + "dynamic": false, + "info": "Whether the agent is allowed to execute code.", + "title_case": false, + "type": "bool" + }, + "allow_delegation": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": true, + "name": "allow_delegation", + "display_name": "Allow Delegation", + "advanced": false, + "dynamic": false, + "info": "Whether the agent is allowed to delegate tasks to other agents.", + "title_case": false, + "type": "bool" + }, + "backstory": { + "trace_as_input": true, + "multiline": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "You are a reliable researcher and journalist ", + "name": "backstory", + "display_name": "Backstory", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "The backstory of the agent.", + "title_case": false, + "type": "str" + }, + "code": { + "type": "code", + "required": true, + "placeholder": "", + "list": false, + "show": true, + "multiline": true, + "value": "from crewai import Agent # type: ignore\n\nfrom langflow.custom import Component\nfrom langflow.io import BoolInput, DictInput, HandleInput, MultilineInput, Output\n\n\nclass CrewAIAgentComponent(Component):\n display_name = \"CrewAI Agent\"\n description = \"Represents an agent of CrewAI.\"\n documentation: str = \"https://docs.crewai.com/how-to/LLM-Connections/\"\n icon = \"CrewAI\"\n\n inputs = [\n MultilineInput(name=\"role\", display_name=\"Role\", info=\"The role of the agent.\"),\n MultilineInput(name=\"goal\", display_name=\"Goal\", info=\"The objective of the agent.\"),\n MultilineInput(name=\"backstory\", display_name=\"Backstory\", info=\"The backstory of the agent.\"),\n HandleInput(\n name=\"tools\",\n display_name=\"Tools\",\n input_types=[\"Tool\"],\n is_list=True,\n info=\"Tools at agents disposal\",\n value=[],\n ),\n HandleInput(\n name=\"llm\",\n display_name=\"Language Model\",\n info=\"Language model that will run the agent.\",\n input_types=[\"LanguageModel\"],\n ),\n BoolInput(\n name=\"memory\",\n display_name=\"Memory\",\n info=\"Whether the agent should have memory or not\",\n advanced=True,\n value=True,\n ),\n BoolInput(\n name=\"verbose\",\n display_name=\"Verbose\",\n advanced=True,\n value=False,\n ),\n BoolInput(\n name=\"allow_delegation\",\n display_name=\"Allow Delegation\",\n info=\"Whether the agent is allowed to delegate tasks to other agents.\",\n value=True,\n ),\n BoolInput(\n name=\"allow_code_execution\",\n display_name=\"Allow Code Execution\",\n info=\"Whether the agent is allowed to execute code.\",\n value=False,\n advanced=True,\n ),\n DictInput(\n name=\"kwargs\",\n display_name=\"kwargs\",\n info=\"kwargs of agent.\",\n is_list=True,\n advanced=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Agent\", name=\"output\", method=\"build_output\"),\n ]\n\n def build_output(self) -> Agent:\n kwargs = self.kwargs if self.kwargs else {}\n agent = Agent(\n role=self.role,\n goal=self.goal,\n backstory=self.backstory,\n llm=self.llm,\n verbose=self.verbose,\n memory=self.memory,\n tools=self.tools if self.tools else [],\n allow_delegation=self.allow_delegation,\n allow_code_execution=self.allow_code_execution,\n **kwargs,\n )\n self.status = repr(agent)\n return agent\n", + "fileTypes": [], + "file_path": "", + "password": false, + "name": "code", + "advanced": true, + "dynamic": true, + "info": "", + "load_from_db": false, + "title_case": false + }, + "goal": { + "trace_as_input": true, + "multiline": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "Evaluate the information for misleading or biased data.", + "name": "goal", + "display_name": "Goal", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "The objective of the agent.", + "title_case": false, + "type": "str" + }, + "kwargs": { + "trace_as_input": true, + "list": true, + "required": false, + "placeholder": "", + "show": true, + "value": {}, + "name": "kwargs", + "display_name": "kwargs", + "advanced": true, + "dynamic": false, + "info": "kwargs of agent.", + "title_case": false, + "type": "dict" + }, + "memory": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": true, + "name": "memory", + "display_name": "Memory", + "advanced": true, + "dynamic": false, + "info": "Whether the agent should have memory or not", + "title_case": false, + "type": "bool" + }, + "role": { + "trace_as_input": true, + "multiline": true, + "trace_as_metadata": true, + "load_from_db": false, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": "Editor", + "name": "role", + "display_name": "Role", + "advanced": false, + "input_types": [ + "Message" + ], + "dynamic": false, + "info": "The role of the agent.", + "title_case": false, + "type": "str" + }, + "verbose": { + "trace_as_metadata": true, + "list": false, + "required": false, + "placeholder": "", + "show": true, + "value": false, + "name": "verbose", + "display_name": "Verbose", + "advanced": true, + "dynamic": false, + "info": "", + "title_case": false, + "type": "bool" + } + }, + "description": "Represents an agent of CrewAI.", + "icon": "CrewAI", + "base_classes": [ + "Agent" + ], + "display_name": "CrewAI Agent", + "documentation": "https://docs.crewai.com/how-to/LLM-Connections/", + "custom_fields": {}, + "output_types": [], + "pinned": false, + "conditional_paths": [], + "frozen": false, + "outputs": [ + { + "types": [ + "Agent" + ], + "selected": "Agent", + "name": "output", + "display_name": "Agent", + "method": "build_output", + "value": "__UNDEFINED__", + "cache": true + } + ], + "field_order": [ + "role", + "goal", + "backstory", + "tools", + "llm", + "memory", + "verbose", + "allow_delegation", + "allow_code_execution", + "kwargs" + ], + "beta": false, + "edited": false + }, + "id": "CrewAIAgentComponent-V2kfR", + "description": "Represents an agent of CrewAI.", + "display_name": "CrewAI Agent" + }, + "selected": false, + "width": 384, + "height": 665, + "positionAbsolute": { + "x": -397.2627184897183, + "y": 892.6280687419107 + }, + "dragging": false + } + ], + "edges": [ + { + "source": "HierarchicalCrewComponent-JNKGT", + "sourceHandle": "{œdataTypeœ:œHierarchicalCrewComponentœ,œidœ:œHierarchicalCrewComponent-JNKGTœ,œnameœ:œoutputœ,œoutput_typesœ:[œMessageœ]}", + "target": "ChatOutput-IACYe", + "targetHandle": "{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-IACYeœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}", + "data": { + "targetHandle": { + "fieldName": "input_value", + "id": "ChatOutput-IACYe", + "inputTypes": [ + "Message" + ], + "type": "str" + }, + "sourceHandle": { + "dataType": "HierarchicalCrewComponent", + "id": "HierarchicalCrewComponent-JNKGT", + "name": "output", + "output_types": [ + "Message" + ] + } + }, + "id": "reactflow__edge-HierarchicalCrewComponent-JNKGT{œdataTypeœ:œHierarchicalCrewComponentœ,œidœ:œHierarchicalCrewComponent-JNKGTœ,œnameœ:œoutputœ,œoutput_typesœ:[œMessageœ]}-ChatOutput-IACYe{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-IACYeœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}", + "selected": false, + "className": "" + }, + { + "source": "HierarchicalTaskComponent-vvJXu", + "sourceHandle": "{œdataTypeœ:œHierarchicalTaskComponentœ,œidœ:œHierarchicalTaskComponent-vvJXuœ,œnameœ:œtask_outputœ,œoutput_typesœ:[œHierarchicalTaskœ]}", + "target": "HierarchicalCrewComponent-JNKGT", + "targetHandle": "{œfieldNameœ:œtasksœ,œidœ:œHierarchicalCrewComponent-JNKGTœ,œinputTypesœ:[œHierarchicalTaskœ],œtypeœ:œotherœ}", + "data": { + "targetHandle": { + "fieldName": "tasks", + "id": "HierarchicalCrewComponent-JNKGT", + "inputTypes": [ + "HierarchicalTask" + ], + "type": "other" + }, + "sourceHandle": { + "dataType": "HierarchicalTaskComponent", + "id": "HierarchicalTaskComponent-vvJXu", + "name": "task_output", + "output_types": [ + "HierarchicalTask" + ] + } + }, + "id": "reactflow__edge-HierarchicalTaskComponent-vvJXu{œdataTypeœ:œHierarchicalTaskComponentœ,œidœ:œHierarchicalTaskComponent-vvJXuœ,œnameœ:œtask_outputœ,œoutput_typesœ:[œHierarchicalTaskœ]}-HierarchicalCrewComponent-JNKGT{œfieldNameœ:œtasksœ,œidœ:œHierarchicalCrewComponent-JNKGTœ,œinputTypesœ:[œHierarchicalTaskœ],œtypeœ:œotherœ}", + "selected": false, + "className": "" + }, + { + "source": "CrewAIAgentComponent-XU5MB", + "sourceHandle": "{œdataTypeœ:œCrewAIAgentComponentœ,œidœ:œCrewAIAgentComponent-XU5MBœ,œnameœ:œoutputœ,œoutput_typesœ:[œAgentœ]}", + "target": "HierarchicalCrewComponent-JNKGT", + "targetHandle": "{œfieldNameœ:œagentsœ,œidœ:œHierarchicalCrewComponent-JNKGTœ,œinputTypesœ:[œAgentœ],œtypeœ:œotherœ}", + "data": { + "targetHandle": { + "fieldName": "agents", + "id": "HierarchicalCrewComponent-JNKGT", + "inputTypes": [ + "Agent" + ], + "type": "other" + }, + "sourceHandle": { + "dataType": "CrewAIAgentComponent", + "id": "CrewAIAgentComponent-XU5MB", + "name": "output", + "output_types": [ + "Agent" + ] + } + }, + "id": "reactflow__edge-CrewAIAgentComponent-XU5MB{œdataTypeœ:œCrewAIAgentComponentœ,œidœ:œCrewAIAgentComponent-XU5MBœ,œnameœ:œoutputœ,œoutput_typesœ:[œAgentœ]}-HierarchicalCrewComponent-JNKGT{œfieldNameœ:œagentsœ,œidœ:œHierarchicalCrewComponent-JNKGTœ,œinputTypesœ:[œAgentœ],œtypeœ:œotherœ}", + "className": "", + "selected": false + }, + { + "source": "OpenAIModel-xoZ41", + "sourceHandle": "{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-xoZ41œ,œnameœ:œmodel_outputœ,œoutput_typesœ:[œLanguageModelœ]}", + "target": "CrewAIAgentComponent-XU5MB", + "targetHandle": "{œfieldNameœ:œllmœ,œidœ:œCrewAIAgentComponent-XU5MBœ,œinputTypesœ:[œLanguageModelœ],œtypeœ:œotherœ}", + "data": { + "targetHandle": { + "fieldName": "llm", + "id": "CrewAIAgentComponent-XU5MB", + "inputTypes": [ + "LanguageModel" + ], + "type": "other" + }, + "sourceHandle": { + "dataType": "OpenAIModel", + "id": "OpenAIModel-xoZ41", + "name": "model_output", + "output_types": [ + "LanguageModel" + ] + } + }, + "id": "reactflow__edge-OpenAIModel-xoZ41{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-xoZ41œ,œnameœ:œmodel_outputœ,œoutput_typesœ:[œLanguageModelœ]}-CrewAIAgentComponent-XU5MB{œfieldNameœ:œllmœ,œidœ:œCrewAIAgentComponent-XU5MBœ,œinputTypesœ:[œLanguageModelœ],œtypeœ:œotherœ}", + "className": "", + "selected": false + }, + { + "source": "CrewAIAgentComponent-Trkfd", + "sourceHandle": "{œdataTypeœ:œCrewAIAgentComponentœ,œidœ:œCrewAIAgentComponent-Trkfdœ,œnameœ:œoutputœ,œoutput_typesœ:[œAgentœ]}", + "target": "HierarchicalCrewComponent-JNKGT", + "targetHandle": "{œfieldNameœ:œmanager_agentœ,œidœ:œHierarchicalCrewComponent-JNKGTœ,œinputTypesœ:[œAgentœ],œtypeœ:œotherœ}", + "data": { + "targetHandle": { + "fieldName": "manager_agent", + "id": "HierarchicalCrewComponent-JNKGT", + "inputTypes": [ + "Agent" + ], + "type": "other" + }, + "sourceHandle": { + "dataType": "CrewAIAgentComponent", + "id": "CrewAIAgentComponent-Trkfd", + "name": "output", + "output_types": [ + "Agent" + ] + } + }, + "id": "reactflow__edge-CrewAIAgentComponent-Trkfd{œdataTypeœ:œCrewAIAgentComponentœ,œidœ:œCrewAIAgentComponent-Trkfdœ,œnameœ:œoutputœ,œoutput_typesœ:[œAgentœ]}-HierarchicalCrewComponent-JNKGT{œfieldNameœ:œmanager_agentœ,œidœ:œHierarchicalCrewComponent-JNKGTœ,œinputTypesœ:[œAgentœ],œtypeœ:œotherœ}", + "className": "", + "selected": false + }, + { + "source": "OpenAIModel-0cqIu", + "sourceHandle": "{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-0cqIuœ,œnameœ:œmodel_outputœ,œoutput_typesœ:[œLanguageModelœ]}", + "target": "CrewAIAgentComponent-Trkfd", + "targetHandle": "{œfieldNameœ:œllmœ,œidœ:œCrewAIAgentComponent-Trkfdœ,œinputTypesœ:[œLanguageModelœ],œtypeœ:œotherœ}", + "data": { + "targetHandle": { + "fieldName": "llm", + "id": "CrewAIAgentComponent-Trkfd", + "inputTypes": [ + "LanguageModel" + ], + "type": "other" + }, + "sourceHandle": { + "dataType": "OpenAIModel", + "id": "OpenAIModel-0cqIu", + "name": "model_output", + "output_types": [ + "LanguageModel" + ] + } + }, + "id": "reactflow__edge-OpenAIModel-0cqIu{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-0cqIuœ,œnameœ:œmodel_outputœ,œoutput_typesœ:[œLanguageModelœ]}-CrewAIAgentComponent-Trkfd{œfieldNameœ:œllmœ,œidœ:œCrewAIAgentComponent-Trkfdœ,œinputTypesœ:[œLanguageModelœ],œtypeœ:œotherœ}", + "className": "", + "selected": false + }, + { + "source": "Prompt-5o2wP", + "sourceHandle": "{œdataTypeœ:œPromptœ,œidœ:œPrompt-5o2wPœ,œnameœ:œpromptœ,œoutput_typesœ:[œMessageœ]}", + "target": "HierarchicalTaskComponent-vvJXu", + "targetHandle": "{œfieldNameœ:œtask_descriptionœ,œidœ:œHierarchicalTaskComponent-vvJXuœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}", + "data": { + "targetHandle": { + "fieldName": "task_description", + "id": "HierarchicalTaskComponent-vvJXu", + "inputTypes": [ + "Message" + ], + "type": "str" + }, + "sourceHandle": { + "dataType": "Prompt", + "id": "Prompt-5o2wP", + "name": "prompt", + "output_types": [ + "Message" + ] + } + }, + "id": "reactflow__edge-Prompt-5o2wP{œdataTypeœ:œPromptœ,œidœ:œPrompt-5o2wPœ,œnameœ:œpromptœ,œoutput_typesœ:[œMessageœ]}-HierarchicalTaskComponent-vvJXu{œfieldNameœ:œtask_descriptionœ,œidœ:œHierarchicalTaskComponent-vvJXuœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}", + "className": "" + }, + { + "source": "ChatInput-kHOLm", + "sourceHandle": "{œdataTypeœ:œChatInputœ,œidœ:œChatInput-kHOLmœ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}", + "target": "Prompt-5o2wP", + "targetHandle": "{œfieldNameœ:œqueryœ,œidœ:œPrompt-5o2wPœ,œinputTypesœ:[œMessageœ,œTextœ],œtypeœ:œstrœ}", + "data": { + "targetHandle": { + "fieldName": "query", + "id": "Prompt-5o2wP", + "inputTypes": [ + "Message", + "Text" + ], + "type": "str" + }, + "sourceHandle": { + "dataType": "ChatInput", + "id": "ChatInput-kHOLm", + "name": "message", + "output_types": [ + "Message" + ] + } + }, + "id": "reactflow__edge-ChatInput-kHOLm{œdataTypeœ:œChatInputœ,œidœ:œChatInput-kHOLmœ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}-Prompt-5o2wP{œfieldNameœ:œqueryœ,œidœ:œPrompt-5o2wPœ,œinputTypesœ:[œMessageœ,œTextœ],œtypeœ:œstrœ}", + "className": "" + }, + { + "source": "SearchAPITool-fmETj", + "sourceHandle": "{œdataTypeœ:œSearchAPIToolœ,œidœ:œSearchAPITool-fmETjœ,œnameœ:œtoolœ,œoutput_typesœ:[œToolœ]}", + "target": "CrewAIAgentComponent-XU5MB", + "targetHandle": "{œfieldNameœ:œtoolsœ,œidœ:œCrewAIAgentComponent-XU5MBœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}", + "data": { + "targetHandle": { + "fieldName": "tools", + "id": "CrewAIAgentComponent-XU5MB", + "inputTypes": [ + "Tool" + ], + "type": "other" + }, + "sourceHandle": { + "dataType": "SearchAPITool", + "id": "SearchAPITool-fmETj", + "name": "tool", + "output_types": [ + "Tool" + ] + } + }, + "id": "reactflow__edge-SearchAPITool-fmETj{œdataTypeœ:œSearchAPIToolœ,œidœ:œSearchAPITool-fmETjœ,œnameœ:œtoolœ,œoutput_typesœ:[œToolœ]}-CrewAIAgentComponent-XU5MB{œfieldNameœ:œtoolsœ,œidœ:œCrewAIAgentComponent-XU5MBœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}", + "selected": false, + "className": "" + }, + { + "source": "CrewAIAgentComponent-V2kfR", + "sourceHandle": "{œdataTypeœ:œCrewAIAgentComponentœ,œidœ:œCrewAIAgentComponent-V2kfRœ,œnameœ:œoutputœ,œoutput_typesœ:[œAgentœ]}", + "target": "HierarchicalCrewComponent-JNKGT", + "targetHandle": "{œfieldNameœ:œagentsœ,œidœ:œHierarchicalCrewComponent-JNKGTœ,œinputTypesœ:[œAgentœ],œtypeœ:œotherœ}", + "data": { + "targetHandle": { + "fieldName": "agents", + "id": "HierarchicalCrewComponent-JNKGT", + "inputTypes": [ + "Agent" + ], + "type": "other" + }, + "sourceHandle": { + "dataType": "CrewAIAgentComponent", + "id": "CrewAIAgentComponent-V2kfR", + "name": "output", + "output_types": [ + "Agent" + ] + } + }, + "id": "reactflow__edge-CrewAIAgentComponent-V2kfR{œdataTypeœ:œCrewAIAgentComponentœ,œidœ:œCrewAIAgentComponent-V2kfRœ,œnameœ:œoutputœ,œoutput_typesœ:[œAgentœ]}-HierarchicalCrewComponent-JNKGT{œfieldNameœ:œagentsœ,œidœ:œHierarchicalCrewComponent-JNKGTœ,œinputTypesœ:[œAgentœ],œtypeœ:œotherœ}", + "className": "" + }, + { + "source": "OpenAIModel-xoZ41", + "sourceHandle": "{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-xoZ41œ,œnameœ:œmodel_outputœ,œoutput_typesœ:[œLanguageModelœ]}", + "target": "CrewAIAgentComponent-V2kfR", + "targetHandle": "{œfieldNameœ:œllmœ,œidœ:œCrewAIAgentComponent-V2kfRœ,œinputTypesœ:[œLanguageModelœ],œtypeœ:œotherœ}", + "data": { + "targetHandle": { + "fieldName": "llm", + "id": "CrewAIAgentComponent-V2kfR", + "inputTypes": [ + "LanguageModel" + ], + "type": "other" + }, + "sourceHandle": { + "dataType": "OpenAIModel", + "id": "OpenAIModel-xoZ41", + "name": "model_output", + "output_types": [ + "LanguageModel" + ] + } + }, + "id": "reactflow__edge-OpenAIModel-xoZ41{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-xoZ41œ,œnameœ:œmodel_outputœ,œoutput_typesœ:[œLanguageModelœ]}-CrewAIAgentComponent-V2kfR{œfieldNameœ:œllmœ,œidœ:œCrewAIAgentComponent-V2kfRœ,œinputTypesœ:[œLanguageModelœ],œtypeœ:œotherœ}", + "className": "" + } + ], + "viewport": { + "x": 689.9423538038659, + "y": 249.5990980882735, + "zoom": 0.28087497575792186 + } + }, + "description": "This Agentic Flow has a Manager and a couple Workers. The manager can answer the user's question straightaway or delegate the task to other agents.", + "name": "Hierarchical Tasks Agent", + "last_tested_version": "1.0.9", + "endpoint_name": null, + "is_component": false +} \ No newline at end of file diff --git a/src/backend/base/langflow/initial_setup/starter_projects/Sequential Agent.json b/src/backend/base/langflow/initial_setup/starter_projects/Sequential Agent.json new file mode 100644 index 000000000..46aabab0d --- /dev/null +++ b/src/backend/base/langflow/initial_setup/starter_projects/Sequential Agent.json @@ -0,0 +1,3055 @@ +{ + "data": { + "edges": [ + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "CrewAIAgentComponent", + "id": "CrewAIAgentComponent-cVNtD", + "name": "output", + "output_types": [ + "Agent" + ] + }, + "targetHandle": { + "fieldName": "agent", + "id": "SequentialTaskComponent-jgjUa", + "inputTypes": [ + "Agent" + ], + "type": "other" + } + }, + "id": "reactflow__edge-CrewAIAgentComponent-cVNtD{œdataTypeœ:œCrewAIAgentComponentœ,œidœ:œCrewAIAgentComponent-cVNtDœ,œnameœ:œoutputœ,œoutput_typesœ:[œAgentœ]}-SequentialTaskComponent-jgjUa{œfieldNameœ:œagentœ,œidœ:œSequentialTaskComponent-jgjUaœ,œinputTypesœ:[œAgentœ],œtypeœ:œotherœ}", + "source": "CrewAIAgentComponent-cVNtD", + "sourceHandle": "{œdataTypeœ: œCrewAIAgentComponentœ, œidœ: œCrewAIAgentComponent-cVNtDœ, œnameœ: œoutputœ, œoutput_typesœ: [œAgentœ]}", + "target": "SequentialTaskComponent-jgjUa", + "targetHandle": "{œfieldNameœ: œagentœ, œidœ: œSequentialTaskComponent-jgjUaœ, œinputTypesœ: [œAgentœ], œtypeœ: œotherœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "SequentialTaskComponent", + "id": "SequentialTaskComponent-h26I4", + "name": "task_output", + "output_types": [ + "SequentialTask" + ] + }, + "targetHandle": { + "fieldName": "task", + "id": "SequentialTaskComponent-IZMNM", + "inputTypes": [ + "SequentialTask" + ], + "type": "other" + } + }, + "id": "reactflow__edge-SequentialTaskComponent-h26I4{œdataTypeœ:œSequentialTaskComponentœ,œidœ:œSequentialTaskComponent-h26I4œ,œnameœ:œtask_outputœ,œoutput_typesœ:[œSequentialTaskœ]}-SequentialTaskComponent-IZMNM{œfieldNameœ:œtaskœ,œidœ:œSequentialTaskComponent-IZMNMœ,œinputTypesœ:[œSequentialTaskœ],œtypeœ:œotherœ}", + "source": "SequentialTaskComponent-h26I4", + "sourceHandle": "{œdataTypeœ: œSequentialTaskComponentœ, œidœ: œSequentialTaskComponent-h26I4œ, œnameœ: œtask_outputœ, œoutput_typesœ: [œSequentialTaskœ]}", + "target": "SequentialTaskComponent-IZMNM", + "targetHandle": "{œfieldNameœ: œtaskœ, œidœ: œSequentialTaskComponent-IZMNMœ, œinputTypesœ: [œSequentialTaskœ], œtypeœ: œotherœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "SequentialTaskComponent", + "id": "SequentialTaskComponent-jgjUa", + "name": "task_output", + "output_types": [ + "SequentialTask" + ] + }, + "targetHandle": { + "fieldName": "task", + "id": "SequentialTaskComponent-h26I4", + "inputTypes": [ + "SequentialTask" + ], + "type": "other" + } + }, + "id": "reactflow__edge-SequentialTaskComponent-jgjUa{œdataTypeœ:œSequentialTaskComponentœ,œidœ:œSequentialTaskComponent-jgjUaœ,œnameœ:œtask_outputœ,œoutput_typesœ:[œSequentialTaskœ]}-SequentialTaskComponent-h26I4{œfieldNameœ:œtaskœ,œidœ:œSequentialTaskComponent-h26I4œ,œinputTypesœ:[œSequentialTaskœ],œtypeœ:œotherœ}", + "source": "SequentialTaskComponent-jgjUa", + "sourceHandle": "{œdataTypeœ: œSequentialTaskComponentœ, œidœ: œSequentialTaskComponent-jgjUaœ, œnameœ: œtask_outputœ, œoutput_typesœ: [œSequentialTaskœ]}", + "target": "SequentialTaskComponent-h26I4", + "targetHandle": "{œfieldNameœ: œtaskœ, œidœ: œSequentialTaskComponent-h26I4œ, œinputTypesœ: [œSequentialTaskœ], œtypeœ: œotherœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "SequentialTaskComponent", + "id": "SequentialTaskComponent-IZMNM", + "name": "task_output", + "output_types": [ + "SequentialTask" + ] + }, + "targetHandle": { + "fieldName": "tasks", + "id": "SequentialCrewComponent-aXS2Y", + "inputTypes": [ + "SequentialTask" + ], + "type": "other" + } + }, + "id": "reactflow__edge-SequentialTaskComponent-IZMNM{œdataTypeœ:œSequentialTaskComponentœ,œidœ:œSequentialTaskComponent-IZMNMœ,œnameœ:œtask_outputœ,œoutput_typesœ:[œSequentialTaskœ]}-SequentialCrewComponent-aXS2Y{œfieldNameœ:œtasksœ,œidœ:œSequentialCrewComponent-aXS2Yœ,œinputTypesœ:[œSequentialTaskœ],œtypeœ:œotherœ}", + "source": "SequentialTaskComponent-IZMNM", + "sourceHandle": "{œdataTypeœ: œSequentialTaskComponentœ, œidœ: œSequentialTaskComponent-IZMNMœ, œnameœ: œtask_outputœ, œoutput_typesœ: [œSequentialTaskœ]}", + "target": "SequentialCrewComponent-aXS2Y", + "targetHandle": "{œfieldNameœ: œtasksœ, œidœ: œSequentialCrewComponent-aXS2Yœ, œinputTypesœ: [œSequentialTaskœ], œtypeœ: œotherœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "CrewAIAgentComponent", + "id": "CrewAIAgentComponent-ZI1XE", + "name": "output", + "output_types": [ + "Agent" + ] + }, + "targetHandle": { + "fieldName": "agent", + "id": "SequentialTaskComponent-h26I4", + "inputTypes": [ + "Agent" + ], + "type": "other" + } + }, + "id": "reactflow__edge-CrewAIAgentComponent-ZI1XE{œdataTypeœ:œCrewAIAgentComponentœ,œidœ:œCrewAIAgentComponent-ZI1XEœ,œnameœ:œoutputœ,œoutput_typesœ:[œAgentœ]}-SequentialTaskComponent-h26I4{œfieldNameœ:œagentœ,œidœ:œSequentialTaskComponent-h26I4œ,œinputTypesœ:[œAgentœ],œtypeœ:œotherœ}", + "source": "CrewAIAgentComponent-ZI1XE", + "sourceHandle": "{œdataTypeœ: œCrewAIAgentComponentœ, œidœ: œCrewAIAgentComponent-ZI1XEœ, œnameœ: œoutputœ, œoutput_typesœ: [œAgentœ]}", + "target": "SequentialTaskComponent-h26I4", + "targetHandle": "{œfieldNameœ: œagentœ, œidœ: œSequentialTaskComponent-h26I4œ, œinputTypesœ: [œAgentœ], œtypeœ: œotherœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "CrewAIAgentComponent", + "id": "CrewAIAgentComponent-9ZavD", + "name": "output", + "output_types": [ + "Agent" + ] + }, + "targetHandle": { + "fieldName": "agent", + "id": "SequentialTaskComponent-IZMNM", + "inputTypes": [ + "Agent" + ], + "type": "other" + } + }, + "id": "reactflow__edge-CrewAIAgentComponent-9ZavD{œdataTypeœ:œCrewAIAgentComponentœ,œidœ:œCrewAIAgentComponent-9ZavDœ,œnameœ:œoutputœ,œoutput_typesœ:[œAgentœ]}-SequentialTaskComponent-IZMNM{œfieldNameœ:œagentœ,œidœ:œSequentialTaskComponent-IZMNMœ,œinputTypesœ:[œAgentœ],œtypeœ:œotherœ}", + "source": "CrewAIAgentComponent-9ZavD", + "sourceHandle": "{œdataTypeœ: œCrewAIAgentComponentœ, œidœ: œCrewAIAgentComponent-9ZavDœ, œnameœ: œoutputœ, œoutput_typesœ: [œAgentœ]}", + "target": "SequentialTaskComponent-IZMNM", + "targetHandle": "{œfieldNameœ: œagentœ, œidœ: œSequentialTaskComponent-IZMNMœ, œinputTypesœ: [œAgentœ], œtypeœ: œotherœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "OpenAIModel", + "id": "OpenAIModel-YZz0B", + "name": "model_output", + "output_types": [ + "LanguageModel" + ] + }, + "targetHandle": { + "fieldName": "llm", + "id": "CrewAIAgentComponent-cVNtD", + "inputTypes": [ + "LanguageModel" + ], + "type": "other" + } + }, + "id": "reactflow__edge-OpenAIModel-YZz0B{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-YZz0Bœ,œnameœ:œmodel_outputœ,œoutput_typesœ:[œLanguageModelœ]}-CrewAIAgentComponent-cVNtD{œfieldNameœ:œllmœ,œidœ:œCrewAIAgentComponent-cVNtDœ,œinputTypesœ:[œLanguageModelœ],œtypeœ:œotherœ}", + "source": "OpenAIModel-YZz0B", + "sourceHandle": "{œdataTypeœ: œOpenAIModelœ, œidœ: œOpenAIModel-YZz0Bœ, œnameœ: œmodel_outputœ, œoutput_typesœ: [œLanguageModelœ]}", + "target": "CrewAIAgentComponent-cVNtD", + "targetHandle": "{œfieldNameœ: œllmœ, œidœ: œCrewAIAgentComponent-cVNtDœ, œinputTypesœ: [œLanguageModelœ], œtypeœ: œotherœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "OpenAIModel", + "id": "OpenAIModel-YZz0B", + "name": "model_output", + "output_types": [ + "LanguageModel" + ] + }, + "targetHandle": { + "fieldName": "llm", + "id": "CrewAIAgentComponent-ZI1XE", + "inputTypes": [ + "LanguageModel" + ], + "type": "other" + } + }, + "id": "reactflow__edge-OpenAIModel-YZz0B{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-YZz0Bœ,œnameœ:œmodel_outputœ,œoutput_typesœ:[œLanguageModelœ]}-CrewAIAgentComponent-ZI1XE{œfieldNameœ:œllmœ,œidœ:œCrewAIAgentComponent-ZI1XEœ,œinputTypesœ:[œLanguageModelœ],œtypeœ:œotherœ}", + "source": "OpenAIModel-YZz0B", + "sourceHandle": "{œdataTypeœ: œOpenAIModelœ, œidœ: œOpenAIModel-YZz0Bœ, œnameœ: œmodel_outputœ, œoutput_typesœ: [œLanguageModelœ]}", + "target": "CrewAIAgentComponent-ZI1XE", + "targetHandle": "{œfieldNameœ: œllmœ, œidœ: œCrewAIAgentComponent-ZI1XEœ, œinputTypesœ: [œLanguageModelœ], œtypeœ: œotherœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "OpenAIModel", + "id": "OpenAIModel-YZz0B", + "name": "model_output", + "output_types": [ + "LanguageModel" + ] + }, + "targetHandle": { + "fieldName": "llm", + "id": "CrewAIAgentComponent-9ZavD", + "inputTypes": [ + "LanguageModel" + ], + "type": "other" + } + }, + "id": "reactflow__edge-OpenAIModel-YZz0B{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-YZz0Bœ,œnameœ:œmodel_outputœ,œoutput_typesœ:[œLanguageModelœ]}-CrewAIAgentComponent-9ZavD{œfieldNameœ:œllmœ,œidœ:œCrewAIAgentComponent-9ZavDœ,œinputTypesœ:[œLanguageModelœ],œtypeœ:œotherœ}", + "source": "OpenAIModel-YZz0B", + "sourceHandle": "{œdataTypeœ: œOpenAIModelœ, œidœ: œOpenAIModel-YZz0Bœ, œnameœ: œmodel_outputœ, œoutput_typesœ: [œLanguageModelœ]}", + "target": "CrewAIAgentComponent-9ZavD", + "targetHandle": "{œfieldNameœ: œllmœ, œidœ: œCrewAIAgentComponent-9ZavDœ, œinputTypesœ: [œLanguageModelœ], œtypeœ: œotherœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "SearchAPITool", + "id": "SearchAPITool-4sF7a", + "name": "tool", + "output_types": [ + "Tool" + ] + }, + "targetHandle": { + "fieldName": "tools", + "id": "CrewAIAgentComponent-cVNtD", + "inputTypes": [ + "Tool" + ], + "type": "other" + } + }, + "id": "reactflow__edge-SearchAPITool-4sF7a{œdataTypeœ:œSearchAPIToolœ,œidœ:œSearchAPITool-4sF7aœ,œnameœ:œtoolœ,œoutput_typesœ:[œToolœ]}-CrewAIAgentComponent-cVNtD{œfieldNameœ:œtoolsœ,œidœ:œCrewAIAgentComponent-cVNtDœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}", + "source": "SearchAPITool-4sF7a", + "sourceHandle": "{œdataTypeœ: œSearchAPIToolœ, œidœ: œSearchAPITool-4sF7aœ, œnameœ: œtoolœ, œoutput_typesœ: [œToolœ]}", + "target": "CrewAIAgentComponent-cVNtD", + "targetHandle": "{œfieldNameœ: œtoolsœ, œidœ: œCrewAIAgentComponent-cVNtDœ, œinputTypesœ: [œToolœ], œtypeœ: œotherœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "SequentialCrewComponent", + "id": "SequentialCrewComponent-aXS2Y", + "name": "output", + "output_types": [ + "Message" + ] + }, + "targetHandle": { + "fieldName": "input_value", + "id": "ChatOutput-ZLnhf", + "inputTypes": [ + "Message" + ], + "type": "str" + } + }, + "id": "reactflow__edge-SequentialCrewComponent-aXS2Y{œdataTypeœ:œSequentialCrewComponentœ,œidœ:œSequentialCrewComponent-aXS2Yœ,œnameœ:œoutputœ,œoutput_typesœ:[œMessageœ]}-ChatOutput-ZLnhf{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-ZLnhfœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}", + "source": "SequentialCrewComponent-aXS2Y", + "sourceHandle": "{œdataTypeœ: œSequentialCrewComponentœ, œidœ: œSequentialCrewComponent-aXS2Yœ, œnameœ: œoutputœ, œoutput_typesœ: [œMessageœ]}", + "target": "ChatOutput-ZLnhf", + "targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œChatOutput-ZLnhfœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "Prompt", + "id": "Prompt-XT7vd", + "name": "prompt", + "output_types": [ + "Message" + ] + }, + "targetHandle": { + "fieldName": "task_description", + "id": "SequentialTaskComponent-h26I4", + "inputTypes": [ + "Message" + ], + "type": "str" + } + }, + "id": "reactflow__edge-Prompt-XT7vd{œdataTypeœ:œPromptœ,œidœ:œPrompt-XT7vdœ,œnameœ:œpromptœ,œoutput_typesœ:[œMessageœ]}-SequentialTaskComponent-h26I4{œfieldNameœ:œtask_descriptionœ,œidœ:œSequentialTaskComponent-h26I4œ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}", + "source": "Prompt-XT7vd", + "sourceHandle": "{œdataTypeœ: œPromptœ, œidœ: œPrompt-XT7vdœ, œnameœ: œpromptœ, œoutput_typesœ: [œMessageœ]}", + "target": "SequentialTaskComponent-h26I4", + "targetHandle": "{œfieldNameœ: œtask_descriptionœ, œidœ: œSequentialTaskComponent-h26I4œ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "Prompt", + "id": "Prompt-NNetm", + "name": "prompt", + "output_types": [ + "Message" + ] + }, + "targetHandle": { + "fieldName": "task_description", + "id": "SequentialTaskComponent-IZMNM", + "inputTypes": [ + "Message" + ], + "type": "str" + } + }, + "id": "reactflow__edge-Prompt-NNetm{œdataTypeœ:œPromptœ,œidœ:œPrompt-NNetmœ,œnameœ:œpromptœ,œoutput_typesœ:[œMessageœ]}-SequentialTaskComponent-IZMNM{œfieldNameœ:œtask_descriptionœ,œidœ:œSequentialTaskComponent-IZMNMœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}", + "source": "Prompt-NNetm", + "sourceHandle": "{œdataTypeœ: œPromptœ, œidœ: œPrompt-NNetmœ, œnameœ: œpromptœ, œoutput_typesœ: [œMessageœ]}", + "target": "SequentialTaskComponent-IZMNM", + "targetHandle": "{œfieldNameœ: œtask_descriptionœ, œidœ: œSequentialTaskComponent-IZMNMœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "TextInput", + "id": "TextInput-YzcB0", + "name": "text", + "output_types": [ + "Message" + ] + }, + "targetHandle": { + "fieldName": "topic", + "id": "Prompt-lEE73", + "inputTypes": [ + "Message", + "Text" + ], + "type": "str" + } + }, + "id": "reactflow__edge-TextInput-YzcB0{œdataTypeœ:œTextInputœ,œidœ:œTextInput-YzcB0œ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}-Prompt-lEE73{œfieldNameœ:œtopicœ,œidœ:œPrompt-lEE73œ,œinputTypesœ:[œMessageœ,œTextœ],œtypeœ:œstrœ}", + "source": "TextInput-YzcB0", + "sourceHandle": "{œdataTypeœ: œTextInputœ, œidœ: œTextInput-YzcB0œ, œnameœ: œtextœ, œoutput_typesœ: [œMessageœ]}", + "target": "Prompt-lEE73", + "targetHandle": "{œfieldNameœ: œtopicœ, œidœ: œPrompt-lEE73œ, œinputTypesœ: [œMessageœ, œTextœ], œtypeœ: œstrœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "TextInput", + "id": "TextInput-YzcB0", + "name": "text", + "output_types": [ + "Message" + ] + }, + "targetHandle": { + "fieldName": "topic", + "id": "Prompt-XT7vd", + "inputTypes": [ + "Message", + "Text" + ], + "type": "str" + } + }, + "id": "reactflow__edge-TextInput-YzcB0{œdataTypeœ:œTextInputœ,œidœ:œTextInput-YzcB0œ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}-Prompt-XT7vd{œfieldNameœ:œtopicœ,œidœ:œPrompt-XT7vdœ,œinputTypesœ:[œMessageœ,œTextœ],œtypeœ:œstrœ}", + "source": "TextInput-YzcB0", + "sourceHandle": "{œdataTypeœ: œTextInputœ, œidœ: œTextInput-YzcB0œ, œnameœ: œtextœ, œoutput_typesœ: [œMessageœ]}", + "target": "Prompt-XT7vd", + "targetHandle": "{œfieldNameœ: œtopicœ, œidœ: œPrompt-XT7vdœ, œinputTypesœ: [œMessageœ, œTextœ], œtypeœ: œstrœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "TextInput", + "id": "TextInput-YzcB0", + "name": "text", + "output_types": [ + "Message" + ] + }, + "targetHandle": { + "fieldName": "topic", + "id": "Prompt-NNetm", + "inputTypes": [ + "Message", + "Text" + ], + "type": "str" + } + }, + "id": "reactflow__edge-TextInput-YzcB0{œdataTypeœ:œTextInputœ,œidœ:œTextInput-YzcB0œ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}-Prompt-NNetm{œfieldNameœ:œtopicœ,œidœ:œPrompt-NNetmœ,œinputTypesœ:[œMessageœ,œTextœ],œtypeœ:œstrœ}", + "source": "TextInput-YzcB0", + "sourceHandle": "{œdataTypeœ: œTextInputœ, œidœ: œTextInput-YzcB0œ, œnameœ: œtextœ, œoutput_typesœ: [œMessageœ]}", + "target": "Prompt-NNetm", + "targetHandle": "{œfieldNameœ: œtopicœ, œidœ: œPrompt-NNetmœ, œinputTypesœ: [œMessageœ, œTextœ], œtypeœ: œstrœ}" + }, + { + "className": "", + "data": { + "sourceHandle": { + "dataType": "Prompt", + "id": "Prompt-lEE73", + "name": "prompt", + "output_types": [ + "Message" + ] + }, + "targetHandle": { + "fieldName": "task_description", + "id": "SequentialTaskComponent-jgjUa", + "inputTypes": [ + "Message" + ], + "type": "str" + } + }, + "id": "reactflow__edge-Prompt-lEE73{œdataTypeœ:œPromptœ,œidœ:œPrompt-lEE73œ,œnameœ:œpromptœ,œoutput_typesœ:[œMessageœ]}-SequentialTaskComponent-jgjUa{œfieldNameœ:œtask_descriptionœ,œidœ:œSequentialTaskComponent-jgjUaœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}", + "source": "Prompt-lEE73", + "sourceHandle": "{œdataTypeœ: œPromptœ, œidœ: œPrompt-lEE73œ, œnameœ: œpromptœ, œoutput_typesœ: [œMessageœ]}", + "target": "SequentialTaskComponent-jgjUa", + "targetHandle": "{œfieldNameœ: œtask_descriptionœ, œidœ: œSequentialTaskComponent-jgjUaœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}" + } + ], + "nodes": [ + { + "data": { + "description": "Represents a group of agents, defining how they should collaborate and the tasks they should perform.", + "display_name": "Sequential Crew", + "id": "SequentialCrewComponent-aXS2Y", + "node": { + "base_classes": [ + "Message" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": {}, + "description": "Represents a group of agents, defining how they should collaborate and the tasks they should perform.", + "display_name": "Sequential Crew", + "documentation": "https://docs.crewai.com/how-to/LLM-Connections/", + "edited": false, + "field_order": [ + "verbose", + "memory", + "use_cache", + "max_rpm", + "share_crew", + "function_calling_llm", + "tasks" + ], + "frozen": false, + "icon": "CrewAI", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Output", + "method": "build_output", + "name": "output", + "selected": "Message", + "types": [ + "Message" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from crewai import Agent, Crew, Process, Task # type: ignore\n\nfrom langflow.base.agents.crewai.crew import BaseCrewComponent\nfrom langflow.io import HandleInput\nfrom langflow.schema.message import Message\n\n\nclass SequentialCrewComponent(BaseCrewComponent):\n display_name: str = \"Sequential Crew\"\n description: str = (\n \"Represents a group of agents, defining how they should collaborate and the tasks they should perform.\"\n )\n documentation: str = \"https://docs.crewai.com/how-to/LLM-Connections/\"\n icon = \"CrewAI\"\n\n inputs = BaseCrewComponent._base_inputs + [\n HandleInput(name=\"tasks\", display_name=\"Tasks\", input_types=[\"SequentialTask\"], is_list=True),\n ]\n\n def get_tasks_and_agents(self) -> tuple[list[Task], list[Agent]]:\n return self.tasks, [task.agent for task in self.tasks]\n\n def build_crew(self) -> Message:\n tasks, agents = self.get_tasks_and_agents()\n crew = Crew(\n agents=agents,\n tasks=tasks,\n process=Process.sequential,\n verbose=self.verbose,\n memory=self.memory,\n cache=self.use_cache,\n max_rpm=self.max_rpm,\n share_crew=self.share_crew,\n function_calling_llm=self.function_calling_llm,\n step_callback=self.get_step_callback(),\n task_callback=self.get_task_callback(),\n )\n return crew\n" + }, + "function_calling_llm": { + "advanced": true, + "display_name": "Function Calling LLM", + "dynamic": false, + "info": "", + "input_types": [ + "LanguageModel" + ], + "list": false, + "name": "function_calling_llm", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + }, + "max_rpm": { + "advanced": true, + "display_name": "Max RPM", + "dynamic": false, + "info": "", + "list": false, + "name": "max_rpm", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "int", + "value": 100 + }, + "memory": { + "advanced": true, + "display_name": "Memory", + "dynamic": false, + "info": "", + "list": false, + "name": "memory", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + }, + "share_crew": { + "advanced": true, + "display_name": "Share Crew", + "dynamic": false, + "info": "", + "list": false, + "name": "share_crew", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + }, + "tasks": { + "advanced": false, + "display_name": "Tasks", + "dynamic": false, + "info": "", + "input_types": [ + "SequentialTask" + ], + "list": true, + "name": "tasks", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + }, + "use_cache": { + "advanced": true, + "display_name": "Cache", + "dynamic": false, + "info": "", + "list": false, + "name": "use_cache", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": true + }, + "verbose": { + "advanced": true, + "display_name": "Verbose", + "dynamic": false, + "info": "", + "list": false, + "name": "verbose", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "int", + "value": 0 + } + } + }, + "type": "SequentialCrewComponent" + }, + "dragging": false, + "height": 315, + "id": "SequentialCrewComponent-aXS2Y", + "position": { + "x": 1496.0834127531327, + "y": 252.03224104884515 + }, + "positionAbsolute": { + "x": 1496.0834127531327, + "y": 252.03224104884515 + }, + "selected": false, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "description": "Represents an agent of CrewAI.", + "display_name": "CrewAI Agent", + "id": "CrewAIAgentComponent-cVNtD", + "node": { + "base_classes": [ + "Agent" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": {}, + "description": "Represents an agent of CrewAI.", + "display_name": "CrewAI Agent", + "documentation": "https://docs.crewai.com/how-to/LLM-Connections/", + "edited": false, + "field_order": [ + "role", + "goal", + "backstory", + "tools", + "llm", + "memory", + "verbose", + "allow_delegation", + "allow_code_execution", + "kwargs" + ], + "frozen": false, + "icon": "CrewAI", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Agent", + "method": "build_output", + "name": "output", + "selected": "Agent", + "types": [ + "Agent" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "allow_code_execution": { + "advanced": true, + "display_name": "Allow Code Execution", + "dynamic": false, + "info": "Whether the agent is allowed to execute code.", + "list": false, + "name": "allow_code_execution", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + }, + "allow_delegation": { + "advanced": false, + "display_name": "Allow Delegation", + "dynamic": false, + "info": "Whether the agent is allowed to delegate tasks to other agents.", + "list": false, + "load_from_db": false, + "name": "allow_delegation", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + }, + "backstory": { + "advanced": false, + "display_name": "Backstory", + "dynamic": false, + "info": "The backstory of the agent.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "backstory", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "Research has always been your thing. You can quickly find things on the web because of your skills." + }, + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from crewai import Agent # type: ignore\n\nfrom langflow.custom import Component\nfrom langflow.io import BoolInput, DictInput, HandleInput, MessageTextInput, Output\n\n\nclass CrewAIAgentComponent(Component):\n display_name = \"CrewAI Agent\"\n description = \"Represents an agent of CrewAI.\"\n documentation: str = \"https://docs.crewai.com/how-to/LLM-Connections/\"\n icon = \"CrewAI\"\n\n inputs = [\n MessageTextInput(name=\"role\", display_name=\"Role\", info=\"The role of the agent.\"),\n MessageTextInput(name=\"goal\", display_name=\"Goal\", info=\"The objective of the agent.\"),\n MessageTextInput(name=\"backstory\", display_name=\"Backstory\", info=\"The backstory of the agent.\"),\n HandleInput(\n name=\"tools\",\n display_name=\"Tools\",\n input_types=[\"Tool\"],\n is_list=True,\n info=\"Tools at agents disposal\",\n value=[],\n ),\n HandleInput(\n name=\"llm\",\n display_name=\"Language Model\",\n info=\"Language model that will run the agent.\",\n input_types=[\"LanguageModel\"],\n ),\n BoolInput(\n name=\"memory\",\n display_name=\"Memory\",\n info=\"Whether the agent should have memory or not\",\n advanced=True,\n value=True,\n ),\n BoolInput(\n name=\"verbose\",\n display_name=\"Verbose\",\n advanced=True,\n value=False,\n ),\n BoolInput(\n name=\"allow_delegation\",\n display_name=\"Allow Delegation\",\n info=\"Whether the agent is allowed to delegate tasks to other agents.\",\n value=True,\n ),\n BoolInput(\n name=\"allow_code_execution\",\n display_name=\"Allow Code Execution\",\n info=\"Whether the agent is allowed to execute code.\",\n value=False,\n advanced=True,\n ),\n DictInput(\n name=\"kwargs\",\n display_name=\"kwargs\",\n info=\"kwargs of agent.\",\n is_list=True,\n advanced=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Agent\", name=\"output\", method=\"build_output\"),\n ]\n\n def build_output(self) -> Agent:\n kwargs = self.kwargs if self.kwargs else {}\n agent = Agent(\n role=self.role,\n goal=self.goal,\n backstory=self.backstory,\n llm=self.llm,\n verbose=self.verbose,\n memory=self.memory,\n tools=self.tools if self.tools else [],\n allow_delegation=self.allow_delegation,\n allow_code_execution=self.allow_code_execution,\n **kwargs,\n )\n self.status = repr(agent)\n return agent\n" + }, + "goal": { + "advanced": false, + "display_name": "Goal", + "dynamic": false, + "info": "The objective of the agent.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "goal", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "Search Google to find information to complete the task." + }, + "kwargs": { + "advanced": true, + "display_name": "kwargs", + "dynamic": false, + "info": "kwargs of agent.", + "list": true, + "name": "kwargs", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "type": "dict", + "value": {} + }, + "llm": { + "advanced": false, + "display_name": "Language Model", + "dynamic": false, + "info": "Language model that will run the agent.", + "input_types": [ + "LanguageModel" + ], + "list": false, + "name": "llm", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + }, + "memory": { + "advanced": true, + "display_name": "Memory", + "dynamic": false, + "info": "Whether the agent should have memory or not", + "list": false, + "name": "memory", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": true + }, + "role": { + "advanced": false, + "display_name": "Role", + "dynamic": false, + "info": "The role of the agent.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "role", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "Researcher" + }, + "tools": { + "advanced": false, + "display_name": "Tools", + "dynamic": false, + "info": "Tools at agents disposal", + "input_types": [ + "Tool" + ], + "list": true, + "name": "tools", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": [] + }, + "verbose": { + "advanced": true, + "display_name": "Verbose", + "dynamic": false, + "info": "", + "list": false, + "name": "verbose", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + } + } + }, + "type": "CrewAIAgentComponent" + }, + "dragging": false, + "height": 665, + "id": "CrewAIAgentComponent-cVNtD", + "position": { + "x": -1550.7778579481528, + "y": -518.39242270897 + }, + "positionAbsolute": { + "x": -1550.7778579481528, + "y": -518.39242270897 + }, + "selected": false, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "description": "Each task must have a description, an expected output and an agent responsible for execution.", + "display_name": "Sequential Task", + "id": "SequentialTaskComponent-jgjUa", + "node": { + "base_classes": [ + "SequentialTask" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": {}, + "description": "Each task must have a description, an expected output and an agent responsible for execution.", + "display_name": "Sequential Task", + "documentation": "", + "edited": false, + "field_order": [ + "task_description", + "expected_output", + "tools", + "agent", + "task", + "async_execution" + ], + "frozen": false, + "icon": "CrewAI", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Task", + "method": "build_task", + "name": "task_output", + "selected": "SequentialTask", + "types": [ + "SequentialTask" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "agent": { + "advanced": false, + "display_name": "Agent", + "dynamic": false, + "info": "CrewAI Agent that will perform the task", + "input_types": [ + "Agent" + ], + "list": false, + "name": "agent", + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + }, + "async_execution": { + "advanced": true, + "display_name": "Async Execution", + "dynamic": false, + "info": "Boolean flag indicating asynchronous task execution.", + "list": false, + "name": "async_execution", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": true + }, + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from langflow.base.agents.crewai.tasks import SequentialTask\nfrom langflow.custom import Component\nfrom langflow.io import BoolInput, HandleInput, MultilineInput, Output\n\n\nclass SequentialTaskComponent(Component):\n display_name: str = \"Sequential Task\"\n description: str = \"Each task must have a description, an expected output and an agent responsible for execution.\"\n icon = \"CrewAI\"\n inputs = [\n MultilineInput(\n name=\"task_description\",\n display_name=\"Description\",\n info=\"Descriptive text detailing task's purpose and execution.\",\n ),\n MultilineInput(\n name=\"expected_output\",\n display_name=\"Expected Output\",\n info=\"Clear definition of expected task outcome.\",\n ),\n HandleInput(\n name=\"tools\",\n display_name=\"Tools\",\n input_types=[\"Tool\"],\n is_list=True,\n info=\"List of tools/resources limited for task execution. Uses the Agent tools by default.\",\n required=False,\n advanced=True,\n ),\n HandleInput(\n name=\"agent\",\n display_name=\"Agent\",\n input_types=[\"Agent\"],\n info=\"CrewAI Agent that will perform the task\",\n required=True,\n ),\n HandleInput(\n name=\"task\",\n display_name=\"Task\",\n input_types=[\"SequentialTask\"],\n info=\"CrewAI Task that will perform the task\",\n ),\n BoolInput(\n name=\"async_execution\",\n display_name=\"Async Execution\",\n value=True,\n advanced=True,\n info=\"Boolean flag indicating asynchronous task execution.\",\n ),\n ]\n\n outputs = [\n Output(display_name=\"Task\", name=\"task_output\", method=\"build_task\"),\n ]\n\n def build_task(self) -> list[SequentialTask]:\n tasks: list[SequentialTask] = []\n task = SequentialTask(\n description=self.task_description,\n expected_output=self.expected_output,\n tools=self.agent.tools,\n async_execution=False,\n agent=self.agent,\n )\n tasks.append(task)\n self.status = task\n if self.task:\n if isinstance(self.task, list) and all(isinstance(task, SequentialTask) for task in self.task):\n tasks = self.task + tasks\n elif isinstance(self.task, SequentialTask):\n tasks = [self.task] + tasks\n return tasks\n" + }, + "expected_output": { + "advanced": false, + "display_name": "Expected Output", + "dynamic": false, + "info": "Clear definition of expected task outcome.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "multiline": true, + "name": "expected_output", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "Bullet points and small phrases about the research topic." + }, + "task": { + "advanced": false, + "display_name": "Task", + "dynamic": false, + "info": "CrewAI Task that will perform the task", + "input_types": [ + "SequentialTask" + ], + "list": false, + "name": "task", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + }, + "task_description": { + "advanced": false, + "display_name": "Description", + "dynamic": false, + "info": "Descriptive text detailing task's purpose and execution.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "multiline": true, + "name": "task_description", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "" + }, + "tools": { + "advanced": true, + "display_name": "Tools", + "dynamic": false, + "info": "List of tools/resources limited for task execution. Uses the Agent tools by default.", + "input_types": [ + "Tool" + ], + "list": true, + "name": "tools", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + } + } + }, + "type": "SequentialTaskComponent" + }, + "dragging": false, + "height": 551, + "id": "SequentialTaskComponent-jgjUa", + "position": { + "x": -983.4355350416582, + "y": 148.59988576915515 + }, + "positionAbsolute": { + "x": -983.4355350416582, + "y": 148.59988576915515 + }, + "selected": true, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "description": "Each task must have a description, an expected output and an agent responsible for execution.", + "display_name": "Sequential Task", + "id": "SequentialTaskComponent-h26I4", + "node": { + "base_classes": [ + "SequentialTask" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": {}, + "description": "Each task must have a description, an expected output and an agent responsible for execution.", + "display_name": "Sequential Task", + "documentation": "", + "edited": false, + "field_order": [ + "task_description", + "expected_output", + "tools", + "agent", + "task", + "async_execution" + ], + "frozen": false, + "icon": "CrewAI", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Task", + "method": "build_task", + "name": "task_output", + "selected": "SequentialTask", + "types": [ + "SequentialTask" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "agent": { + "advanced": false, + "display_name": "Agent", + "dynamic": false, + "info": "CrewAI Agent that will perform the task", + "input_types": [ + "Agent" + ], + "list": false, + "name": "agent", + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + }, + "async_execution": { + "advanced": true, + "display_name": "Async Execution", + "dynamic": false, + "info": "Boolean flag indicating asynchronous task execution.", + "list": false, + "name": "async_execution", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": true + }, + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from langflow.base.agents.crewai.tasks import SequentialTask\nfrom langflow.custom import Component\nfrom langflow.io import BoolInput, HandleInput, MultilineInput, Output\n\n\nclass SequentialTaskComponent(Component):\n display_name: str = \"Sequential Task\"\n description: str = \"Each task must have a description, an expected output and an agent responsible for execution.\"\n icon = \"CrewAI\"\n inputs = [\n MultilineInput(\n name=\"task_description\",\n display_name=\"Description\",\n info=\"Descriptive text detailing task's purpose and execution.\",\n ),\n MultilineInput(\n name=\"expected_output\",\n display_name=\"Expected Output\",\n info=\"Clear definition of expected task outcome.\",\n ),\n HandleInput(\n name=\"tools\",\n display_name=\"Tools\",\n input_types=[\"Tool\"],\n is_list=True,\n info=\"List of tools/resources limited for task execution. Uses the Agent tools by default.\",\n required=False,\n advanced=True,\n ),\n HandleInput(\n name=\"agent\",\n display_name=\"Agent\",\n input_types=[\"Agent\"],\n info=\"CrewAI Agent that will perform the task\",\n required=True,\n ),\n HandleInput(\n name=\"task\",\n display_name=\"Task\",\n input_types=[\"SequentialTask\"],\n info=\"CrewAI Task that will perform the task\",\n ),\n BoolInput(\n name=\"async_execution\",\n display_name=\"Async Execution\",\n value=True,\n advanced=True,\n info=\"Boolean flag indicating asynchronous task execution.\",\n ),\n ]\n\n outputs = [\n Output(display_name=\"Task\", name=\"task_output\", method=\"build_task\"),\n ]\n\n def build_task(self) -> list[SequentialTask]:\n tasks: list[SequentialTask] = []\n task = SequentialTask(\n description=self.task_description,\n expected_output=self.expected_output,\n tools=self.agent.tools,\n async_execution=False,\n agent=self.agent,\n )\n tasks.append(task)\n self.status = task\n if self.task:\n if isinstance(self.task, list) and all(isinstance(task, SequentialTask) for task in self.task):\n tasks = self.task + tasks\n elif isinstance(self.task, SequentialTask):\n tasks = [self.task] + tasks\n return tasks\n" + }, + "expected_output": { + "advanced": false, + "display_name": "Expected Output", + "dynamic": false, + "info": "Clear definition of expected task outcome.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "multiline": true, + "name": "expected_output", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "Small paragraphs and bullet points with the corrected content." + }, + "task": { + "advanced": false, + "display_name": "Task", + "dynamic": false, + "info": "CrewAI Task that will perform the task", + "input_types": [ + "SequentialTask" + ], + "list": false, + "name": "task", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + }, + "task_description": { + "advanced": false, + "display_name": "Description", + "dynamic": false, + "info": "Descriptive text detailing task's purpose and execution.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "multiline": true, + "name": "task_description", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "" + }, + "tools": { + "advanced": true, + "display_name": "Tools", + "dynamic": false, + "info": "List of tools/resources limited for task execution. Uses the Agent tools by default.", + "input_types": [ + "Tool" + ], + "list": true, + "name": "tools", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + } + } + }, + "type": "SequentialTaskComponent" + }, + "dragging": false, + "height": 551, + "id": "SequentialTaskComponent-h26I4", + "position": { + "x": -77.94104937963255, + "y": 157.6447364692444 + }, + "positionAbsolute": { + "x": -77.94104937963255, + "y": 157.6447364692444 + }, + "selected": false, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "description": "Each task must have a description, an expected output and an agent responsible for execution.", + "display_name": "Sequential Task", + "id": "SequentialTaskComponent-IZMNM", + "node": { + "base_classes": [ + "SequentialTask" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": {}, + "description": "Each task must have a description, an expected output and an agent responsible for execution.", + "display_name": "Sequential Task", + "documentation": "", + "edited": false, + "field_order": [ + "task_description", + "expected_output", + "tools", + "agent", + "task", + "async_execution" + ], + "frozen": false, + "icon": "CrewAI", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Task", + "method": "build_task", + "name": "task_output", + "selected": "SequentialTask", + "types": [ + "SequentialTask" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "agent": { + "advanced": false, + "display_name": "Agent", + "dynamic": false, + "info": "CrewAI Agent that will perform the task", + "input_types": [ + "Agent" + ], + "list": false, + "name": "agent", + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + }, + "async_execution": { + "advanced": true, + "display_name": "Async Execution", + "dynamic": false, + "info": "Boolean flag indicating asynchronous task execution.", + "list": false, + "name": "async_execution", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": true + }, + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from langflow.base.agents.crewai.tasks import SequentialTask\nfrom langflow.custom import Component\nfrom langflow.io import BoolInput, HandleInput, MultilineInput, Output\n\n\nclass SequentialTaskComponent(Component):\n display_name: str = \"Sequential Task\"\n description: str = \"Each task must have a description, an expected output and an agent responsible for execution.\"\n icon = \"CrewAI\"\n inputs = [\n MultilineInput(\n name=\"task_description\",\n display_name=\"Description\",\n info=\"Descriptive text detailing task's purpose and execution.\",\n ),\n MultilineInput(\n name=\"expected_output\",\n display_name=\"Expected Output\",\n info=\"Clear definition of expected task outcome.\",\n ),\n HandleInput(\n name=\"tools\",\n display_name=\"Tools\",\n input_types=[\"Tool\"],\n is_list=True,\n info=\"List of tools/resources limited for task execution. Uses the Agent tools by default.\",\n required=False,\n advanced=True,\n ),\n HandleInput(\n name=\"agent\",\n display_name=\"Agent\",\n input_types=[\"Agent\"],\n info=\"CrewAI Agent that will perform the task\",\n required=True,\n ),\n HandleInput(\n name=\"task\",\n display_name=\"Task\",\n input_types=[\"SequentialTask\"],\n info=\"CrewAI Task that will perform the task\",\n ),\n BoolInput(\n name=\"async_execution\",\n display_name=\"Async Execution\",\n value=True,\n advanced=True,\n info=\"Boolean flag indicating asynchronous task execution.\",\n ),\n ]\n\n outputs = [\n Output(display_name=\"Task\", name=\"task_output\", method=\"build_task\"),\n ]\n\n def build_task(self) -> list[SequentialTask]:\n tasks: list[SequentialTask] = []\n task = SequentialTask(\n description=self.task_description,\n expected_output=self.expected_output,\n tools=self.agent.tools,\n async_execution=False,\n agent=self.agent,\n )\n tasks.append(task)\n self.status = task\n if self.task:\n if isinstance(self.task, list) and all(isinstance(task, SequentialTask) for task in self.task):\n tasks = self.task + tasks\n elif isinstance(self.task, SequentialTask):\n tasks = [self.task] + tasks\n return tasks\n" + }, + "expected_output": { + "advanced": false, + "display_name": "Expected Output", + "dynamic": false, + "info": "Clear definition of expected task outcome.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "multiline": true, + "name": "expected_output", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "A small blog about the topic." + }, + "task": { + "advanced": false, + "display_name": "Task", + "dynamic": false, + "info": "CrewAI Task that will perform the task", + "input_types": [ + "SequentialTask" + ], + "list": false, + "name": "task", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + }, + "task_description": { + "advanced": false, + "display_name": "Description", + "dynamic": false, + "info": "Descriptive text detailing task's purpose and execution.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "multiline": true, + "name": "task_description", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "" + }, + "tools": { + "advanced": true, + "display_name": "Tools", + "dynamic": false, + "info": "List of tools/resources limited for task execution. Uses the Agent tools by default.", + "input_types": [ + "Tool" + ], + "list": true, + "name": "tools", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + } + } + }, + "type": "SequentialTaskComponent" + }, + "dragging": false, + "height": 551, + "id": "SequentialTaskComponent-IZMNM", + "position": { + "x": 935.4416416450226, + "y": 140.14908065805054 + }, + "positionAbsolute": { + "x": 935.4416416450226, + "y": 140.14908065805054 + }, + "selected": false, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "description": "Represents an agent of CrewAI.", + "display_name": "CrewAI Agent", + "id": "CrewAIAgentComponent-ZI1XE", + "node": { + "base_classes": [ + "Agent" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": {}, + "description": "Represents an agent of CrewAI.", + "display_name": "CrewAI Agent", + "documentation": "https://docs.crewai.com/how-to/LLM-Connections/", + "edited": false, + "field_order": [ + "role", + "goal", + "backstory", + "tools", + "llm", + "memory", + "verbose", + "allow_delegation", + "allow_code_execution", + "kwargs" + ], + "frozen": false, + "icon": "CrewAI", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Agent", + "method": "build_output", + "name": "output", + "selected": "Agent", + "types": [ + "Agent" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "allow_code_execution": { + "advanced": true, + "display_name": "Allow Code Execution", + "dynamic": false, + "info": "Whether the agent is allowed to execute code.", + "list": false, + "name": "allow_code_execution", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + }, + "allow_delegation": { + "advanced": false, + "display_name": "Allow Delegation", + "dynamic": false, + "info": "Whether the agent is allowed to delegate tasks to other agents.", + "list": false, + "load_from_db": false, + "name": "allow_delegation", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + }, + "backstory": { + "advanced": false, + "display_name": "Backstory", + "dynamic": false, + "info": "The backstory of the agent.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "backstory", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "You are the editor of the most reputable journal in the world." + }, + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from crewai import Agent # type: ignore\n\nfrom langflow.custom import Component\nfrom langflow.io import BoolInput, DictInput, HandleInput, MessageTextInput, Output\n\n\nclass CrewAIAgentComponent(Component):\n display_name = \"CrewAI Agent\"\n description = \"Represents an agent of CrewAI.\"\n documentation: str = \"https://docs.crewai.com/how-to/LLM-Connections/\"\n icon = \"CrewAI\"\n\n inputs = [\n MessageTextInput(name=\"role\", display_name=\"Role\", info=\"The role of the agent.\"),\n MessageTextInput(name=\"goal\", display_name=\"Goal\", info=\"The objective of the agent.\"),\n MessageTextInput(name=\"backstory\", display_name=\"Backstory\", info=\"The backstory of the agent.\"),\n HandleInput(\n name=\"tools\",\n display_name=\"Tools\",\n input_types=[\"Tool\"],\n is_list=True,\n info=\"Tools at agents disposal\",\n value=[],\n ),\n HandleInput(\n name=\"llm\",\n display_name=\"Language Model\",\n info=\"Language model that will run the agent.\",\n input_types=[\"LanguageModel\"],\n ),\n BoolInput(\n name=\"memory\",\n display_name=\"Memory\",\n info=\"Whether the agent should have memory or not\",\n advanced=True,\n value=True,\n ),\n BoolInput(\n name=\"verbose\",\n display_name=\"Verbose\",\n advanced=True,\n value=False,\n ),\n BoolInput(\n name=\"allow_delegation\",\n display_name=\"Allow Delegation\",\n info=\"Whether the agent is allowed to delegate tasks to other agents.\",\n value=True,\n ),\n BoolInput(\n name=\"allow_code_execution\",\n display_name=\"Allow Code Execution\",\n info=\"Whether the agent is allowed to execute code.\",\n value=False,\n advanced=True,\n ),\n DictInput(\n name=\"kwargs\",\n display_name=\"kwargs\",\n info=\"kwargs of agent.\",\n is_list=True,\n advanced=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Agent\", name=\"output\", method=\"build_output\"),\n ]\n\n def build_output(self) -> Agent:\n kwargs = self.kwargs if self.kwargs else {}\n agent = Agent(\n role=self.role,\n goal=self.goal,\n backstory=self.backstory,\n llm=self.llm,\n verbose=self.verbose,\n memory=self.memory,\n tools=self.tools if self.tools else [],\n allow_delegation=self.allow_delegation,\n allow_code_execution=self.allow_code_execution,\n **kwargs,\n )\n self.status = repr(agent)\n return agent\n" + }, + "goal": { + "advanced": false, + "display_name": "Goal", + "dynamic": false, + "info": "The objective of the agent.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "goal", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "You should edit the Information provided by the Researcher to make it more palatable and to not contain misleading information." + }, + "kwargs": { + "advanced": true, + "display_name": "kwargs", + "dynamic": false, + "info": "kwargs of agent.", + "list": true, + "name": "kwargs", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "type": "dict", + "value": {} + }, + "llm": { + "advanced": false, + "display_name": "Language Model", + "dynamic": false, + "info": "Language model that will run the agent.", + "input_types": [ + "LanguageModel" + ], + "list": false, + "name": "llm", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + }, + "memory": { + "advanced": true, + "display_name": "Memory", + "dynamic": false, + "info": "Whether the agent should have memory or not", + "list": false, + "name": "memory", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": true + }, + "role": { + "advanced": false, + "display_name": "Role", + "dynamic": false, + "info": "The role of the agent.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "role", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "Editor" + }, + "tools": { + "advanced": false, + "display_name": "Tools", + "dynamic": false, + "info": "Tools at agents disposal", + "input_types": [ + "Tool" + ], + "list": true, + "name": "tools", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": [] + }, + "verbose": { + "advanced": true, + "display_name": "Verbose", + "dynamic": false, + "info": "", + "list": false, + "name": "verbose", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + } + } + }, + "type": "CrewAIAgentComponent" + }, + "dragging": false, + "height": 665, + "id": "CrewAIAgentComponent-ZI1XE", + "position": { + "x": -566.581107287448, + "y": -551.0185388065037 + }, + "positionAbsolute": { + "x": -566.581107287448, + "y": -551.0185388065037 + }, + "selected": false, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "description": "Represents an agent of CrewAI.", + "display_name": "CrewAI Agent", + "id": "CrewAIAgentComponent-9ZavD", + "node": { + "base_classes": [ + "Agent" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": {}, + "description": "Represents an agent of CrewAI.", + "display_name": "CrewAI Agent", + "documentation": "https://docs.crewai.com/how-to/LLM-Connections/", + "edited": false, + "field_order": [ + "role", + "goal", + "backstory", + "tools", + "llm", + "memory", + "verbose", + "allow_delegation", + "allow_code_execution", + "kwargs" + ], + "frozen": false, + "icon": "CrewAI", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Agent", + "method": "build_output", + "name": "output", + "selected": "Agent", + "types": [ + "Agent" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "allow_code_execution": { + "advanced": true, + "display_name": "Allow Code Execution", + "dynamic": false, + "info": "Whether the agent is allowed to execute code.", + "list": false, + "name": "allow_code_execution", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + }, + "allow_delegation": { + "advanced": false, + "display_name": "Allow Delegation", + "dynamic": false, + "info": "Whether the agent is allowed to delegate tasks to other agents.", + "list": false, + "load_from_db": false, + "name": "allow_delegation", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + }, + "backstory": { + "advanced": false, + "display_name": "Backstory", + "dynamic": false, + "info": "The backstory of the agent.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "backstory", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "Your formal occupation is Comedian-in-Chief. You write jokes, do standup comedy and write funny articles." + }, + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from crewai import Agent # type: ignore\n\nfrom langflow.custom import Component\nfrom langflow.io import BoolInput, DictInput, HandleInput, MessageTextInput, Output\n\n\nclass CrewAIAgentComponent(Component):\n display_name = \"CrewAI Agent\"\n description = \"Represents an agent of CrewAI.\"\n documentation: str = \"https://docs.crewai.com/how-to/LLM-Connections/\"\n icon = \"CrewAI\"\n\n inputs = [\n MessageTextInput(name=\"role\", display_name=\"Role\", info=\"The role of the agent.\"),\n MessageTextInput(name=\"goal\", display_name=\"Goal\", info=\"The objective of the agent.\"),\n MessageTextInput(name=\"backstory\", display_name=\"Backstory\", info=\"The backstory of the agent.\"),\n HandleInput(\n name=\"tools\",\n display_name=\"Tools\",\n input_types=[\"Tool\"],\n is_list=True,\n info=\"Tools at agents disposal\",\n value=[],\n ),\n HandleInput(\n name=\"llm\",\n display_name=\"Language Model\",\n info=\"Language model that will run the agent.\",\n input_types=[\"LanguageModel\"],\n ),\n BoolInput(\n name=\"memory\",\n display_name=\"Memory\",\n info=\"Whether the agent should have memory or not\",\n advanced=True,\n value=True,\n ),\n BoolInput(\n name=\"verbose\",\n display_name=\"Verbose\",\n advanced=True,\n value=False,\n ),\n BoolInput(\n name=\"allow_delegation\",\n display_name=\"Allow Delegation\",\n info=\"Whether the agent is allowed to delegate tasks to other agents.\",\n value=True,\n ),\n BoolInput(\n name=\"allow_code_execution\",\n display_name=\"Allow Code Execution\",\n info=\"Whether the agent is allowed to execute code.\",\n value=False,\n advanced=True,\n ),\n DictInput(\n name=\"kwargs\",\n display_name=\"kwargs\",\n info=\"kwargs of agent.\",\n is_list=True,\n advanced=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Agent\", name=\"output\", method=\"build_output\"),\n ]\n\n def build_output(self) -> Agent:\n kwargs = self.kwargs if self.kwargs else {}\n agent = Agent(\n role=self.role,\n goal=self.goal,\n backstory=self.backstory,\n llm=self.llm,\n verbose=self.verbose,\n memory=self.memory,\n tools=self.tools if self.tools else [],\n allow_delegation=self.allow_delegation,\n allow_code_execution=self.allow_code_execution,\n **kwargs,\n )\n self.status = repr(agent)\n return agent\n" + }, + "goal": { + "advanced": false, + "display_name": "Goal", + "dynamic": false, + "info": "The objective of the agent.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "goal", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "You write comedic content based on the information provided by the editor." + }, + "kwargs": { + "advanced": true, + "display_name": "kwargs", + "dynamic": false, + "info": "kwargs of agent.", + "list": true, + "name": "kwargs", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "type": "dict", + "value": {} + }, + "llm": { + "advanced": false, + "display_name": "Language Model", + "dynamic": false, + "info": "Language model that will run the agent.", + "input_types": [ + "LanguageModel" + ], + "list": false, + "name": "llm", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": "" + }, + "memory": { + "advanced": true, + "display_name": "Memory", + "dynamic": false, + "info": "Whether the agent should have memory or not", + "list": false, + "name": "memory", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": true + }, + "role": { + "advanced": false, + "display_name": "Role", + "dynamic": false, + "info": "The role of the agent.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "role", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "Comedian" + }, + "tools": { + "advanced": false, + "display_name": "Tools", + "dynamic": false, + "info": "Tools at agents disposal", + "input_types": [ + "Tool" + ], + "list": true, + "name": "tools", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "other", + "value": [] + }, + "verbose": { + "advanced": true, + "display_name": "Verbose", + "dynamic": false, + "info": "", + "list": false, + "name": "verbose", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + } + } + }, + "type": "CrewAIAgentComponent" + }, + "dragging": false, + "height": 665, + "id": "CrewAIAgentComponent-9ZavD", + "position": { + "x": 384.54483643099843, + "y": -561.9446476261819 + }, + "positionAbsolute": { + "x": 384.54483643099843, + "y": -561.9446476261819 + }, + "selected": false, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "id": "OpenAIModel-YZz0B", + "node": { + "base_classes": [ + "LanguageModel", + "Message" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": {}, + "description": "Generates text using OpenAI LLMs.", + "display_name": "OpenAI", + "documentation": "", + "edited": false, + "field_order": [ + "input_value", + "max_tokens", + "model_kwargs", + "json_mode", + "output_schema", + "model_name", + "openai_api_base", + "openai_api_key", + "temperature", + "stream", + "system_message", + "seed" + ], + "frozen": false, + "icon": "OpenAI", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Text", + "method": "text_response", + "name": "text_output", + "selected": "Message", + "types": [ + "Message" + ], + "value": "__UNDEFINED__" + }, + { + "cache": true, + "display_name": "Language Model", + "method": "build_model", + "name": "model_output", + "selected": "LanguageModel", + "types": [ + "LanguageModel" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "import operator\nfrom functools import reduce\n\nfrom langchain_openai import ChatOpenAI\nfrom pydantic.v1 import SecretStr\n\nfrom langflow.base.constants import STREAM_INFO_TEXT\nfrom langflow.base.models.model import LCModelComponent\nfrom langflow.base.models.openai_constants import MODEL_NAMES\nfrom langflow.field_typing import LanguageModel\nfrom langflow.inputs import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageInput,\n SecretStrInput,\n StrInput,\n)\n\n\nclass OpenAIModelComponent(LCModelComponent):\n display_name = \"OpenAI\"\n description = \"Generates text using OpenAI LLMs.\"\n icon = \"OpenAI\"\n name = \"OpenAIModel\"\n\n inputs = [\n MessageInput(name=\"input_value\", display_name=\"Input\"),\n IntInput(\n name=\"max_tokens\",\n display_name=\"Max Tokens\",\n advanced=True,\n info=\"The maximum number of tokens to generate. Set to 0 for unlimited tokens.\",\n ),\n DictInput(name=\"model_kwargs\", display_name=\"Model Kwargs\", advanced=True),\n BoolInput(\n name=\"json_mode\",\n display_name=\"JSON Mode\",\n advanced=True,\n info=\"If True, it will output JSON regardless of passing a schema.\",\n ),\n DictInput(\n name=\"output_schema\",\n is_list=True,\n display_name=\"Schema\",\n advanced=True,\n info=\"The schema for the Output of the model. You must pass the word JSON in the prompt. If left blank, JSON mode will be disabled.\",\n ),\n DropdownInput(\n name=\"model_name\", display_name=\"Model Name\", advanced=False, options=MODEL_NAMES, value=MODEL_NAMES[0]\n ),\n StrInput(\n name=\"openai_api_base\",\n display_name=\"OpenAI API Base\",\n advanced=True,\n info=\"The base URL of the OpenAI API. Defaults to https://api.openai.com/v1. You can change this to use other APIs like JinaChat, LocalAI and Prem.\",\n ),\n SecretStrInput(\n name=\"openai_api_key\",\n display_name=\"OpenAI API Key\",\n info=\"The OpenAI API Key to use for the OpenAI model.\",\n advanced=False,\n value=\"OPENAI_API_KEY\",\n ),\n FloatInput(name=\"temperature\", display_name=\"Temperature\", value=0.1),\n BoolInput(name=\"stream\", display_name=\"Stream\", info=STREAM_INFO_TEXT, advanced=True),\n StrInput(\n name=\"system_message\",\n display_name=\"System Message\",\n info=\"System message to pass to the model.\",\n advanced=True,\n ),\n IntInput(\n name=\"seed\",\n display_name=\"Seed\",\n info=\"The seed controls the reproducibility of the job.\",\n advanced=True,\n value=1,\n ),\n ]\n\n def build_model(self) -> LanguageModel: # type: ignore[type-var]\n # self.output_schea is a list of dictionarie s\n # let's convert it to a dictionary\n output_schema_dict: dict[str, str] = reduce(operator.ior, self.output_schema or {}, {})\n openai_api_key = self.openai_api_key\n temperature = self.temperature\n model_name: str = self.model_name\n max_tokens = self.max_tokens\n model_kwargs = self.model_kwargs or {}\n openai_api_base = self.openai_api_base or \"https://api.openai.com/v1\"\n json_mode = bool(output_schema_dict) or self.json_mode\n seed = self.seed\n model_kwargs[\"seed\"] = seed\n\n if openai_api_key:\n api_key = SecretStr(openai_api_key)\n else:\n api_key = None\n output = ChatOpenAI(\n max_tokens=max_tokens or None,\n model_kwargs=model_kwargs,\n model=model_name,\n base_url=openai_api_base,\n api_key=api_key,\n temperature=temperature or 0.1,\n )\n if json_mode:\n if output_schema_dict:\n output = output.with_structured_output(schema=output_schema_dict, method=\"json_mode\") # type: ignore\n else:\n output = output.bind(response_format={\"type\": \"json_object\"}) # type: ignore\n\n return output # type: ignore\n\n def _get_exception_message(self, e: Exception):\n \"\"\"\n Get a message from an OpenAI exception.\n\n Args:\n exception (Exception): The exception to get the message from.\n\n Returns:\n str: The message from the exception.\n \"\"\"\n\n try:\n from openai import BadRequestError\n except ImportError:\n return\n if isinstance(e, BadRequestError):\n message = e.body.get(\"message\") # type: ignore\n if message:\n return message\n return\n" + }, + "input_value": { + "advanced": false, + "display_name": "Input", + "dynamic": false, + "info": "", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "input_value", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "" + }, + "json_mode": { + "advanced": true, + "display_name": "JSON Mode", + "dynamic": false, + "info": "If True, it will output JSON regardless of passing a schema.", + "list": false, + "name": "json_mode", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + }, + "max_tokens": { + "advanced": true, + "display_name": "Max Tokens", + "dynamic": false, + "info": "The maximum number of tokens to generate. Set to 0 for unlimited tokens.", + "list": false, + "name": "max_tokens", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "int", + "value": "" + }, + "model_kwargs": { + "advanced": true, + "display_name": "Model Kwargs", + "dynamic": false, + "info": "", + "list": false, + "name": "model_kwargs", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "type": "dict", + "value": {} + }, + "model_name": { + "advanced": false, + "display_name": "Model Name", + "dynamic": false, + "info": "", + "name": "model_name", + "options": [ + "gpt-4o", + "gpt-4-turbo", + "gpt-4-turbo-preview", + "gpt-4", + "gpt-3.5-turbo", + "gpt-3.5-turbo-0125" + ], + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "str", + "value": "gpt-3.5-turbo" + }, + "openai_api_base": { + "advanced": true, + "display_name": "OpenAI API Base", + "dynamic": false, + "info": "The base URL of the OpenAI API. Defaults to https://api.openai.com/v1. You can change this to use other APIs like JinaChat, LocalAI and Prem.", + "list": false, + "load_from_db": false, + "name": "openai_api_base", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "str", + "value": "" + }, + "openai_api_key": { + "advanced": false, + "display_name": "OpenAI API Key", + "dynamic": false, + "info": "The OpenAI API Key to use for the OpenAI model.", + "input_types": [], + "load_from_db": true, + "name": "openai_api_key", + "password": true, + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "type": "str", + "value": "" + }, + "output_schema": { + "advanced": true, + "display_name": "Schema", + "dynamic": false, + "info": "The schema for the Output of the model. You must pass the word JSON in the prompt. If left blank, JSON mode will be disabled.", + "list": true, + "name": "output_schema", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "type": "dict", + "value": {} + }, + "seed": { + "advanced": true, + "display_name": "Seed", + "dynamic": false, + "info": "The seed controls the reproducibility of the job.", + "list": false, + "name": "seed", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "int", + "value": 1 + }, + "stream": { + "advanced": true, + "display_name": "Stream", + "dynamic": false, + "info": "Stream the response from the model. Streaming works only in Chat.", + "list": false, + "name": "stream", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": false + }, + "system_message": { + "advanced": true, + "display_name": "System Message", + "dynamic": false, + "info": "System message to pass to the model.", + "list": false, + "load_from_db": false, + "name": "system_message", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "str", + "value": "" + }, + "temperature": { + "advanced": false, + "display_name": "Temperature", + "dynamic": false, + "info": "", + "list": false, + "name": "temperature", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "float", + "value": 0.1 + } + } + }, + "type": "OpenAIModel" + }, + "dragging": false, + "height": 623, + "id": "OpenAIModel-YZz0B", + "position": { + "x": -2154.0102660814805, + "y": 154.82377091716774 + }, + "positionAbsolute": { + "x": -2154.0102660814805, + "y": 154.82377091716774 + }, + "selected": false, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "id": "SearchAPITool-4sF7a", + "node": { + "base_classes": [ + "BaseTool", + "Generic", + "object", + "Runnable", + "RunnableSerializable", + "Serializable", + "Tool" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": { + "api_key": null, + "engine": null + }, + "description": "Real-time search engine results API.", + "display_name": "SearchApi Tool", + "documentation": "https://www.searchapi.io/docs/google", + "edited": false, + "field_order": [ + "engine", + "api_key" + ], + "frozen": false, + "output_types": [ + "Tool" + ], + "outputs": [ + { + "cache": true, + "display_name": "Tool", + "hidden": null, + "method": null, + "name": "tool", + "selected": "Tool", + "types": [ + "Tool" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "CustomComponent", + "api_key": { + "advanced": false, + "display_name": "API Key", + "dynamic": false, + "fileTypes": [], + "file_path": "", + "info": "The API key to use SearchApi.", + "input_types": [ + "Text" + ], + "list": false, + "load_from_db": false, + "multiline": false, + "name": "api_key", + "password": true, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "str", + "value": "" + }, + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from langchain_community.tools.searchapi import SearchAPIRun\nfrom langchain_community.utilities.searchapi import SearchApiAPIWrapper\n\nfrom langflow.custom import CustomComponent\nfrom langflow.field_typing import Tool\n\n\nclass SearchApiToolComponent(CustomComponent):\n display_name: str = \"SearchApi Tool\"\n description: str = \"Real-time search engine results API.\"\n name = \"SearchAPITool\"\n documentation: str = \"https://www.searchapi.io/docs/google\"\n field_config = {\n \"engine\": {\n \"display_name\": \"Engine\",\n \"field_type\": \"str\",\n \"info\": \"The search engine to use.\",\n },\n \"api_key\": {\n \"display_name\": \"API Key\",\n \"field_type\": \"str\",\n \"required\": True,\n \"password\": True,\n \"info\": \"The API key to use SearchApi.\",\n },\n }\n\n def build(\n self,\n engine: str,\n api_key: str,\n ) -> Tool:\n search_api_wrapper = SearchApiAPIWrapper(engine=engine, searchapi_api_key=api_key)\n\n tool = SearchAPIRun(api_wrapper=search_api_wrapper)\n\n self.status = tool\n return tool # type: ignore\n" + }, + "engine": { + "advanced": false, + "display_name": "Engine", + "dynamic": false, + "fileTypes": [], + "file_path": "", + "info": "The search engine to use.", + "input_types": [ + "Text" + ], + "list": false, + "load_from_db": false, + "multiline": false, + "name": "engine", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "str", + "value": "google" + } + } + }, + "type": "SearchAPITool" + }, + "dragging": false, + "height": 403, + "id": "SearchAPITool-4sF7a", + "position": { + "x": -2142.8478081037765, + "y": -701.328955947928 + }, + "positionAbsolute": { + "x": -2142.8478081037765, + "y": -701.328955947928 + }, + "selected": false, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "description": "Display a chat message in the Playground.", + "display_name": "Chat Output", + "id": "ChatOutput-ZLnhf", + "node": { + "base_classes": [ + "Message" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": {}, + "description": "Display a chat message in the Playground.", + "display_name": "Chat Output", + "documentation": "", + "edited": false, + "field_order": [ + "input_value", + "should_store_message", + "sender", + "sender_name", + "session_id", + "data_template" + ], + "frozen": false, + "icon": "ChatOutput", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Message", + "method": "message_response", + "name": "message", + "selected": "Message", + "types": [ + "Message" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from langflow.base.io.chat import ChatComponent\nfrom langflow.inputs import BoolInput\nfrom langflow.io import DropdownInput, MessageTextInput, Output\nfrom langflow.memory import store_message\nfrom langflow.schema.message import Message\n\n\nclass ChatOutput(ChatComponent):\n display_name = \"Chat Output\"\n description = \"Display a chat message in the Playground.\"\n icon = \"ChatOutput\"\n name = \"ChatOutput\"\n\n inputs = [\n MessageTextInput(\n name=\"input_value\",\n display_name=\"Text\",\n info=\"Message to be passed as output.\",\n ),\n BoolInput(\n name=\"should_store_message\",\n display_name=\"Store Messages\",\n info=\"Store the message in the history.\",\n value=True,\n advanced=True,\n ),\n DropdownInput(\n name=\"sender\",\n display_name=\"Sender Type\",\n options=[\"Machine\", \"User\"],\n value=\"Machine\",\n advanced=True,\n info=\"Type of sender.\",\n ),\n MessageTextInput(\n name=\"sender_name\", display_name=\"Sender Name\", info=\"Name of the sender.\", value=\"AI\", advanced=True\n ),\n MessageTextInput(\n name=\"session_id\", display_name=\"Session ID\", info=\"Session ID for the message.\", advanced=True\n ),\n MessageTextInput(\n name=\"data_template\",\n display_name=\"Data Template\",\n value=\"{text}\",\n advanced=True,\n info=\"Template to convert Data to Text. If left empty, it will be dynamically set to the Data's text key.\",\n ),\n ]\n outputs = [\n Output(display_name=\"Message\", name=\"message\", method=\"message_response\"),\n ]\n\n def message_response(self) -> Message:\n message = Message(\n text=self.input_value,\n sender=self.sender,\n sender_name=self.sender_name,\n session_id=self.session_id,\n )\n if (\n self.session_id\n and isinstance(message, Message)\n and isinstance(message.text, str)\n and self.should_store_message\n ):\n store_message(\n message,\n flow_id=self.graph.flow_id,\n )\n self.message.value = message\n\n self.status = message\n return message\n" + }, + "data_template": { + "advanced": true, + "display_name": "Data Template", + "dynamic": false, + "info": "Template to convert Data to Text. If left empty, it will be dynamically set to the Data's text key.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "data_template", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "{text}" + }, + "input_value": { + "advanced": false, + "display_name": "Text", + "dynamic": false, + "info": "Message to be passed as output.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "input_value", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "" + }, + "sender": { + "advanced": true, + "display_name": "Sender Type", + "dynamic": false, + "info": "Type of sender.", + "name": "sender", + "options": [ + "Machine", + "User" + ], + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "str", + "value": "Machine" + }, + "sender_name": { + "advanced": true, + "display_name": "Sender Name", + "dynamic": false, + "info": "Name of the sender.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "sender_name", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "AI" + }, + "session_id": { + "advanced": true, + "display_name": "Session ID", + "dynamic": false, + "info": "Session ID for the message.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "session_id", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "" + }, + "should_store_message": { + "advanced": true, + "display_name": "Store Messages", + "dynamic": false, + "info": "Store the message in the history.", + "list": false, + "name": "should_store_message", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_metadata": true, + "type": "bool", + "value": true + } + } + }, + "type": "ChatOutput" + }, + "height": 309, + "id": "ChatOutput-ZLnhf", + "position": { + "x": 1938.1856451557874, + "y": 227.4117341237682 + }, + "selected": false, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "id": "TextInput-YzcB0", + "node": { + "base_classes": [ + "Message" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": {}, + "description": "Get text inputs from the Playground.", + "display_name": "Topic", + "documentation": "", + "edited": false, + "field_order": [ + "input_value" + ], + "frozen": false, + "icon": "type", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Text", + "method": "text_response", + "name": "text", + "selected": "Message", + "types": [ + "Message" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from langflow.base.io.text import TextComponent\nfrom langflow.io import MessageTextInput, Output\nfrom langflow.schema.message import Message\n\n\nclass TextInputComponent(TextComponent):\n display_name = \"Text Input\"\n description = \"Get text inputs from the Playground.\"\n icon = \"type\"\n name = \"TextInput\"\n\n inputs = [\n MessageTextInput(\n name=\"input_value\",\n display_name=\"Text\",\n info=\"Text to be passed as input.\",\n ),\n ]\n outputs = [\n Output(display_name=\"Text\", name=\"text\", method=\"text_response\"),\n ]\n\n def text_response(self) -> Message:\n message = Message(\n text=self.input_value,\n )\n return message\n" + }, + "input_value": { + "advanced": false, + "display_name": "Text", + "dynamic": false, + "info": "Text to be passed as input.", + "input_types": [ + "Message" + ], + "list": false, + "load_from_db": false, + "name": "input_value", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "trace_as_metadata": true, + "type": "str", + "value": "Agile" + } + } + }, + "type": "TextInput" + }, + "dragging": false, + "height": 309, + "id": "TextInput-YzcB0", + "position": { + "x": -2151.7161598742287, + "y": 910.3944767665381 + }, + "positionAbsolute": { + "x": -2151.7161598742287, + "y": 910.3944767665381 + }, + "selected": false, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "description": "Create a prompt template with dynamic variables.", + "display_name": "Prompt", + "id": "Prompt-lEE73", + "node": { + "base_classes": [ + "Message" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": { + "template": [ + "topic" + ] + }, + "description": "Create a prompt template with dynamic variables.", + "display_name": "Prompt", + "documentation": "", + "edited": false, + "field_order": [ + "template" + ], + "frozen": false, + "icon": "prompts", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Prompt Message", + "method": "build_prompt", + "name": "prompt", + "selected": "Message", + "types": [ + "Message" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from langflow.base.prompts.api_utils import process_prompt_template\nfrom langflow.custom import Component\nfrom langflow.io import Output, PromptInput\nfrom langflow.schema.message import Message\nfrom langflow.template.utils import update_template_values\n\n\nclass PromptComponent(Component):\n display_name: str = \"Prompt\"\n description: str = \"Create a prompt template with dynamic variables.\"\n icon = \"prompts\"\n trace_type = \"prompt\"\n name = \"Prompt\"\n\n inputs = [\n PromptInput(name=\"template\", display_name=\"Template\"),\n ]\n\n outputs = [\n Output(display_name=\"Prompt Message\", name=\"prompt\", method=\"build_prompt\"),\n ]\n\n async def build_prompt(\n self,\n ) -> Message:\n prompt = await Message.from_template_and_variables(**self._attributes)\n self.status = prompt.text\n return prompt\n\n def post_code_processing(self, new_frontend_node: dict, current_frontend_node: dict):\n \"\"\"\n This function is called after the code validation is done.\n \"\"\"\n frontend_node = super().post_code_processing(new_frontend_node, current_frontend_node)\n template = frontend_node[\"template\"][\"template\"][\"value\"]\n _ = process_prompt_template(\n template=template,\n name=\"template\",\n custom_fields=frontend_node[\"custom_fields\"],\n frontend_node_template=frontend_node[\"template\"],\n )\n # Now that template is updated, we need to grab any values that were set in the current_frontend_node\n # and update the frontend_node with those values\n update_template_values(new_template=frontend_node, previous_template=current_frontend_node[\"template\"])\n return frontend_node\n" + }, + "template": { + "advanced": false, + "display_name": "Template", + "dynamic": false, + "info": "", + "list": false, + "load_from_db": false, + "name": "template", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "type": "prompt", + "value": "Topic: {topic}\n\nBuild a document about this document." + }, + "topic": { + "advanced": false, + "display_name": "topic", + "dynamic": false, + "field_type": "str", + "fileTypes": [], + "file_path": "", + "info": "", + "input_types": [ + "Message", + "Text" + ], + "list": false, + "load_from_db": false, + "multiline": true, + "name": "topic", + "password": false, + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "type": "str", + "value": "" + } + } + }, + "type": "Prompt" + }, + "dragging": false, + "height": 423, + "id": "Prompt-lEE73", + "position": { + "x": -1604.9048763843534, + "y": 834.802255206785 + }, + "positionAbsolute": { + "x": -1604.9048763843534, + "y": 834.802255206785 + }, + "selected": false, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "description": "Create a prompt template with dynamic variables.", + "display_name": "Prompt", + "id": "Prompt-XT7vd", + "node": { + "base_classes": [ + "Message" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": { + "template": [ + "topic" + ] + }, + "description": "Create a prompt template with dynamic variables.", + "display_name": "Prompt", + "documentation": "", + "edited": false, + "field_order": [ + "template" + ], + "frozen": false, + "icon": "prompts", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Prompt Message", + "method": "build_prompt", + "name": "prompt", + "selected": "Message", + "types": [ + "Message" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from langflow.base.prompts.api_utils import process_prompt_template\nfrom langflow.custom import Component\nfrom langflow.io import Output, PromptInput\nfrom langflow.schema.message import Message\nfrom langflow.template.utils import update_template_values\n\n\nclass PromptComponent(Component):\n display_name: str = \"Prompt\"\n description: str = \"Create a prompt template with dynamic variables.\"\n icon = \"prompts\"\n trace_type = \"prompt\"\n name = \"Prompt\"\n\n inputs = [\n PromptInput(name=\"template\", display_name=\"Template\"),\n ]\n\n outputs = [\n Output(display_name=\"Prompt Message\", name=\"prompt\", method=\"build_prompt\"),\n ]\n\n async def build_prompt(\n self,\n ) -> Message:\n prompt = await Message.from_template_and_variables(**self._attributes)\n self.status = prompt.text\n return prompt\n\n def post_code_processing(self, new_frontend_node: dict, current_frontend_node: dict):\n \"\"\"\n This function is called after the code validation is done.\n \"\"\"\n frontend_node = super().post_code_processing(new_frontend_node, current_frontend_node)\n template = frontend_node[\"template\"][\"template\"][\"value\"]\n _ = process_prompt_template(\n template=template,\n name=\"template\",\n custom_fields=frontend_node[\"custom_fields\"],\n frontend_node_template=frontend_node[\"template\"],\n )\n # Now that template is updated, we need to grab any values that were set in the current_frontend_node\n # and update the frontend_node with those values\n update_template_values(new_template=frontend_node, previous_template=current_frontend_node[\"template\"])\n return frontend_node\n" + }, + "template": { + "advanced": false, + "display_name": "Template", + "dynamic": false, + "info": "", + "list": false, + "load_from_db": false, + "name": "template", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "type": "prompt", + "value": "Topic: {topic}\n\nRevise this document." + }, + "topic": { + "advanced": false, + "display_name": "topic", + "dynamic": false, + "field_type": "str", + "fileTypes": [], + "file_path": "", + "info": "", + "input_types": [ + "Message", + "Text" + ], + "list": false, + "load_from_db": false, + "multiline": true, + "name": "topic", + "password": false, + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "type": "str", + "value": "" + } + } + }, + "type": "Prompt" + }, + "dragging": false, + "height": 423, + "id": "Prompt-XT7vd", + "position": { + "x": -578.6435948714756, + "y": 880.8183199139718 + }, + "positionAbsolute": { + "x": -578.6435948714756, + "y": 880.8183199139718 + }, + "selected": false, + "type": "genericNode", + "width": 384 + }, + { + "data": { + "description": "Create a prompt template with dynamic variables.", + "display_name": "Prompt", + "id": "Prompt-NNetm", + "node": { + "base_classes": [ + "Message" + ], + "beta": false, + "conditional_paths": [], + "custom_fields": { + "template": [ + "topic" + ] + }, + "description": "Create a prompt template with dynamic variables.", + "display_name": "Prompt", + "documentation": "", + "edited": false, + "field_order": [ + "template" + ], + "frozen": false, + "icon": "prompts", + "output_types": [], + "outputs": [ + { + "cache": true, + "display_name": "Prompt Message", + "method": "build_prompt", + "name": "prompt", + "selected": "Message", + "types": [ + "Message" + ], + "value": "__UNDEFINED__" + } + ], + "pinned": false, + "template": { + "_type": "Component", + "code": { + "advanced": true, + "dynamic": true, + "fileTypes": [], + "file_path": "", + "info": "", + "list": false, + "load_from_db": false, + "multiline": true, + "name": "code", + "password": false, + "placeholder": "", + "required": true, + "show": true, + "title_case": false, + "type": "code", + "value": "from langflow.base.prompts.api_utils import process_prompt_template\nfrom langflow.custom import Component\nfrom langflow.io import Output, PromptInput\nfrom langflow.schema.message import Message\nfrom langflow.template.utils import update_template_values\n\n\nclass PromptComponent(Component):\n display_name: str = \"Prompt\"\n description: str = \"Create a prompt template with dynamic variables.\"\n icon = \"prompts\"\n trace_type = \"prompt\"\n name = \"Prompt\"\n\n inputs = [\n PromptInput(name=\"template\", display_name=\"Template\"),\n ]\n\n outputs = [\n Output(display_name=\"Prompt Message\", name=\"prompt\", method=\"build_prompt\"),\n ]\n\n async def build_prompt(\n self,\n ) -> Message:\n prompt = await Message.from_template_and_variables(**self._attributes)\n self.status = prompt.text\n return prompt\n\n def post_code_processing(self, new_frontend_node: dict, current_frontend_node: dict):\n \"\"\"\n This function is called after the code validation is done.\n \"\"\"\n frontend_node = super().post_code_processing(new_frontend_node, current_frontend_node)\n template = frontend_node[\"template\"][\"template\"][\"value\"]\n _ = process_prompt_template(\n template=template,\n name=\"template\",\n custom_fields=frontend_node[\"custom_fields\"],\n frontend_node_template=frontend_node[\"template\"],\n )\n # Now that template is updated, we need to grab any values that were set in the current_frontend_node\n # and update the frontend_node with those values\n update_template_values(new_template=frontend_node, previous_template=current_frontend_node[\"template\"])\n return frontend_node\n" + }, + "template": { + "advanced": false, + "display_name": "Template", + "dynamic": false, + "info": "", + "list": false, + "load_from_db": false, + "name": "template", + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "trace_as_input": true, + "type": "prompt", + "value": "Topic: {topic}\n\nBuild a fun blog post about this topic." + }, + "topic": { + "advanced": false, + "display_name": "topic", + "dynamic": false, + "field_type": "str", + "fileTypes": [], + "file_path": "", + "info": "", + "input_types": [ + "Message", + "Text" + ], + "list": false, + "load_from_db": false, + "multiline": true, + "name": "topic", + "password": false, + "placeholder": "", + "required": false, + "show": true, + "title_case": false, + "type": "str", + "value": "" + } + } + }, + "type": "Prompt" + }, + "dragging": false, + "height": 423, + "id": "Prompt-NNetm", + "position": { + "x": 336.06150756666204, + "y": 796.1616400043475 + }, + "positionAbsolute": { + "x": 336.06150756666204, + "y": 796.1616400043475 + }, + "selected": false, + "type": "genericNode", + "width": 384 + } + ], + "viewport": { + "x": 622.9410362103876, + "y": 286.84346969445187, + "zoom": 0.24316373685307893 + } + }, + "description": "", + "endpoint_name": null, + "id": "a826fb8b-de87-4d2d-92ef-d86e5bfd66b5", + "is_component": false, + "last_tested_version": "1.0.9", + "name": "Sequential Tasks Agent" +} \ No newline at end of file diff --git a/src/frontend/src/modals/newFlowModal/index.tsx b/src/frontend/src/modals/newFlowModal/index.tsx index f9132e308..444795a45 100644 --- a/src/frontend/src/modals/newFlowModal/index.tsx +++ b/src/frontend/src/modals/newFlowModal/index.tsx @@ -58,16 +58,18 @@ export default function NewFlowModal({ flow={examples.find((e) => e.name == "Vector Store RAG")!} /> )} - {examples.find((e) => e.name == "Sequential Agent") && ( + {examples.find((e) => e.name == "Sequential Tasks Agent") && ( e.name == "Sequential Agent")!} + flow={examples.find((e) => e.name == "Sequential Tasks Agent")!} /> )} - {examples.find((e) => e.name == "Hierarchical Agent") && ( + {examples.find((e) => e.name == "Hierarchical Tasks Agent") && ( e.name == "Hierarchical Agent")!} + flow={ + examples.find((e) => e.name == "Hierarchical Tasks Agent")! + } /> )} {examples.find((e) => e.name == "Complex Agent") && (