* Added bg background for icon on Agent * Changed system prompt description * Added toggle to node toolbar for tool mode * Removed copy from node toolbar * Fixed node last output border * Removed beta tag from agent * remove text foreground from grid * updated paginator style * Fixed pagination element disposition on main page * Fixed node icon * Removed storeComponent from pagination * removed storeComponent from paginator type * Fixed canvas dots color * Changed pagination design * fixed gap * Fix minimized state on components that have a custom icon * Fixed exibition of flow running state to not make the header jump * Fixed starter flows
2996 lines
No EOL
136 KiB
JSON
2996 lines
No EOL
136 KiB
JSON
{
|
|
"data": {
|
|
"edges": [
|
|
{
|
|
"className": "",
|
|
"data": {
|
|
"sourceHandle": {
|
|
"dataType": "HierarchicalCrewComponent",
|
|
"id": "HierarchicalCrewComponent-Y0Uvf",
|
|
"name": "output",
|
|
"output_types": [
|
|
"Message"
|
|
]
|
|
},
|
|
"targetHandle": {
|
|
"fieldName": "input_value",
|
|
"id": "ChatOutput-VzVJK",
|
|
"inputTypes": [
|
|
"Message"
|
|
],
|
|
"type": "str"
|
|
}
|
|
},
|
|
"id": "reactflow__edge-HierarchicalCrewComponent-Y0Uvf{œdataTypeœ:œHierarchicalCrewComponentœ,œidœ:œHierarchicalCrewComponent-Y0Uvfœ,œnameœ:œoutputœ,œoutput_typesœ:[œMessageœ]}-ChatOutput-VzVJK{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-VzVJKœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
|
|
"selected": false,
|
|
"source": "HierarchicalCrewComponent-Y0Uvf",
|
|
"sourceHandle": "{œdataTypeœ: œHierarchicalCrewComponentœ, œidœ: œHierarchicalCrewComponent-Y0Uvfœ, œnameœ: œoutputœ, œoutput_typesœ: [œMessageœ]}",
|
|
"target": "ChatOutput-VzVJK",
|
|
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œChatOutput-VzVJKœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"
|
|
},
|
|
{
|
|
"className": "",
|
|
"data": {
|
|
"sourceHandle": {
|
|
"dataType": "HierarchicalTaskComponent",
|
|
"id": "HierarchicalTaskComponent-hE8H5",
|
|
"name": "task_output",
|
|
"output_types": [
|
|
"HierarchicalTask"
|
|
]
|
|
},
|
|
"targetHandle": {
|
|
"fieldName": "tasks",
|
|
"id": "HierarchicalCrewComponent-Y0Uvf",
|
|
"inputTypes": [
|
|
"HierarchicalTask"
|
|
],
|
|
"type": "other"
|
|
}
|
|
},
|
|
"id": "reactflow__edge-HierarchicalTaskComponent-hE8H5{œdataTypeœ:œHierarchicalTaskComponentœ,œidœ:œHierarchicalTaskComponent-hE8H5œ,œnameœ:œtask_outputœ,œoutput_typesœ:[œHierarchicalTaskœ]}-HierarchicalCrewComponent-Y0Uvf{œfieldNameœ:œtasksœ,œidœ:œHierarchicalCrewComponent-Y0Uvfœ,œinputTypesœ:[œHierarchicalTaskœ],œtypeœ:œotherœ}",
|
|
"selected": false,
|
|
"source": "HierarchicalTaskComponent-hE8H5",
|
|
"sourceHandle": "{œdataTypeœ: œHierarchicalTaskComponentœ, œidœ: œHierarchicalTaskComponent-hE8H5œ, œnameœ: œtask_outputœ, œoutput_typesœ: [œHierarchicalTaskœ]}",
|
|
"target": "HierarchicalCrewComponent-Y0Uvf",
|
|
"targetHandle": "{œfieldNameœ: œtasksœ, œidœ: œHierarchicalCrewComponent-Y0Uvfœ, œinputTypesœ: [œHierarchicalTaskœ], œtypeœ: œotherœ}"
|
|
},
|
|
{
|
|
"className": "",
|
|
"data": {
|
|
"sourceHandle": {
|
|
"dataType": "CrewAIAgentComponent",
|
|
"id": "CrewAIAgentComponent-EbpXd",
|
|
"name": "output",
|
|
"output_types": [
|
|
"Agent"
|
|
]
|
|
},
|
|
"targetHandle": {
|
|
"fieldName": "agents",
|
|
"id": "HierarchicalCrewComponent-Y0Uvf",
|
|
"inputTypes": [
|
|
"Agent"
|
|
],
|
|
"type": "other"
|
|
}
|
|
},
|
|
"id": "reactflow__edge-CrewAIAgentComponent-EbpXd{œdataTypeœ:œCrewAIAgentComponentœ,œidœ:œCrewAIAgentComponent-EbpXdœ,œnameœ:œoutputœ,œoutput_typesœ:[œAgentœ]}-HierarchicalCrewComponent-Y0Uvf{œfieldNameœ:œagentsœ,œidœ:œHierarchicalCrewComponent-Y0Uvfœ,œinputTypesœ:[œAgentœ],œtypeœ:œotherœ}",
|
|
"selected": false,
|
|
"source": "CrewAIAgentComponent-EbpXd",
|
|
"sourceHandle": "{œdataTypeœ: œCrewAIAgentComponentœ, œidœ: œCrewAIAgentComponent-EbpXdœ, œnameœ: œoutputœ, œoutput_typesœ: [œAgentœ]}",
|
|
"target": "HierarchicalCrewComponent-Y0Uvf",
|
|
"targetHandle": "{œfieldNameœ: œagentsœ, œidœ: œHierarchicalCrewComponent-Y0Uvfœ, œinputTypesœ: [œAgentœ], œtypeœ: œotherœ}"
|
|
},
|
|
{
|
|
"className": "",
|
|
"data": {
|
|
"sourceHandle": {
|
|
"dataType": "OpenAIModel",
|
|
"id": "OpenAIModel-Yjtpu",
|
|
"name": "model_output",
|
|
"output_types": [
|
|
"LanguageModel"
|
|
]
|
|
},
|
|
"targetHandle": {
|
|
"fieldName": "llm",
|
|
"id": "CrewAIAgentComponent-EbpXd",
|
|
"inputTypes": [
|
|
"LanguageModel"
|
|
],
|
|
"type": "other"
|
|
}
|
|
},
|
|
"id": "reactflow__edge-OpenAIModel-Yjtpu{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-Yjtpuœ,œnameœ:œmodel_outputœ,œoutput_typesœ:[œLanguageModelœ]}-CrewAIAgentComponent-EbpXd{œfieldNameœ:œllmœ,œidœ:œCrewAIAgentComponent-EbpXdœ,œinputTypesœ:[œLanguageModelœ],œtypeœ:œotherœ}",
|
|
"selected": false,
|
|
"source": "OpenAIModel-Yjtpu",
|
|
"sourceHandle": "{œdataTypeœ: œOpenAIModelœ, œidœ: œOpenAIModel-Yjtpuœ, œnameœ: œmodel_outputœ, œoutput_typesœ: [œLanguageModelœ]}",
|
|
"target": "CrewAIAgentComponent-EbpXd",
|
|
"targetHandle": "{œfieldNameœ: œllmœ, œidœ: œCrewAIAgentComponent-EbpXdœ, œinputTypesœ: [œLanguageModelœ], œtypeœ: œotherœ}"
|
|
},
|
|
{
|
|
"className": "",
|
|
"data": {
|
|
"sourceHandle": {
|
|
"dataType": "CrewAIAgentComponent",
|
|
"id": "CrewAIAgentComponent-9D8ao",
|
|
"name": "output",
|
|
"output_types": [
|
|
"Agent"
|
|
]
|
|
},
|
|
"targetHandle": {
|
|
"fieldName": "manager_agent",
|
|
"id": "HierarchicalCrewComponent-Y0Uvf",
|
|
"inputTypes": [
|
|
"Agent"
|
|
],
|
|
"type": "other"
|
|
}
|
|
},
|
|
"id": "reactflow__edge-CrewAIAgentComponent-9D8ao{œdataTypeœ:œCrewAIAgentComponentœ,œidœ:œCrewAIAgentComponent-9D8aoœ,œnameœ:œoutputœ,œoutput_typesœ:[œAgentœ]}-HierarchicalCrewComponent-Y0Uvf{œfieldNameœ:œmanager_agentœ,œidœ:œHierarchicalCrewComponent-Y0Uvfœ,œinputTypesœ:[œAgentœ],œtypeœ:œotherœ}",
|
|
"selected": false,
|
|
"source": "CrewAIAgentComponent-9D8ao",
|
|
"sourceHandle": "{œdataTypeœ: œCrewAIAgentComponentœ, œidœ: œCrewAIAgentComponent-9D8aoœ, œnameœ: œoutputœ, œoutput_typesœ: [œAgentœ]}",
|
|
"target": "HierarchicalCrewComponent-Y0Uvf",
|
|
"targetHandle": "{œfieldNameœ: œmanager_agentœ, œidœ: œHierarchicalCrewComponent-Y0Uvfœ, œinputTypesœ: [œAgentœ], œtypeœ: œotherœ}"
|
|
},
|
|
{
|
|
"className": "",
|
|
"data": {
|
|
"sourceHandle": {
|
|
"dataType": "OpenAIModel",
|
|
"id": "OpenAIModel-HgNnu",
|
|
"name": "model_output",
|
|
"output_types": [
|
|
"LanguageModel"
|
|
]
|
|
},
|
|
"targetHandle": {
|
|
"fieldName": "llm",
|
|
"id": "CrewAIAgentComponent-9D8ao",
|
|
"inputTypes": [
|
|
"LanguageModel"
|
|
],
|
|
"type": "other"
|
|
}
|
|
},
|
|
"id": "reactflow__edge-OpenAIModel-HgNnu{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-HgNnuœ,œnameœ:œmodel_outputœ,œoutput_typesœ:[œLanguageModelœ]}-CrewAIAgentComponent-9D8ao{œfieldNameœ:œllmœ,œidœ:œCrewAIAgentComponent-9D8aoœ,œinputTypesœ:[œLanguageModelœ],œtypeœ:œotherœ}",
|
|
"selected": false,
|
|
"source": "OpenAIModel-HgNnu",
|
|
"sourceHandle": "{œdataTypeœ: œOpenAIModelœ, œidœ: œOpenAIModel-HgNnuœ, œnameœ: œmodel_outputœ, œoutput_typesœ: [œLanguageModelœ]}",
|
|
"target": "CrewAIAgentComponent-9D8ao",
|
|
"targetHandle": "{œfieldNameœ: œllmœ, œidœ: œCrewAIAgentComponent-9D8aoœ, œinputTypesœ: [œLanguageModelœ], œtypeœ: œotherœ}"
|
|
},
|
|
{
|
|
"className": "",
|
|
"data": {
|
|
"sourceHandle": {
|
|
"dataType": "Prompt",
|
|
"id": "Prompt-eqGhn",
|
|
"name": "prompt",
|
|
"output_types": [
|
|
"Message"
|
|
]
|
|
},
|
|
"targetHandle": {
|
|
"fieldName": "task_description",
|
|
"id": "HierarchicalTaskComponent-hE8H5",
|
|
"inputTypes": [
|
|
"Message"
|
|
],
|
|
"type": "str"
|
|
}
|
|
},
|
|
"id": "reactflow__edge-Prompt-eqGhn{œdataTypeœ:œPromptœ,œidœ:œPrompt-eqGhnœ,œnameœ:œpromptœ,œoutput_typesœ:[œMessageœ]}-HierarchicalTaskComponent-hE8H5{œfieldNameœ:œtask_descriptionœ,œidœ:œHierarchicalTaskComponent-hE8H5œ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
|
|
"source": "Prompt-eqGhn",
|
|
"sourceHandle": "{œdataTypeœ: œPromptœ, œidœ: œPrompt-eqGhnœ, œnameœ: œpromptœ, œoutput_typesœ: [œMessageœ]}",
|
|
"target": "HierarchicalTaskComponent-hE8H5",
|
|
"targetHandle": "{œfieldNameœ: œtask_descriptionœ, œidœ: œHierarchicalTaskComponent-hE8H5œ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"
|
|
},
|
|
{
|
|
"className": "",
|
|
"data": {
|
|
"sourceHandle": {
|
|
"dataType": "ChatInput",
|
|
"id": "ChatInput-xgRl9",
|
|
"name": "message",
|
|
"output_types": [
|
|
"Message"
|
|
]
|
|
},
|
|
"targetHandle": {
|
|
"fieldName": "query",
|
|
"id": "Prompt-eqGhn",
|
|
"inputTypes": [
|
|
"Message",
|
|
"Text"
|
|
],
|
|
"type": "str"
|
|
}
|
|
},
|
|
"id": "reactflow__edge-ChatInput-xgRl9{œdataTypeœ:œChatInputœ,œidœ:œChatInput-xgRl9œ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}-Prompt-eqGhn{œfieldNameœ:œqueryœ,œidœ:œPrompt-eqGhnœ,œinputTypesœ:[œMessageœ,œTextœ],œtypeœ:œstrœ}",
|
|
"source": "ChatInput-xgRl9",
|
|
"sourceHandle": "{œdataTypeœ: œChatInputœ, œidœ: œChatInput-xgRl9œ, œnameœ: œmessageœ, œoutput_typesœ: [œMessageœ]}",
|
|
"target": "Prompt-eqGhn",
|
|
"targetHandle": "{œfieldNameœ: œqueryœ, œidœ: œPrompt-eqGhnœ, œinputTypesœ: [œMessageœ, œTextœ], œtypeœ: œstrœ}"
|
|
},
|
|
{
|
|
"className": "",
|
|
"data": {
|
|
"sourceHandle": {
|
|
"dataType": "CrewAIAgentComponent",
|
|
"id": "CrewAIAgentComponent-UMpxO",
|
|
"name": "output",
|
|
"output_types": [
|
|
"Agent"
|
|
]
|
|
},
|
|
"targetHandle": {
|
|
"fieldName": "agents",
|
|
"id": "HierarchicalCrewComponent-Y0Uvf",
|
|
"inputTypes": [
|
|
"Agent"
|
|
],
|
|
"type": "other"
|
|
}
|
|
},
|
|
"id": "reactflow__edge-CrewAIAgentComponent-UMpxO{œdataTypeœ:œCrewAIAgentComponentœ,œidœ:œCrewAIAgentComponent-UMpxOœ,œnameœ:œoutputœ,œoutput_typesœ:[œAgentœ]}-HierarchicalCrewComponent-Y0Uvf{œfieldNameœ:œagentsœ,œidœ:œHierarchicalCrewComponent-Y0Uvfœ,œinputTypesœ:[œAgentœ],œtypeœ:œotherœ}",
|
|
"source": "CrewAIAgentComponent-UMpxO",
|
|
"sourceHandle": "{œdataTypeœ: œCrewAIAgentComponentœ, œidœ: œCrewAIAgentComponent-UMpxOœ, œnameœ: œoutputœ, œoutput_typesœ: [œAgentœ]}",
|
|
"target": "HierarchicalCrewComponent-Y0Uvf",
|
|
"targetHandle": "{œfieldNameœ: œagentsœ, œidœ: œHierarchicalCrewComponent-Y0Uvfœ, œinputTypesœ: [œAgentœ], œtypeœ: œotherœ}"
|
|
},
|
|
{
|
|
"className": "",
|
|
"data": {
|
|
"sourceHandle": {
|
|
"dataType": "OpenAIModel",
|
|
"id": "OpenAIModel-Yjtpu",
|
|
"name": "model_output",
|
|
"output_types": [
|
|
"LanguageModel"
|
|
]
|
|
},
|
|
"targetHandle": {
|
|
"fieldName": "llm",
|
|
"id": "CrewAIAgentComponent-UMpxO",
|
|
"inputTypes": [
|
|
"LanguageModel"
|
|
],
|
|
"type": "other"
|
|
}
|
|
},
|
|
"id": "reactflow__edge-OpenAIModel-Yjtpu{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-Yjtpuœ,œnameœ:œmodel_outputœ,œoutput_typesœ:[œLanguageModelœ]}-CrewAIAgentComponent-UMpxO{œfieldNameœ:œllmœ,œidœ:œCrewAIAgentComponent-UMpxOœ,œinputTypesœ:[œLanguageModelœ],œtypeœ:œotherœ}",
|
|
"source": "OpenAIModel-Yjtpu",
|
|
"sourceHandle": "{œdataTypeœ: œOpenAIModelœ, œidœ: œOpenAIModel-Yjtpuœ, œnameœ: œmodel_outputœ, œoutput_typesœ: [œLanguageModelœ]}",
|
|
"target": "CrewAIAgentComponent-UMpxO",
|
|
"targetHandle": "{œfieldNameœ: œllmœ, œidœ: œCrewAIAgentComponent-UMpxOœ, œinputTypesœ: [œLanguageModelœ], œtypeœ: œotherœ}"
|
|
},
|
|
{
|
|
"className": "",
|
|
"data": {
|
|
"sourceHandle": {
|
|
"dataType": "SearchAPI",
|
|
"id": "SearchAPI-Yokat",
|
|
"name": "api_build_tool",
|
|
"output_types": [
|
|
"Tool"
|
|
]
|
|
},
|
|
"targetHandle": {
|
|
"fieldName": "tools",
|
|
"id": "CrewAIAgentComponent-EbpXd",
|
|
"inputTypes": [
|
|
"Tool"
|
|
],
|
|
"type": "other"
|
|
}
|
|
},
|
|
"id": "reactflow__edge-SearchAPI-Yokat{œdataTypeœ:œSearchAPIœ,œidœ:œSearchAPI-Yokatœ,œnameœ:œapi_build_toolœ,œoutput_typesœ:[œToolœ]}-CrewAIAgentComponent-EbpXd{œfieldNameœ:œtoolsœ,œidœ:œCrewAIAgentComponent-EbpXdœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}",
|
|
"source": "SearchAPI-Yokat",
|
|
"sourceHandle": "{œdataTypeœ: œSearchAPIœ, œidœ: œSearchAPI-Yokatœ, œnameœ: œapi_build_toolœ, œoutput_typesœ: [œToolœ]}",
|
|
"target": "CrewAIAgentComponent-EbpXd",
|
|
"targetHandle": "{œfieldNameœ: œtoolsœ, œidœ: œCrewAIAgentComponent-EbpXdœ, œinputTypesœ: [œToolœ], œtypeœ: œotherœ}"
|
|
}
|
|
],
|
|
"nodes": [
|
|
{
|
|
"data": {
|
|
"description": "Represents a group of agents, defining how they should collaborate and the tasks they should perform.",
|
|
"display_name": "Hierarchical Crew",
|
|
"id": "HierarchicalCrewComponent-Y0Uvf",
|
|
"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": "Hierarchical Crew",
|
|
"documentation": "",
|
|
"edited": false,
|
|
"field_order": [
|
|
"verbose",
|
|
"memory",
|
|
"use_cache",
|
|
"max_rpm",
|
|
"share_crew",
|
|
"function_calling_llm",
|
|
"agents",
|
|
"tasks",
|
|
"manager_llm",
|
|
"manager_agent"
|
|
],
|
|
"frozen": false,
|
|
"icon": "CrewAI",
|
|
"legacy": false,
|
|
"metadata": {},
|
|
"output_types": [],
|
|
"outputs": [
|
|
{
|
|
"cache": true,
|
|
"display_name": "Output",
|
|
"method": "build_output",
|
|
"name": "output",
|
|
"required_inputs": [],
|
|
"selected": "Message",
|
|
"types": [
|
|
"Message"
|
|
],
|
|
"value": "__UNDEFINED__"
|
|
}
|
|
],
|
|
"pinned": false,
|
|
"template": {
|
|
"_type": "Component",
|
|
"agents": {
|
|
"advanced": false,
|
|
"display_name": "Agents",
|
|
"dynamic": false,
|
|
"info": "",
|
|
"input_types": [
|
|
"Agent"
|
|
],
|
|
"list": true,
|
|
"name": "agents",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_metadata": true,
|
|
"type": "other",
|
|
"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 crewai import Crew, Process\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 documentation: str = \"https://docs.crewai.com/how-to/Hierarchical/\"\n icon = \"CrewAI\"\n\n inputs = [\n *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 return 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"
|
|
},
|
|
"function_calling_llm": {
|
|
"advanced": true,
|
|
"display_name": "Function Calling LLM",
|
|
"dynamic": false,
|
|
"info": "Turns the ReAct CrewAI agent into a function-calling agent",
|
|
"input_types": [
|
|
"LanguageModel"
|
|
],
|
|
"list": false,
|
|
"name": "function_calling_llm",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_metadata": true,
|
|
"type": "other",
|
|
"value": ""
|
|
},
|
|
"manager_agent": {
|
|
"advanced": false,
|
|
"display_name": "Manager Agent",
|
|
"dynamic": false,
|
|
"info": "",
|
|
"input_types": [
|
|
"Agent"
|
|
],
|
|
"list": false,
|
|
"name": "manager_agent",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_metadata": true,
|
|
"type": "other",
|
|
"value": ""
|
|
},
|
|
"manager_llm": {
|
|
"advanced": false,
|
|
"display_name": "Manager LLM",
|
|
"dynamic": false,
|
|
"info": "",
|
|
"input_types": [
|
|
"LanguageModel"
|
|
],
|
|
"list": false,
|
|
"name": "manager_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": [
|
|
"HierarchicalTask"
|
|
],
|
|
"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": "HierarchicalCrewComponent"
|
|
},
|
|
"dragging": false,
|
|
"height": 516,
|
|
"id": "HierarchicalCrewComponent-Y0Uvf",
|
|
"position": {
|
|
"x": 568,
|
|
"y": 352.296875
|
|
},
|
|
"selected": false,
|
|
"type": "genericNode",
|
|
"width": 432
|
|
},
|
|
{
|
|
"data": {
|
|
"description": "Generates text using OpenAI LLMs.",
|
|
"display_name": "OpenAI",
|
|
"id": "OpenAIModel-Yjtpu",
|
|
"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",
|
|
"system_message",
|
|
"stream",
|
|
"max_tokens",
|
|
"model_kwargs",
|
|
"json_mode",
|
|
"output_schema",
|
|
"model_name",
|
|
"openai_api_base",
|
|
"api_key",
|
|
"temperature",
|
|
"seed"
|
|
],
|
|
"frozen": false,
|
|
"icon": "OpenAI",
|
|
"legacy": false,
|
|
"metadata": {},
|
|
"output_types": [],
|
|
"outputs": [
|
|
{
|
|
"cache": true,
|
|
"display_name": "Text",
|
|
"method": "text_response",
|
|
"name": "text_output",
|
|
"required_inputs": [],
|
|
"selected": "Message",
|
|
"types": [
|
|
"Message"
|
|
],
|
|
"value": "__UNDEFINED__"
|
|
},
|
|
{
|
|
"cache": true,
|
|
"display_name": "Language Model",
|
|
"method": "build_model",
|
|
"name": "model_output",
|
|
"required_inputs": [],
|
|
"selected": "LanguageModel",
|
|
"types": [
|
|
"LanguageModel"
|
|
],
|
|
"value": "__UNDEFINED__"
|
|
}
|
|
],
|
|
"pinned": false,
|
|
"template": {
|
|
"_type": "Component",
|
|
"api_key": {
|
|
"advanced": false,
|
|
"display_name": "OpenAI API Key",
|
|
"dynamic": false,
|
|
"info": "The OpenAI API Key to use for the OpenAI model.",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"load_from_db": true,
|
|
"name": "api_key",
|
|
"password": true,
|
|
"placeholder": "",
|
|
"required": false,
|
|
"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": "import operator\nfrom functools import reduce\n\nfrom langchain_openai import ChatOpenAI\nfrom pydantic.v1 import SecretStr\n\nfrom langflow.base.models.model import LCModelComponent\nfrom langflow.base.models.openai_constants import OPENAI_MODEL_NAMES\nfrom langflow.field_typing import LanguageModel\nfrom langflow.field_typing.range_spec import RangeSpec\nfrom langflow.inputs import BoolInput, DictInput, DropdownInput, FloatInput, IntInput, SecretStrInput, StrInput\nfrom langflow.inputs.inputs import HandleInput\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 *LCModelComponent._base_inputs,\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 range_spec=RangeSpec(min=0, max=128000),\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=\"Additional keyword arguments to pass to the model.\",\n ),\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. \"\n \"You must pass the word JSON in the prompt. \"\n \"If left blank, JSON mode will be disabled. [DEPRECATED]\",\n ),\n DropdownInput(\n name=\"model_name\",\n display_name=\"Model Name\",\n advanced=False,\n options=OPENAI_MODEL_NAMES,\n value=OPENAI_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. \"\n \"Defaults to https://api.openai.com/v1. \"\n \"You can change this to use other APIs like JinaChat, LocalAI and Prem.\",\n ),\n SecretStrInput(\n name=\"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 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 HandleInput(\n name=\"output_parser\",\n display_name=\"Output Parser\",\n info=\"The parser to use to parse the output of the model\",\n advanced=True,\n input_types=[\"OutputParser\"],\n ),\n ]\n\n def build_model(self) -> LanguageModel: # type: ignore[type-var]\n # self.output_schema is a list of dictionaries\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.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\n api_key = SecretStr(openai_api_key).get_secret_value() if openai_api_key else 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 if temperature is not None else 0.1,\n seed=seed,\n )\n if json_mode:\n if output_schema_dict:\n output = output.with_structured_output(schema=output_schema_dict, method=\"json_mode\")\n else:\n output = output.bind(response_format={\"type\": \"json_object\"})\n\n return output\n\n def _get_exception_message(self, e: Exception):\n \"\"\"Get a message from an OpenAI exception.\n\n Args:\n e (Exception): The exception to get the message from.\n\n Returns:\n str: The message from the exception.\n \"\"\"\n try:\n from openai import BadRequestError\n except ImportError:\n return None\n if isinstance(e, BadRequestError):\n message = e.body.get(\"message\")\n if message:\n return message\n return None\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": "Additional keyword arguments to pass to the model.",
|
|
"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": "",
|
|
"load_from_db": false,
|
|
"name": "model_name",
|
|
"options": [
|
|
"gpt-4o-mini",
|
|
"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-4o"
|
|
},
|
|
"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": ""
|
|
},
|
|
"output_parser": {
|
|
"_input_type": "HandleInput",
|
|
"advanced": true,
|
|
"display_name": "Output Parser",
|
|
"dynamic": false,
|
|
"info": "The parser to use to parse the output of the model",
|
|
"input_types": [
|
|
"OutputParser"
|
|
],
|
|
"list": false,
|
|
"name": "output_parser",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_metadata": true,
|
|
"type": "other",
|
|
"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. [DEPRECATED]",
|
|
"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.",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"name": "system_message",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"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": 700,
|
|
"id": "OpenAIModel-Yjtpu",
|
|
"position": {
|
|
"x": -1222.8457213471152,
|
|
"y": 699.9983009041272
|
|
},
|
|
"positionAbsolute": {
|
|
"x": -1222.8457213471152,
|
|
"y": 699.9983009041272
|
|
},
|
|
"selected": false,
|
|
"type": "genericNode",
|
|
"width": 432
|
|
},
|
|
{
|
|
"data": {
|
|
"description": "Display a chat message in the Playground.",
|
|
"display_name": "Chat Output",
|
|
"id": "ChatOutput-VzVJK",
|
|
"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": "MessagesSquare",
|
|
"legacy": false,
|
|
"metadata": {},
|
|
"output_types": [],
|
|
"outputs": [
|
|
{
|
|
"cache": true,
|
|
"display_name": "Message",
|
|
"method": "message_response",
|
|
"name": "message",
|
|
"selected": "Message",
|
|
"types": [
|
|
"Message"
|
|
],
|
|
"value": "__UNDEFINED__"
|
|
}
|
|
],
|
|
"pinned": false,
|
|
"template": {
|
|
"_type": "Component",
|
|
"background_color": {
|
|
"_input_type": "MessageTextInput",
|
|
"advanced": true,
|
|
"display_name": "Background Color",
|
|
"dynamic": false,
|
|
"info": "The background color of the icon.",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"name": "background_color",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": ""
|
|
},
|
|
"chat_icon": {
|
|
"_input_type": "MessageTextInput",
|
|
"advanced": true,
|
|
"display_name": "Icon",
|
|
"dynamic": false,
|
|
"info": "The icon of the message.",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"name": "chat_icon",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"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 langflow.base.io.chat import ChatComponent\nfrom langflow.inputs import BoolInput\nfrom langflow.io import DropdownInput, MessageInput, MessageTextInput, Output\nfrom langflow.schema.message import Message\nfrom langflow.schema.properties import Source\nfrom langflow.utils.constants import MESSAGE_SENDER_AI, MESSAGE_SENDER_NAME_AI, MESSAGE_SENDER_USER\n\n\nclass ChatOutput(ChatComponent):\n display_name = \"Chat Output\"\n description = \"Display a chat message in the Playground.\"\n icon = \"MessagesSquare\"\n name = \"ChatOutput\"\n\n inputs = [\n MessageInput(\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=[MESSAGE_SENDER_AI, MESSAGE_SENDER_USER],\n value=MESSAGE_SENDER_AI,\n advanced=True,\n info=\"Type of sender.\",\n ),\n MessageTextInput(\n name=\"sender_name\",\n display_name=\"Sender Name\",\n info=\"Name of the sender.\",\n value=MESSAGE_SENDER_NAME_AI,\n advanced=True,\n ),\n MessageTextInput(\n name=\"session_id\",\n display_name=\"Session ID\",\n info=\"The session ID of the chat. If empty, the current session ID parameter will be used.\",\n 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 MessageTextInput(\n name=\"background_color\",\n display_name=\"Background Color\",\n info=\"The background color of the icon.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"chat_icon\",\n display_name=\"Icon\",\n info=\"The icon of the message.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"text_color\",\n display_name=\"Text Color\",\n info=\"The text color of the name\",\n advanced=True,\n ),\n ]\n outputs = [\n Output(\n display_name=\"Message\",\n name=\"message\",\n method=\"message_response\",\n ),\n ]\n\n def _build_source(self, _id: str | None, display_name: str | None, source: str | None) -> Source:\n source_dict = {}\n if _id:\n source_dict[\"id\"] = _id\n if display_name:\n source_dict[\"display_name\"] = display_name\n if source:\n source_dict[\"source\"] = source\n return Source(**source_dict)\n\n def message_response(self) -> Message:\n _source, _icon, _display_name, _source_id = self.get_properties_from_source_component()\n _background_color = self.background_color\n _text_color = self.text_color\n if self.chat_icon:\n _icon = self.chat_icon\n message = self.input_value if isinstance(self.input_value, Message) else Message(text=self.input_value)\n message.sender = self.sender\n message.sender_name = self.sender_name\n message.session_id = self.session_id\n message.flow_id = self.graph.flow_id\n message.properties.source = self._build_source(_source_id, _display_name, _source)\n message.properties.icon = _icon\n message.properties.background_color = _background_color\n message.properties.text_color = _text_color\n if self.session_id and isinstance(message, Message) and self.should_store_message:\n stored_message = self.send_message(\n message,\n )\n self.message.value = stored_message\n message = stored_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": "The session ID of the chat. If empty, the current session ID parameter will be used.",
|
|
"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
|
|
},
|
|
"text_color": {
|
|
"_input_type": "MessageTextInput",
|
|
"advanced": true,
|
|
"display_name": "Text Color",
|
|
"dynamic": false,
|
|
"info": "The text color of the name",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"name": "text_color",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": ""
|
|
}
|
|
}
|
|
},
|
|
"type": "ChatOutput"
|
|
},
|
|
"dragging": false,
|
|
"height": 347,
|
|
"id": "ChatOutput-VzVJK",
|
|
"position": {
|
|
"x": 1070.9148596889393,
|
|
"y": 499.80777483894144
|
|
},
|
|
"positionAbsolute": {
|
|
"x": 1070.9148596889393,
|
|
"y": 499.80777483894144
|
|
},
|
|
"selected": false,
|
|
"type": "genericNode",
|
|
"width": 432
|
|
},
|
|
{
|
|
"data": {
|
|
"description": "Each task must have a description, an expected output and an agent responsible for execution.",
|
|
"display_name": "Hierarchical Task",
|
|
"id": "HierarchicalTaskComponent-hE8H5",
|
|
"node": {
|
|
"base_classes": [
|
|
"HierarchicalTask"
|
|
],
|
|
"beta": false,
|
|
"conditional_paths": [],
|
|
"custom_fields": {},
|
|
"description": "Each task must have a description, an expected output and an agent responsible for execution.",
|
|
"display_name": "Hierarchical Task",
|
|
"documentation": "",
|
|
"edited": false,
|
|
"field_order": [
|
|
"task_description",
|
|
"expected_output",
|
|
"tools"
|
|
],
|
|
"frozen": false,
|
|
"icon": "CrewAI",
|
|
"legacy": false,
|
|
"metadata": {},
|
|
"output_types": [],
|
|
"outputs": [
|
|
{
|
|
"cache": true,
|
|
"display_name": "Task",
|
|
"method": "build_task",
|
|
"name": "task_output",
|
|
"selected": "HierarchicalTask",
|
|
"types": [
|
|
"HierarchicalTask"
|
|
],
|
|
"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.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"
|
|
},
|
|
"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": "Succinct response that answers the User's query."
|
|
},
|
|
"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": "HierarchicalTaskComponent"
|
|
},
|
|
"dragging": false,
|
|
"height": 480,
|
|
"id": "HierarchicalTaskComponent-hE8H5",
|
|
"position": {
|
|
"x": 63.673086094601445,
|
|
"y": -375.5883288441139
|
|
},
|
|
"positionAbsolute": {
|
|
"x": 63.673086094601445,
|
|
"y": -375.5883288441139
|
|
},
|
|
"selected": false,
|
|
"type": "genericNode",
|
|
"width": 432
|
|
},
|
|
{
|
|
"data": {
|
|
"description": "Represents an agent of CrewAI.",
|
|
"display_name": "CrewAI Agent",
|
|
"id": "CrewAIAgentComponent-EbpXd",
|
|
"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",
|
|
"legacy": false,
|
|
"metadata": {},
|
|
"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,
|
|
"name": "allow_delegation",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_metadata": true,
|
|
"type": "bool",
|
|
"value": true
|
|
},
|
|
"backstory": {
|
|
"advanced": false,
|
|
"display_name": "Backstory",
|
|
"dynamic": false,
|
|
"info": "The backstory of the agent.",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"multiline": true,
|
|
"name": "backstory",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": "You are a reliable researcher and journalist "
|
|
},
|
|
"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\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 or {}\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 or [],\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,
|
|
"multiline": true,
|
|
"name": "goal",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": "Search for information about the User's query and answer as best as you can"
|
|
},
|
|
"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,
|
|
"multiline": true,
|
|
"name": "role",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": "Research"
|
|
},
|
|
"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": 746,
|
|
"id": "CrewAIAgentComponent-EbpXd",
|
|
"position": {
|
|
"x": -479.3544836211363,
|
|
"y": 184.85118314299666
|
|
},
|
|
"positionAbsolute": {
|
|
"x": -479.3544836211363,
|
|
"y": 184.85118314299666
|
|
},
|
|
"selected": false,
|
|
"type": "genericNode",
|
|
"width": 432
|
|
},
|
|
{
|
|
"data": {
|
|
"description": "Represents an agent of CrewAI.",
|
|
"display_name": "CrewAI Agent",
|
|
"id": "CrewAIAgentComponent-9D8ao",
|
|
"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",
|
|
"legacy": false,
|
|
"metadata": {},
|
|
"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,
|
|
"name": "allow_delegation",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_metadata": true,
|
|
"type": "bool",
|
|
"value": true
|
|
},
|
|
"backstory": {
|
|
"advanced": false,
|
|
"display_name": "Backstory",
|
|
"dynamic": false,
|
|
"info": "The backstory of the agent.",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"multiline": true,
|
|
"name": "backstory",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": "You are polite and helpful. You've always been a beacon of politeness."
|
|
},
|
|
"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\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 or {}\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 or [],\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,
|
|
"multiline": true,
|
|
"name": "goal",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": "You can answer general questions from the User and may call others for help if needed."
|
|
},
|
|
"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,
|
|
"multiline": true,
|
|
"name": "role",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": "Manager"
|
|
},
|
|
"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": 746,
|
|
"id": "CrewAIAgentComponent-9D8ao",
|
|
"position": {
|
|
"x": -451.69853654304495,
|
|
"y": 1664.003205846104
|
|
},
|
|
"positionAbsolute": {
|
|
"x": -451.69853654304495,
|
|
"y": 1664.003205846104
|
|
},
|
|
"selected": false,
|
|
"type": "genericNode",
|
|
"width": 432
|
|
},
|
|
{
|
|
"data": {
|
|
"description": "Generates text using OpenAI LLMs.",
|
|
"display_name": "OpenAI",
|
|
"id": "OpenAIModel-HgNnu",
|
|
"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",
|
|
"system_message",
|
|
"stream",
|
|
"max_tokens",
|
|
"model_kwargs",
|
|
"json_mode",
|
|
"output_schema",
|
|
"model_name",
|
|
"openai_api_base",
|
|
"api_key",
|
|
"temperature",
|
|
"seed"
|
|
],
|
|
"frozen": false,
|
|
"icon": "OpenAI",
|
|
"legacy": false,
|
|
"metadata": {},
|
|
"output_types": [],
|
|
"outputs": [
|
|
{
|
|
"cache": true,
|
|
"display_name": "Text",
|
|
"method": "text_response",
|
|
"name": "text_output",
|
|
"required_inputs": [],
|
|
"selected": "Message",
|
|
"types": [
|
|
"Message"
|
|
],
|
|
"value": "__UNDEFINED__"
|
|
},
|
|
{
|
|
"cache": true,
|
|
"display_name": "Language Model",
|
|
"method": "build_model",
|
|
"name": "model_output",
|
|
"required_inputs": [],
|
|
"selected": "LanguageModel",
|
|
"types": [
|
|
"LanguageModel"
|
|
],
|
|
"value": "__UNDEFINED__"
|
|
}
|
|
],
|
|
"pinned": false,
|
|
"template": {
|
|
"_type": "Component",
|
|
"api_key": {
|
|
"advanced": false,
|
|
"display_name": "OpenAI API Key",
|
|
"dynamic": false,
|
|
"info": "The OpenAI API Key to use for the OpenAI model.",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"load_from_db": true,
|
|
"name": "api_key",
|
|
"password": true,
|
|
"placeholder": "",
|
|
"required": false,
|
|
"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": "import operator\nfrom functools import reduce\n\nfrom langchain_openai import ChatOpenAI\nfrom pydantic.v1 import SecretStr\n\nfrom langflow.base.models.model import LCModelComponent\nfrom langflow.base.models.openai_constants import OPENAI_MODEL_NAMES\nfrom langflow.field_typing import LanguageModel\nfrom langflow.field_typing.range_spec import RangeSpec\nfrom langflow.inputs import BoolInput, DictInput, DropdownInput, FloatInput, IntInput, SecretStrInput, StrInput\nfrom langflow.inputs.inputs import HandleInput\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 *LCModelComponent._base_inputs,\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 range_spec=RangeSpec(min=0, max=128000),\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=\"Additional keyword arguments to pass to the model.\",\n ),\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. \"\n \"You must pass the word JSON in the prompt. \"\n \"If left blank, JSON mode will be disabled. [DEPRECATED]\",\n ),\n DropdownInput(\n name=\"model_name\",\n display_name=\"Model Name\",\n advanced=False,\n options=OPENAI_MODEL_NAMES,\n value=OPENAI_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. \"\n \"Defaults to https://api.openai.com/v1. \"\n \"You can change this to use other APIs like JinaChat, LocalAI and Prem.\",\n ),\n SecretStrInput(\n name=\"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 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 HandleInput(\n name=\"output_parser\",\n display_name=\"Output Parser\",\n info=\"The parser to use to parse the output of the model\",\n advanced=True,\n input_types=[\"OutputParser\"],\n ),\n ]\n\n def build_model(self) -> LanguageModel: # type: ignore[type-var]\n # self.output_schema is a list of dictionaries\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.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\n api_key = SecretStr(openai_api_key).get_secret_value() if openai_api_key else 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 if temperature is not None else 0.1,\n seed=seed,\n )\n if json_mode:\n if output_schema_dict:\n output = output.with_structured_output(schema=output_schema_dict, method=\"json_mode\")\n else:\n output = output.bind(response_format={\"type\": \"json_object\"})\n\n return output\n\n def _get_exception_message(self, e: Exception):\n \"\"\"Get a message from an OpenAI exception.\n\n Args:\n e (Exception): The exception to get the message from.\n\n Returns:\n str: The message from the exception.\n \"\"\"\n try:\n from openai import BadRequestError\n except ImportError:\n return None\n if isinstance(e, BadRequestError):\n message = e.body.get(\"message\")\n if message:\n return message\n return None\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": "Additional keyword arguments to pass to the model.",
|
|
"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": "",
|
|
"load_from_db": false,
|
|
"name": "model_name",
|
|
"options": [
|
|
"gpt-4o-mini",
|
|
"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-4o"
|
|
},
|
|
"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": ""
|
|
},
|
|
"output_parser": {
|
|
"_input_type": "HandleInput",
|
|
"advanced": true,
|
|
"display_name": "Output Parser",
|
|
"dynamic": false,
|
|
"info": "The parser to use to parse the output of the model",
|
|
"input_types": [
|
|
"OutputParser"
|
|
],
|
|
"list": false,
|
|
"name": "output_parser",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_metadata": true,
|
|
"type": "other",
|
|
"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. [DEPRECATED]",
|
|
"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.",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"name": "system_message",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"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": 700,
|
|
"id": "OpenAIModel-HgNnu",
|
|
"position": {
|
|
"x": -1157.0105401589535,
|
|
"y": 1699.4665001507685
|
|
},
|
|
"positionAbsolute": {
|
|
"x": -1157.0105401589535,
|
|
"y": 1699.4665001507685
|
|
},
|
|
"selected": false,
|
|
"type": "genericNode",
|
|
"width": 432
|
|
},
|
|
{
|
|
"data": {
|
|
"description": "Create a prompt template with dynamic variables.",
|
|
"display_name": "Prompt",
|
|
"id": "Prompt-eqGhn",
|
|
"node": {
|
|
"base_classes": [
|
|
"Message"
|
|
],
|
|
"beta": false,
|
|
"conditional_paths": [],
|
|
"custom_fields": {
|
|
"template": [
|
|
"query"
|
|
]
|
|
},
|
|
"description": "Create a prompt template with dynamic variables.",
|
|
"display_name": "Prompt",
|
|
"documentation": "",
|
|
"edited": false,
|
|
"error": null,
|
|
"field_order": [
|
|
"template"
|
|
],
|
|
"frozen": false,
|
|
"full_path": null,
|
|
"icon": "prompts",
|
|
"is_composition": null,
|
|
"is_input": null,
|
|
"is_output": null,
|
|
"legacy": false,
|
|
"metadata": {},
|
|
"name": "",
|
|
"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.inputs.inputs import DefaultPromptField\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(self) -> Message:\n prompt = Message.from_template(**self._attributes)\n self.status = prompt.text\n return prompt\n\n def _update_template(self, frontend_node: dict):\n prompt_template = frontend_node[\"template\"][\"template\"][\"value\"]\n custom_fields = frontend_node[\"custom_fields\"]\n frontend_node_template = frontend_node[\"template\"]\n _ = process_prompt_template(\n template=prompt_template,\n name=\"template\",\n custom_fields=custom_fields,\n frontend_node_template=frontend_node_template,\n )\n return frontend_node\n\n def post_code_processing(self, new_frontend_node: dict, current_frontend_node: dict):\n \"\"\"This function is called after the code validation is done.\"\"\"\n frontend_node = super().post_code_processing(new_frontend_node, current_frontend_node)\n template = frontend_node[\"template\"][\"template\"][\"value\"]\n # Kept it duplicated for backwards compatibility\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\n def _get_fallback_input(self, **kwargs):\n return DefaultPromptField(**kwargs)\n"
|
|
},
|
|
"query": {
|
|
"advanced": false,
|
|
"display_name": "query",
|
|
"dynamic": false,
|
|
"field_type": "str",
|
|
"fileTypes": [],
|
|
"file_path": "",
|
|
"info": "",
|
|
"input_types": [
|
|
"Message",
|
|
"Text"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"multiline": true,
|
|
"name": "query",
|
|
"password": false,
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"type": "str",
|
|
"value": ""
|
|
},
|
|
"template": {
|
|
"advanced": false,
|
|
"display_name": "Template",
|
|
"dynamic": false,
|
|
"info": "",
|
|
"list": false,
|
|
"name": "template",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"type": "prompt",
|
|
"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."
|
|
}
|
|
}
|
|
},
|
|
"type": "Prompt"
|
|
},
|
|
"dragging": false,
|
|
"height": 475,
|
|
"id": "Prompt-eqGhn",
|
|
"position": {
|
|
"x": -561.9017558579421,
|
|
"y": -433.5913161630874
|
|
},
|
|
"positionAbsolute": {
|
|
"x": -561.9017558579421,
|
|
"y": -433.5913161630874
|
|
},
|
|
"selected": false,
|
|
"type": "genericNode",
|
|
"width": 432
|
|
},
|
|
{
|
|
"data": {
|
|
"id": "ChatInput-xgRl9",
|
|
"node": {
|
|
"base_classes": [
|
|
"Message"
|
|
],
|
|
"beta": false,
|
|
"conditional_paths": [],
|
|
"custom_fields": {},
|
|
"description": "Get chat inputs from the Playground.",
|
|
"display_name": "Chat Input",
|
|
"documentation": "",
|
|
"edited": false,
|
|
"field_order": [
|
|
"input_value",
|
|
"should_store_message",
|
|
"sender",
|
|
"sender_name",
|
|
"session_id",
|
|
"files"
|
|
],
|
|
"frozen": false,
|
|
"icon": "MessagesSquare",
|
|
"legacy": false,
|
|
"metadata": {},
|
|
"output_types": [],
|
|
"outputs": [
|
|
{
|
|
"cache": true,
|
|
"display_name": "Message",
|
|
"method": "message_response",
|
|
"name": "message",
|
|
"selected": "Message",
|
|
"types": [
|
|
"Message"
|
|
],
|
|
"value": "__UNDEFINED__"
|
|
}
|
|
],
|
|
"pinned": false,
|
|
"template": {
|
|
"_type": "Component",
|
|
"background_color": {
|
|
"_input_type": "MessageTextInput",
|
|
"advanced": true,
|
|
"display_name": "Background Color",
|
|
"dynamic": false,
|
|
"info": "The background color of the icon.",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"name": "background_color",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": ""
|
|
},
|
|
"chat_icon": {
|
|
"_input_type": "MessageTextInput",
|
|
"advanced": true,
|
|
"display_name": "Icon",
|
|
"dynamic": false,
|
|
"info": "The icon of the message.",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"name": "chat_icon",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"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 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.schema.message import Message\nfrom langflow.utils.constants import MESSAGE_SENDER_AI, MESSAGE_SENDER_NAME_USER, MESSAGE_SENDER_USER\n\n\nclass ChatInput(ChatComponent):\n display_name = \"Chat Input\"\n description = \"Get chat inputs from the Playground.\"\n icon = \"MessagesSquare\"\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=[MESSAGE_SENDER_AI, MESSAGE_SENDER_USER],\n value=MESSAGE_SENDER_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=MESSAGE_SENDER_NAME_USER,\n advanced=True,\n ),\n MessageTextInput(\n name=\"session_id\",\n display_name=\"Session ID\",\n info=\"The session ID of the chat. If empty, the current session ID parameter will be used.\",\n 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 MessageTextInput(\n name=\"background_color\",\n display_name=\"Background Color\",\n info=\"The background color of the icon.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"chat_icon\",\n display_name=\"Icon\",\n info=\"The icon of the message.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"text_color\",\n display_name=\"Text Color\",\n info=\"The text color of the name\",\n advanced=True,\n ),\n ]\n outputs = [\n Output(display_name=\"Message\", name=\"message\", method=\"message_response\"),\n ]\n\n def message_response(self) -> Message:\n _background_color = self.background_color\n _text_color = self.text_color\n _icon = self.chat_icon\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 properties={\"background_color\": _background_color, \"text_color\": _text_color, \"icon\": _icon},\n )\n if self.session_id and isinstance(message, Message) and self.should_store_message:\n stored_message = self.send_message(\n message,\n )\n self.message.value = stored_message\n message = stored_message\n\n self.status = message\n return message\n"
|
|
},
|
|
"files": {
|
|
"advanced": true,
|
|
"display_name": "Files",
|
|
"dynamic": false,
|
|
"fileTypes": [
|
|
"txt",
|
|
"md",
|
|
"mdx",
|
|
"csv",
|
|
"json",
|
|
"yaml",
|
|
"yml",
|
|
"xml",
|
|
"html",
|
|
"htm",
|
|
"pdf",
|
|
"docx",
|
|
"py",
|
|
"sh",
|
|
"sql",
|
|
"js",
|
|
"ts",
|
|
"tsx",
|
|
"jpg",
|
|
"jpeg",
|
|
"png",
|
|
"bmp",
|
|
"image"
|
|
],
|
|
"file_path": "",
|
|
"info": "Files to be sent with the message.",
|
|
"list": true,
|
|
"name": "files",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_metadata": true,
|
|
"type": "file",
|
|
"value": ""
|
|
},
|
|
"input_value": {
|
|
"advanced": false,
|
|
"display_name": "Text",
|
|
"dynamic": false,
|
|
"info": "Message to be passed as input.",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"multiline": true,
|
|
"name": "input_value",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": "What is Langflow?"
|
|
},
|
|
"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": "User"
|
|
},
|
|
"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": "User"
|
|
},
|
|
"session_id": {
|
|
"advanced": true,
|
|
"display_name": "Session ID",
|
|
"dynamic": false,
|
|
"info": "The session ID of the chat. If empty, the current session ID parameter will be used.",
|
|
"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
|
|
},
|
|
"text_color": {
|
|
"_input_type": "MessageTextInput",
|
|
"advanced": true,
|
|
"display_name": "Text Color",
|
|
"dynamic": false,
|
|
"info": "The text color of the name",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"name": "text_color",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": ""
|
|
}
|
|
}
|
|
},
|
|
"type": "ChatInput"
|
|
},
|
|
"dragging": false,
|
|
"height": 347,
|
|
"id": "ChatInput-xgRl9",
|
|
"position": {
|
|
"x": -1227.1161422332996,
|
|
"y": -380.26504479310324
|
|
},
|
|
"positionAbsolute": {
|
|
"x": -1227.1161422332996,
|
|
"y": -380.26504479310324
|
|
},
|
|
"selected": false,
|
|
"type": "genericNode",
|
|
"width": 432
|
|
},
|
|
{
|
|
"data": {
|
|
"description": "Represents an agent of CrewAI.",
|
|
"display_name": "CrewAI Agent",
|
|
"id": "CrewAIAgentComponent-UMpxO",
|
|
"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",
|
|
"legacy": false,
|
|
"metadata": {},
|
|
"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,
|
|
"name": "allow_delegation",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_metadata": true,
|
|
"type": "bool",
|
|
"value": true
|
|
},
|
|
"backstory": {
|
|
"advanced": false,
|
|
"display_name": "Backstory",
|
|
"dynamic": false,
|
|
"info": "The backstory of the agent.",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"multiline": true,
|
|
"name": "backstory",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": "You are a reliable researcher and journalist "
|
|
},
|
|
"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\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 or {}\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 or [],\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,
|
|
"multiline": true,
|
|
"name": "goal",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": "Evaluate the information for misleading or biased data."
|
|
},
|
|
"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,
|
|
"multiline": true,
|
|
"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": 746,
|
|
"id": "CrewAIAgentComponent-UMpxO",
|
|
"position": {
|
|
"x": -397.2627184897183,
|
|
"y": 892.6280687419107
|
|
},
|
|
"positionAbsolute": {
|
|
"x": -397.2627184897183,
|
|
"y": 892.6280687419107
|
|
},
|
|
"selected": false,
|
|
"type": "genericNode",
|
|
"width": 432
|
|
},
|
|
{
|
|
"data": {
|
|
"id": "SearchAPI-Yokat",
|
|
"node": {
|
|
"base_classes": [
|
|
"Data",
|
|
"Tool"
|
|
],
|
|
"beta": false,
|
|
"conditional_paths": [],
|
|
"custom_fields": {},
|
|
"description": "Call the searchapi.io API with result limiting",
|
|
"display_name": "Search API",
|
|
"documentation": "https://www.searchapi.io/docs/google",
|
|
"edited": false,
|
|
"field_order": [
|
|
"engine",
|
|
"api_key",
|
|
"input_value",
|
|
"search_params"
|
|
],
|
|
"frozen": false,
|
|
"legacy": false,
|
|
"metadata": {},
|
|
"output_types": [],
|
|
"outputs": [
|
|
{
|
|
"cache": true,
|
|
"display_name": "Data",
|
|
"method": "run_model",
|
|
"name": "api_run_model",
|
|
"required_inputs": [
|
|
"api_key"
|
|
],
|
|
"selected": "Data",
|
|
"types": [
|
|
"Data"
|
|
],
|
|
"value": "__UNDEFINED__"
|
|
},
|
|
{
|
|
"cache": true,
|
|
"display_name": "Tool",
|
|
"method": "build_tool",
|
|
"name": "api_build_tool",
|
|
"required_inputs": [
|
|
"api_key"
|
|
],
|
|
"selected": "Tool",
|
|
"types": [
|
|
"Tool"
|
|
],
|
|
"value": "__UNDEFINED__"
|
|
}
|
|
],
|
|
"pinned": false,
|
|
"template": {
|
|
"_type": "Component",
|
|
"api_key": {
|
|
"advanced": false,
|
|
"display_name": "SearchAPI API Key",
|
|
"dynamic": false,
|
|
"info": "",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"load_from_db": true,
|
|
"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 typing import Any\n\nfrom langchain.tools import StructuredTool\nfrom langchain_community.utilities.searchapi import SearchApiAPIWrapper\nfrom pydantic import BaseModel, Field\n\nfrom langflow.base.langchain_utilities.model import LCToolComponent\nfrom langflow.field_typing import Tool\nfrom langflow.inputs import DictInput, IntInput, MessageTextInput, MultilineInput, SecretStrInput\nfrom langflow.schema import Data\n\n\nclass SearchAPIComponent(LCToolComponent):\n display_name: str = \"Search API\"\n description: str = \"Call the searchapi.io API with result limiting\"\n name = \"SearchAPI\"\n documentation: str = \"https://www.searchapi.io/docs/google\"\n\n inputs = [\n MessageTextInput(name=\"engine\", display_name=\"Engine\", value=\"google\"),\n SecretStrInput(name=\"api_key\", display_name=\"SearchAPI API Key\", required=True),\n MultilineInput(\n name=\"input_value\",\n display_name=\"Input\",\n ),\n DictInput(name=\"search_params\", display_name=\"Search parameters\", advanced=True, is_list=True),\n IntInput(name=\"max_results\", display_name=\"Max Results\", value=5, advanced=True),\n IntInput(name=\"max_snippet_length\", display_name=\"Max Snippet Length\", value=100, advanced=True),\n ]\n\n class SearchAPISchema(BaseModel):\n query: str = Field(..., description=\"The search query\")\n params: dict[str, Any] = Field(default_factory=dict, description=\"Additional search parameters\")\n max_results: int = Field(5, description=\"Maximum number of results to return\")\n max_snippet_length: int = Field(100, description=\"Maximum length of each result snippet\")\n\n def _build_wrapper(self):\n return SearchApiAPIWrapper(engine=self.engine, searchapi_api_key=self.api_key)\n\n def build_tool(self) -> Tool:\n wrapper = self._build_wrapper()\n\n def search_func(\n query: str, params: dict[str, Any] | None = None, max_results: int = 5, max_snippet_length: int = 100\n ) -> list[dict[str, Any]]:\n params = params or {}\n full_results = wrapper.results(query=query, **params)\n organic_results = full_results.get(\"organic_results\", [])[:max_results]\n\n limited_results = []\n for result in organic_results:\n limited_result = {\n \"title\": result.get(\"title\", \"\")[:max_snippet_length],\n \"link\": result.get(\"link\", \"\"),\n \"snippet\": result.get(\"snippet\", \"\")[:max_snippet_length],\n }\n limited_results.append(limited_result)\n\n return limited_results\n\n tool = StructuredTool.from_function(\n name=\"search_api\",\n description=\"Search for recent results using searchapi.io with result limiting\",\n func=search_func,\n args_schema=self.SearchAPISchema,\n )\n\n self.status = f\"Search API Tool created with engine: {self.engine}\"\n return tool\n\n def run_model(self) -> list[Data]:\n tool = self.build_tool()\n results = tool.run(\n {\n \"query\": self.input_value,\n \"params\": self.search_params or {},\n \"max_results\": self.max_results,\n \"max_snippet_length\": self.max_snippet_length,\n }\n )\n\n data_list = [Data(data=result, text=result.get(\"snippet\", \"\")) for result in results]\n\n self.status = data_list\n return data_list\n"
|
|
},
|
|
"engine": {
|
|
"advanced": false,
|
|
"display_name": "Engine",
|
|
"dynamic": false,
|
|
"info": "",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"name": "engine",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": "google"
|
|
},
|
|
"input_value": {
|
|
"advanced": false,
|
|
"display_name": "Input",
|
|
"dynamic": false,
|
|
"info": "",
|
|
"input_types": [
|
|
"Message"
|
|
],
|
|
"list": false,
|
|
"load_from_db": false,
|
|
"multiline": true,
|
|
"name": "input_value",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"trace_as_metadata": true,
|
|
"type": "str",
|
|
"value": ""
|
|
},
|
|
"max_results": {
|
|
"_input_type": "IntInput",
|
|
"advanced": true,
|
|
"display_name": "Max Results",
|
|
"dynamic": false,
|
|
"info": "",
|
|
"list": false,
|
|
"name": "max_results",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_metadata": true,
|
|
"type": "int",
|
|
"value": 5
|
|
},
|
|
"max_snippet_length": {
|
|
"_input_type": "IntInput",
|
|
"advanced": true,
|
|
"display_name": "Max Snippet Length",
|
|
"dynamic": false,
|
|
"info": "",
|
|
"list": false,
|
|
"name": "max_snippet_length",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_metadata": true,
|
|
"type": "int",
|
|
"value": 100
|
|
},
|
|
"search_params": {
|
|
"advanced": true,
|
|
"display_name": "Search parameters",
|
|
"dynamic": false,
|
|
"info": "",
|
|
"list": true,
|
|
"name": "search_params",
|
|
"placeholder": "",
|
|
"required": false,
|
|
"show": true,
|
|
"title_case": false,
|
|
"trace_as_input": true,
|
|
"type": "dict",
|
|
"value": {}
|
|
}
|
|
}
|
|
},
|
|
"type": "SearchAPI"
|
|
},
|
|
"dragging": false,
|
|
"height": 612,
|
|
"id": "SearchAPI-Yokat",
|
|
"position": {
|
|
"x": -1229.2392382339021,
|
|
"y": 59.93107827969652
|
|
},
|
|
"positionAbsolute": {
|
|
"x": -1229.2392382339021,
|
|
"y": 59.93107827969652
|
|
},
|
|
"selected": false,
|
|
"type": "genericNode",
|
|
"width": 432
|
|
}
|
|
],
|
|
"viewport": {
|
|
"x": 538.2178429916559,
|
|
"y": 231.5938714083456,
|
|
"zoom": 0.25005698994252296
|
|
}
|
|
},
|
|
"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.",
|
|
"endpoint_name": null,
|
|
"icon": "GitFork",
|
|
"id": "6302081f-5af2-4b9f-bd19-2baaf7218ba6",
|
|
"is_component": false,
|
|
"last_tested_version": "1.0.12",
|
|
"name": "Hierarchical Tasks Agent",
|
|
"tags": [
|
|
"agents",
|
|
"openai",
|
|
"chatbots"
|
|
]
|
|
} |