Add CrewAI Component Documentation (#2519)
* feat: CrewAI components static files * feat: CrewAI add .md guide files * feat: CrewAI add CrewAI_components_bundle.json * chore: Comment out CrewAI section in sidebars.js --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
138
docs/docs/integrations/crewai/agent.md
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
import Admonition from "@theme/Admonition";
|
||||
import ThemedImage from "@theme/ThemedImage";
|
||||
import useBaseUrl from "@docusaurus/useBaseUrl";
|
||||
import ZoomableImage from "/src/theme/ZoomableImage.js";
|
||||
|
||||
# Agent Component
|
||||
|
||||
The `CrewAIAgent` component represents an agent of CrewAI. It provides a convenient way to integrate CrewAI agent data into your Langflow workflows.
|
||||
|
||||
[CrewAI Reference](https://docs.crewai.com/how-to/LLM-Connections/)
|
||||
|
||||
The `CrewAIAgent` component enables you to:
|
||||
|
||||
- Define the role, goal, and backstory of the agent
|
||||
- Specify tools and language models for the agent
|
||||
- Configure advanced settings such as memory, verbosity, and delegation
|
||||
|
||||
## Component Usage
|
||||
|
||||
To use the `CrewAIAgent` component in a Langflow flow, follow these steps:
|
||||
|
||||
1. Add the `CrewAIAgent` component to your flow.
|
||||
2. Configure the component by providing the required inputs such as role, goal, and backstory.
|
||||
3. Connect the component to other nodes in your flow as needed.
|
||||
|
||||
## Component Python code
|
||||
|
||||
```python
|
||||
from langflow.custom import Component
|
||||
from langflow.io import MessageTextInput, Output
|
||||
from langflow.schema import Data
|
||||
from langflow.io import BoolInput, DictInput, DropdownInput, MessageTextInput, HandleInput
|
||||
from crewai import Agent
|
||||
|
||||
|
||||
class CrewAIAgent(Component):
|
||||
display_name = "CrewAIAgent"
|
||||
description = "Represents an agent of CrewAI."
|
||||
documentation: str = "https://docs.crewai.com/how-to/LLM-Connections/"
|
||||
icon = "CrewAI"
|
||||
|
||||
inputs = [
|
||||
MessageTextInput(name="role", display_name="Role", info="The role of the agent."),
|
||||
MessageTextInput(name="goal", display_name="Goal", info="The objective of the agent."),
|
||||
MessageTextInput(name="backstory", display_name="Backstory", info="The backstory of the agent."),
|
||||
HandleInput(
|
||||
name="tools",
|
||||
display_name="Tools",
|
||||
input_types=["Tool"],
|
||||
is_list=True,
|
||||
info="Tools at agents disposal",
|
||||
value=[],
|
||||
),
|
||||
HandleInput(
|
||||
name="llm",
|
||||
display_name="Language Model",
|
||||
info="Language model that will run the agent.",
|
||||
input_types=["LanguageModel"],
|
||||
),
|
||||
BoolInput(
|
||||
name="memory",
|
||||
display_name="Memory",
|
||||
info="Whether the agent should have memory or not",
|
||||
advanced=True,
|
||||
value=True,
|
||||
),
|
||||
BoolInput(
|
||||
name="verbose",
|
||||
display_name="Verbose",
|
||||
advanced=True,
|
||||
value=False,
|
||||
),
|
||||
BoolInput(
|
||||
name="allow_delegation",
|
||||
display_name="Allow Delegation",
|
||||
info="Whether the agent is allowed to delegate tasks to other agents.",
|
||||
value=True,
|
||||
),
|
||||
DictInput(
|
||||
name="kwargs",
|
||||
display_name="kwargs",
|
||||
info="kwargs of agent.",
|
||||
is_list=True,
|
||||
advanced=True,
|
||||
),
|
||||
]
|
||||
|
||||
outputs = [
|
||||
Output(display_name="Output", name="output", method="build_output"),
|
||||
]
|
||||
|
||||
|
||||
def build_output(self) -> Agent:
|
||||
kwargs = self.kwargs if self.kwargs else {}
|
||||
agent = Agent(
|
||||
role=self.role,
|
||||
goal=self.goal,
|
||||
backstory=self.backstory,
|
||||
llm=self.llm,
|
||||
verbose=self.verbose,
|
||||
memory=self.memory,
|
||||
tools=self.tools if self.tools else [],
|
||||
allow_delegation=self.allow_delegation,
|
||||
**kwargs
|
||||
)
|
||||
self.status = agent
|
||||
return agent
|
||||
|
||||
```
|
||||
|
||||
## Example Usage
|
||||
|
||||
Here's an example of how to use the `CrewAIAgent` component in a Langflow flow, connecting the `OpenAI` component's output to the CrewAIAgent component.
|
||||
|
||||
<ZoomableImage
|
||||
alt="CrewAIAgent Flow Example"
|
||||
sources={{
|
||||
light: "img/crewai/CrewAIAgent_flow_example.png",
|
||||
dark: "img/crewai/CrewAIAgent_flow_example_dark.png",
|
||||
}}
|
||||
style={{ width: "100%", margin: "20px 0" }}
|
||||
/>
|
||||
|
||||
## Best Practices
|
||||
|
||||
When using the `CrewAIAgent` component, consider the following best practices:
|
||||
|
||||
- Ensure that you have configured the agent's role, goal, and backstory appropriately.
|
||||
|
||||
The `CrewAIAgent` component provides a seamless way to integrate CrewAI agent data into your Langflow workflows. By leveraging this component, you can easily define and utilize agent information from CrewAI, enhancing the capabilities of your Langflow applications. Feel free to explore and experiment with the `CrewAIAgent` component to unlock new possibilities in your Langflow projects!
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you encounter any issues while using the `CrewAIAgent` component, consider the following:
|
||||
|
||||
- Double-check that your inputs such as role, goal, and backstory are correctly configured.
|
||||
- Verify that you have installed the necessary dependencies for the component to function properly.
|
||||
- Check the CrewAI documentation for any updates or changes that may affect the component's functionality.
|
||||
104
docs/docs/integrations/crewai/crew.md
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
import Admonition from "@theme/Admonition";
|
||||
import ThemedImage from "@theme/ThemedImage";
|
||||
import useBaseUrl from "@docusaurus/useBaseUrl";
|
||||
import ZoomableImage from "/src/theme/ZoomableImage.js";
|
||||
|
||||
# Crew Component
|
||||
|
||||
The `CrewAICrew` component represents a group of agents in CrewAI. It defines how agents collaborate and the tasks they perform, integrating seamlessly into your Langflow workflows.
|
||||
|
||||
[CrewAI Reference](https://docs.crewai.com/how-to/LLM-Connections/)
|
||||
|
||||
The `CrewAICrew` component enables you to:
|
||||
|
||||
- Define tasks and assign agents
|
||||
- Specify the topic and collaboration process
|
||||
- Configure advanced settings such as verbosity, memory, cache usage, and maximum RPM
|
||||
|
||||
## Component Usage
|
||||
|
||||
To use the `CrewAICrew` component in a Langflow flow, follow these steps:
|
||||
|
||||
1. Add the `CrewAICrew` component to your flow.
|
||||
2. Configure the component by providing the required inputs such as tasks, agents, and topic.
|
||||
3. Connect the component to other nodes in your flow as needed.
|
||||
|
||||
## Component Python code
|
||||
|
||||
```python
|
||||
from langflow.custom import Component
|
||||
from crewai import Crew, Task, Agent, Process
|
||||
from typing import List, Optional
|
||||
from langflow.field_typing import Text
|
||||
from langflow.io import NestedDictInput, DropdownInput, MessageTextInput, HandleInput, IntInput, BoolInput
|
||||
from langflow.schema.message import Message
|
||||
|
||||
class CrewAICrew(Component):
|
||||
display_name: str = "CrewAICrew"
|
||||
description: str = "Represents a group of agents, defining how they should collaborate and the tasks they should perform."
|
||||
documentation: str = "https://docs.crewai.com/how-to/LLM-Connections/"
|
||||
icon = "CrewAI"
|
||||
|
||||
inputs = [
|
||||
HandleInput(name="tasks", display_name="Tasks", input_types=["Task"], is_list=True),
|
||||
HandleInput(name="agents", display_name="Agents", input_types=["Agent"], is_list=True),
|
||||
MessageTextInput(name="topic", display_name="Topic"),
|
||||
IntInput(name="verbose", display_name="Verbose", value=0, advanced=True),
|
||||
BoolInput(name="memory", display_name="Memory", value=False, advanced=True),
|
||||
BoolInput(name="use_cache", display_name="Cache", value=True, advanced=True),
|
||||
IntInput(name="max_rpm", display_name="Max RPM", value=100, advanced=True),
|
||||
DropdownInput(name="process", display_name="Process", value=Process.sequential, options=[Process.sequential, Process.hierarchical]),
|
||||
BoolInput(name="share_crew", display_name="Share Crew", value=False, advanced=True),
|
||||
NestedDictInput(name="input", display_name="Input", value={"topic": ""}, is_list=True)
|
||||
]
|
||||
|
||||
outputs = [
|
||||
Output(display_name="Output", name="output", method="build_output"),
|
||||
]
|
||||
|
||||
async def build_output(self) -> Message:
|
||||
if not self.agents or not self.tasks:
|
||||
raise ValueError("No agents or tasks have been added.")
|
||||
|
||||
response = Crew(
|
||||
agents=self.agents,
|
||||
tasks=self.tasks,
|
||||
process=self.process,
|
||||
verbose=self.verbose,
|
||||
memory=self.memory,
|
||||
cache=self.use_cache,
|
||||
max_rpm=self.max_rpm,
|
||||
share_crew=self.share_crew,
|
||||
)
|
||||
message = await response.kickoff_async(inputs=self.input)
|
||||
self.status = message
|
||||
return message
|
||||
```
|
||||
|
||||
Example Usage
|
||||
Here's an example of how you can use the `CrewAICrew` component in a Langflow flow, connecting the CrewAIAgent component to the `CrewAITask`, `CrewAIAgent`, and `Chat Input`component, and then passing the output Chat Output component:
|
||||
|
||||
<ZoomableImage
|
||||
alt="CrewAICrew Flow Example"
|
||||
sources={{
|
||||
light: "img/crewai/CrewAICrew_flow_example.png",
|
||||
dark: "img/crewai/CrewAICrew_flow_example_dark.png",
|
||||
}}
|
||||
style={{ width: "100%", margin: "20px 0" }}
|
||||
/>
|
||||
|
||||
## Best Practices
|
||||
|
||||
When using the `CrewAICrew` component, consider the following best practices:
|
||||
|
||||
Clearly define the tasks and assign the appropriate agents.
|
||||
Configure the collaboration process and advanced settings according to your needs.
|
||||
The `CrewAICrew` component provides a streamlined way to manage groups of agents and their tasks within your Langflow workflows. By leveraging this component, you can effectively organize and automate agent collaboration, enhancing the efficiency of your Langflow projects. Feel free to explore and experiment with the `CrewAICrew` component to unlock new possibilities in your Langflow projects!
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you encounter any issues while using the `CrewAICrew` component, consider the following:
|
||||
|
||||
- Double-check that your inputs such as tasks and agents are correctly configured.
|
||||
- Verify that you have installed the necessary dependencies for the component to function properly.
|
||||
- Check the CrewAI documentation for any updates or changes that may affect the component's functionality.
|
||||
41
docs/docs/integrations/crewai/intro.md
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import Admonition from "@theme/Admonition";
|
||||
import ThemedImage from "@theme/ThemedImage";
|
||||
import useBaseUrl from "@docusaurus/useBaseUrl";
|
||||
import ZoomableImage from "/src/theme/ZoomableImage.js";
|
||||
|
||||
# Introduction to CrewAI in Langflow
|
||||
|
||||
The CrewAI integration in Langflow enables seamless connectivity with CrewAI components, facilitating automation and improving productivity.
|
||||
|
||||
<ZoomableImage
|
||||
alt="CrewAI Components in Langflow"
|
||||
sources={{
|
||||
light: "img/crewai/crewai_bundle.jpg",
|
||||
dark: "img/crewai/crewai_bundle.jpg",
|
||||
}}
|
||||
style={{ width: "100%", margin: "20px 0" }}
|
||||
/>
|
||||
|
||||
#### <a target="\_blank" href="json_files/CrewAI_Components_bundle.json" download>Download CrewAI Components Bundle</a>
|
||||
|
||||
### Key Features of CrewAI Integration in Langflow
|
||||
|
||||
- **Manage Agents**: Define and manage a group of agents, specifying their tasks and collaboration methods.
|
||||
- **Task Automation**: Automate task creation and management using CrewAI's capabilities.
|
||||
- **Process Management**: Define and manage processes for task execution and agent collaboration.
|
||||
|
||||
### Potential Use Cases for CrewAI Integration in Langflow
|
||||
|
||||
- **Task Automation**: Automate task creation and management using CrewAI's AI capabilities.
|
||||
- **Agent Collaboration**: Define and manage how agents should collaborate on tasks.
|
||||
- **Process Management**: Automate and manage processes for task execution and agent collaboration.
|
||||
|
||||
### Getting Started with CrewAI Integration in Langflow
|
||||
|
||||
1. **Learn about CrewAI Components**: Follow the guide [Understanding CrewAI Components](./setup) to learn how to use CrewAI components effectively.
|
||||
2. **Configure CrewAI Components**: Provide the necessary parameters to configure the CrewAI components in your Langflow flows.
|
||||
3. **Connect Components**: Integrate CrewAI components with other Langflow components to build your workflow.
|
||||
4. **Test and Refine**: Ensure your Langflow flow operates as intended by testing and refining it.
|
||||
5. **Deploy and Run**: Deploy your Langflow flow to automate CrewAI-related tasks and processes.
|
||||
|
||||
The CrewAI integration in Langflow offers a powerful toolset for automation and productivity enhancement. Whether managing tasks, defining agent collaboration, or managing processes, Langflow and CrewAI provide robust solutions for streamlining workflows.
|
||||
27
docs/docs/integrations/crewai/setup.md
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import Admonition from "@theme/Admonition";
|
||||
|
||||
# Using CrewAI Components in Langflow
|
||||
|
||||
Langflow provides the following CrewAI components:
|
||||
|
||||
- **[CrewAIAgent](./agent)**: Represents an agent of CrewAI.
|
||||
- **[CrewAITask](./task)**: Each task must have a description, an expected output, and an agent responsible for execution.
|
||||
- **[CrewAICrew](./crew)**: Represents a group of agents, defining how they should collaborate and the tasks they should perform.
|
||||
|
||||
Refer to the individual component documentation for more details on how to use each component in your Langflow flows.
|
||||
|
||||
## Components Compatibility
|
||||
|
||||
- **CrewAIAgent**:
|
||||
- Compatible with CrewAITask and CrewAICrew components.
|
||||
- **CrewAITask**:
|
||||
- Compatible with CrewAIAgent and CrewAICrew components.
|
||||
- **CrewAICrew**:
|
||||
- Compatible with CrewAIAgent and CrewAITask components.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [CrewAI API Documentation](https://docs.crewai.com/how-to/Creating-a-Crew-and-kick-it-off/)
|
||||
- [CrewAI Examples](https://github.com/joaomdmoura/crewAI-examples/tree/main)
|
||||
|
||||
If you encounter any issues or have questions, please reach out to our support team or consult the Langflow community forums.
|
||||
116
docs/docs/integrations/crewai/task.md
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
import Admonition from "@theme/Admonition";
|
||||
import ThemedImage from "@theme/ThemedImage";
|
||||
import useBaseUrl from "@docusaurus/useBaseUrl";
|
||||
import ZoomableImage from "/src/theme/ZoomableImage.js";
|
||||
|
||||
# Task Component
|
||||
|
||||
The `CrewAITask` component represents a task in CrewAI. It allows you to define tasks with detailed descriptions, expected outputs, and the responsible agent, integrating seamlessly into your Langflow workflows.
|
||||
|
||||
[CrewAI Reference](https://docs.crewai.com/how-to/LLM-Connections/)
|
||||
|
||||
The `CrewAITask` component enables you to:
|
||||
|
||||
- Define the task's description and expected output
|
||||
- Assign an agent responsible for executing the task
|
||||
- Specify tools and resources for task execution
|
||||
- Configure advanced settings such as asynchronous execution
|
||||
|
||||
## Component Usage
|
||||
|
||||
To use the `CrewAITask` component in a Langflow flow, follow these steps:
|
||||
|
||||
1. Add the `CrewAITask` component to your flow.
|
||||
2. Configure the component by providing the required inputs such as description and expected output.
|
||||
3. Connect the component to other nodes in your flow as needed.
|
||||
|
||||
## Component Python code
|
||||
|
||||
```python
|
||||
from langflow.custom import Component
|
||||
from langflow.io import BoolInput, DictInput, DropdownInput, MessageTextInput, HandleInput
|
||||
from crewai import Task, Agent
|
||||
|
||||
class CrewAITask(Component):
|
||||
display_name: str = "CrewAITask"
|
||||
description: str = "Each task must have a description, an expected output and an agent responsible for execution."
|
||||
documentation: str = "https://docs.crewai.com/how-to/LLM-Connections/"
|
||||
icon = "CrewAI"
|
||||
|
||||
inputs = [
|
||||
MessageTextInput(
|
||||
name="description",
|
||||
display_name="Description",
|
||||
info="Descriptive text detailing task's purpose and execution.",
|
||||
),
|
||||
MessageTextInput(
|
||||
name="expected_output",
|
||||
display_name="Expected Output",
|
||||
info="Clear definition of expected task outcome.",
|
||||
),
|
||||
HandleInput(
|
||||
name="tools",
|
||||
display_name="Tools",
|
||||
input_types=["Tool"],
|
||||
is_list=True,
|
||||
info="List of tools/resources limited for task execution.",
|
||||
),
|
||||
HandleInput(
|
||||
name="agent",
|
||||
display_name="Agent",
|
||||
input_types=["Agent"],
|
||||
info="Agent responsible for task execution. Represents entity performing task.",
|
||||
),
|
||||
BoolInput(
|
||||
name="async_execution",
|
||||
display_name="Async Execution",
|
||||
value=False,
|
||||
advanced=True,
|
||||
info="Boolean flag indicating asynchronous task execution.",
|
||||
),
|
||||
]
|
||||
|
||||
outputs = [
|
||||
Output(display_name="Task", name="task_output", method="build_task"),
|
||||
]
|
||||
|
||||
def build_task(self) -> Task:
|
||||
task = Task(
|
||||
description=self.description,
|
||||
expected_output=self.expected_output,
|
||||
tools=self.tools if self.tools else [],
|
||||
async_execution=self.async_execution,
|
||||
agent=self.agent
|
||||
)
|
||||
self.status = task
|
||||
return task
|
||||
```
|
||||
|
||||
## Example Usage
|
||||
|
||||
Here's an example of how you can use the CrewAITask component in a Langflow flow, connecting the CrewAIAgent component to the CrewAITask component, and then passing the outputs to the CrewAICrew component:
|
||||
|
||||
<ZoomableImage
|
||||
alt="CrewAITask Flow Example"
|
||||
sources={{
|
||||
light: "img/crewai/CrewAITask_flow_example.png",
|
||||
dark: "img/crewai/CrewAITask_flow_example_dark.png",
|
||||
}}
|
||||
style={{ width: "100%", margin: "20px 0" }}
|
||||
/>
|
||||
|
||||
## Best Practices
|
||||
|
||||
When using the CrewAITask component, consider the following best practices:
|
||||
|
||||
Ensure that you have defined the task's description and expected output clearly.
|
||||
Assign the appropriate agent for task execution.
|
||||
The CrewAITask component provides a streamlined way to define and manage tasks within your Langflow workflows. By leveraging this component, you can effectively organize and automate task execution, enhancing the efficiency of your Langflow projects. Feel free to explore and experiment with the CrewAITask component to unlock new possibilities in your Langflow projects!
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you encounter any issues while using the CrewAITask component, consider the following:
|
||||
|
||||
Double-check that your inputs such as description and expected output are correctly configured.
|
||||
Verify that you have installed the necessary dependencies for the component to function properly.
|
||||
Check the CrewAI documentation for any updates or changes that may affect the component's functionality.
|
||||
|
|
@ -163,6 +163,17 @@ module.exports = {
|
|||
},
|
||||
// {
|
||||
// type: "category",
|
||||
// label: "CrewAI",
|
||||
// items: [
|
||||
// "integrations/crewai/intro",
|
||||
// "integrations/crewai/setup",
|
||||
// "integrations/crewai/agent",
|
||||
// "integrations/crewai/task",
|
||||
// "integrations/crewai/crew",
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// type: "category",
|
||||
// label: "LangSmith",
|
||||
// items: [
|
||||
// ,
|
||||
|
|
|
|||
BIN
docs/static/img/crewai/CrewAIAgent_flow_example.png
vendored
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
docs/static/img/crewai/CrewAIAgent_flow_example_dark.png
vendored
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
docs/static/img/crewai/CrewAICrew_flow_example.png
vendored
Normal file
|
After Width: | Height: | Size: 138 KiB |
BIN
docs/static/img/crewai/CrewAICrew_flow_example_dark.png
vendored
Normal file
|
After Width: | Height: | Size: 139 KiB |
BIN
docs/static/img/crewai/CrewAITask_flow_example.png
vendored
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
docs/static/img/crewai/CrewAITask_flow_example_dark.png
vendored
Normal file
|
After Width: | Height: | Size: 87 KiB |
BIN
docs/static/img/crewai/crewai_bundle.jpg
vendored
Normal file
|
After Width: | Height: | Size: 2.8 MiB |
764
docs/static/json_files/CrewAI_Components_bundle.json
vendored
Normal file
|
|
@ -0,0 +1,764 @@
|
|||
{
|
||||
"id": "8e7f4928-36e5-4348-bec2-166e24801b47",
|
||||
"data": {
|
||||
"nodes": [
|
||||
{
|
||||
"id": "CustomComponent-j27OA",
|
||||
"type": "genericNode",
|
||||
"position": { "x": 257.58598820460725, "y": -171.98904954008663 },
|
||||
"data": {
|
||||
"type": "CustomComponent",
|
||||
"node": {
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"llm": {
|
||||
"trace_as_metadata": true,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "llm",
|
||||
"display_name": "Language Model",
|
||||
"advanced": false,
|
||||
"input_types": ["LanguageModel"],
|
||||
"dynamic": false,
|
||||
"info": "Language model that will run the agent.",
|
||||
"title_case": false,
|
||||
"type": "other"
|
||||
},
|
||||
"tools": {
|
||||
"trace_as_metadata": true,
|
||||
"list": true,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": [],
|
||||
"name": "tools",
|
||||
"display_name": "Tools",
|
||||
"advanced": false,
|
||||
"input_types": ["Tool"],
|
||||
"dynamic": false,
|
||||
"info": "Tools at agents disposal",
|
||||
"title_case": false,
|
||||
"type": "other"
|
||||
},
|
||||
"allow_delegation": {
|
||||
"trace_as_metadata": true,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": true,
|
||||
"name": "allow_delegation",
|
||||
"display_name": "Allow Delegation",
|
||||
"advanced": false,
|
||||
"dynamic": false,
|
||||
"info": "Whether the agent is allowed to delegate tasks to other agents.",
|
||||
"title_case": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"backstory": {
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"load_from_db": false,
|
||||
"list": false,
|
||||
"required": true,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "backstory",
|
||||
"display_name": "Backstory",
|
||||
"advanced": false,
|
||||
"input_types": ["Message"],
|
||||
"dynamic": false,
|
||||
"info": "The backstory of the agent.",
|
||||
"title_case": false,
|
||||
"type": "str"
|
||||
},
|
||||
"code": {
|
||||
"type": "code",
|
||||
"required": true,
|
||||
"placeholder": "",
|
||||
"list": false,
|
||||
"show": true,
|
||||
"multiline": true,
|
||||
"value": "# from langflow.field_typing import Data\nfrom langflow.custom import Component\nfrom langflow.io import MessageTextInput, Output\nfrom langflow.schema import Data\nfrom langflow.io import BoolInput, IntInput, DictInput, DropdownInput, MessageTextInput, HandleInput\nfrom crewai import Agent\n\n\nclass CrewAIAgent(Component):\n display_name = \"CrewAIAgent\"\n description = \"Represents an agent of CrewAI.\"\n documentation: str = \"https://docs.crewai.com/how-to/LLM-Connections/\"\n icon = \"CrewAI\"\n\n inputs = [\n MessageTextInput(name=\"role\", display_name=\"Role\", info=\"The role of the agent.\", required=True),\n MessageTextInput(name=\"goal\", display_name=\"Goal\", info=\"The objective of the agent.\", required=True),\n MessageTextInput(name=\"backstory\", display_name=\"Backstory\", info=\"The backstory of the agent.\", required=True),\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 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=\"Output\", name=\"output\", method=\"build_output\"),\n ]\n \n\n def build_output(self) -> Agent:\n kwargs = self.kwargs if self.kwargs else {}\n agent = Agent(\n role=self.role,\n goal=self.goal,\n backstory=self.backstory,\n llm=self.llm,\n verbose=self.verbose,\n memory=self.memory,\n tools=self.tools if self.tools else [],\n allow_delegation=self.allow_delegation,\n **kwargs\n )\n self.status = agent\n return agent\n",
|
||||
"fileTypes": [],
|
||||
"file_path": "",
|
||||
"password": false,
|
||||
"name": "code",
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
"info": "",
|
||||
"load_from_db": false,
|
||||
"title_case": false
|
||||
},
|
||||
"goal": {
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"load_from_db": false,
|
||||
"list": false,
|
||||
"required": true,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "goal",
|
||||
"display_name": "Goal",
|
||||
"advanced": false,
|
||||
"input_types": ["Message"],
|
||||
"dynamic": false,
|
||||
"info": "The objective of the agent.",
|
||||
"title_case": false,
|
||||
"type": "str"
|
||||
},
|
||||
"kwargs": {
|
||||
"trace_as_input": true,
|
||||
"list": true,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": {},
|
||||
"name": "kwargs",
|
||||
"display_name": "kwargs",
|
||||
"advanced": true,
|
||||
"dynamic": false,
|
||||
"info": "kwargs of agent.",
|
||||
"title_case": false,
|
||||
"type": "dict"
|
||||
},
|
||||
"memory": {
|
||||
"trace_as_metadata": true,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": true,
|
||||
"name": "memory",
|
||||
"display_name": "Memory",
|
||||
"advanced": true,
|
||||
"dynamic": false,
|
||||
"info": "Whether the agent should have memory or not",
|
||||
"title_case": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"role": {
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"load_from_db": false,
|
||||
"list": false,
|
||||
"required": true,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "role",
|
||||
"display_name": "Role",
|
||||
"advanced": false,
|
||||
"input_types": ["Message"],
|
||||
"dynamic": false,
|
||||
"info": "The role of the agent.",
|
||||
"title_case": false,
|
||||
"type": "str"
|
||||
},
|
||||
"verbose": {
|
||||
"trace_as_metadata": true,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": false,
|
||||
"name": "verbose",
|
||||
"display_name": "Verbose",
|
||||
"advanced": true,
|
||||
"dynamic": false,
|
||||
"info": "",
|
||||
"title_case": false,
|
||||
"type": "bool"
|
||||
}
|
||||
},
|
||||
"description": "Represents an agent of CrewAI.",
|
||||
"icon": "CrewAI",
|
||||
"base_classes": ["Agent"],
|
||||
"display_name": "CrewAIAgent",
|
||||
"documentation": "https://docs.crewai.com/how-to/LLM-Connections/",
|
||||
"custom_fields": {},
|
||||
"output_types": [],
|
||||
"pinned": false,
|
||||
"conditional_paths": [],
|
||||
"frozen": false,
|
||||
"outputs": [
|
||||
{
|
||||
"types": ["Agent"],
|
||||
"selected": "Agent",
|
||||
"name": "output",
|
||||
"display_name": "Output",
|
||||
"method": "build_output",
|
||||
"value": "__UNDEFINED__",
|
||||
"cache": true
|
||||
}
|
||||
],
|
||||
"field_order": [
|
||||
"role",
|
||||
"goal",
|
||||
"backstory",
|
||||
"tools",
|
||||
"llm",
|
||||
"memory",
|
||||
"verbose",
|
||||
"allow_delegation",
|
||||
"kwargs"
|
||||
],
|
||||
"beta": false,
|
||||
"edited": true
|
||||
},
|
||||
"id": "CustomComponent-j27OA",
|
||||
"description": "Represents an agent of CrewAI.",
|
||||
"display_name": "CrewAIAgent"
|
||||
},
|
||||
"selected": false,
|
||||
"width": 384,
|
||||
"height": 668,
|
||||
"positionAbsolute": {
|
||||
"x": 257.58598820460725,
|
||||
"y": -171.98904954008663
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "CustomComponent-4UaNS",
|
||||
"type": "genericNode",
|
||||
"position": { "x": 677.4952370910181, "y": -169.34324846822471 },
|
||||
"data": {
|
||||
"type": "CustomComponent",
|
||||
"node": {
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"agent": {
|
||||
"trace_as_metadata": true,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "agent",
|
||||
"display_name": "Agent",
|
||||
"advanced": false,
|
||||
"input_types": ["Agent"],
|
||||
"dynamic": false,
|
||||
"info": "Agent responsible for task execution. Represents entity performing task.",
|
||||
"title_case": false,
|
||||
"type": "other"
|
||||
},
|
||||
"tools": {
|
||||
"trace_as_metadata": true,
|
||||
"list": true,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "tools",
|
||||
"display_name": "Tools",
|
||||
"advanced": false,
|
||||
"input_types": ["Tool"],
|
||||
"dynamic": false,
|
||||
"info": "List of tools/resources limited for task execution.",
|
||||
"title_case": false,
|
||||
"type": "other"
|
||||
},
|
||||
"async_execution": {
|
||||
"trace_as_metadata": true,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": true,
|
||||
"name": "async_execution",
|
||||
"display_name": "Async Execution",
|
||||
"advanced": true,
|
||||
"dynamic": false,
|
||||
"info": "Boolean flag indicating asynchronous task execution.",
|
||||
"title_case": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"code": {
|
||||
"type": "code",
|
||||
"required": true,
|
||||
"placeholder": "",
|
||||
"list": false,
|
||||
"show": true,
|
||||
"multiline": true,
|
||||
"value": "from langflow.custom import Component\nfrom langflow.io import BoolInput, DictInput, DropdownInput, MessageTextInput, HandleInput\nfrom crewai import Task, Agent\n\nclass CrewAITask(Component):\n display_name: str = \"CrewAITask\"\n description: str = \"Each task must have a description, an expected output and an agent responsible for execution.\"\n documentation: str = \"https://docs.crewai.com/how-to/LLM-Connections/\"\n icon = \"CrewAI\"\n \n inputs = [\n MessageTextInput(\n name=\"description\",\n display_name=\"Description\",\n info=\"Descriptive text detailing task's purpose and execution.\",\n required=True,\n ),\n MessageTextInput(\n name=\"expected_output\",\n display_name=\"Expected Output\",\n info=\"Clear definition of expected task outcome.\",\n required=True,\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.\",\n ),\n HandleInput(\n name=\"agent\",\n display_name=\"Agent\",\n input_types=[\"Agent\"],\n info=\"Agent responsible for task execution. Represents entity performing task.\",\n ),\n BoolInput(\n name=\"async_execution\",\n display_name=\"Async Execution\",\n value=False,\n advanced=True,\n info=\"Boolean flag indicating asynchronous task execution.\",\n ),\n ]\n \n outputs = [\n # Output(display_name=\"Agent\", name=\"agent_output\", method=\"agent_response\"),\n Output(display_name=\"Task\", name=\"task_output\", method=\"build_task\"),\n ]\n\n def agent_response(self) -> Agent:\n output = self.agent\n self.status = output\n return output\n\n def build_task(self) -> Task:\n task = Task(\n description=self.description,\n expected_output=self.expected_output,\n tools=self.tools if self.tools else [],\n async_execution=self.async_execution,\n agent=self.agent\n )\n self.status = task\n return task\n",
|
||||
"fileTypes": [],
|
||||
"file_path": "",
|
||||
"password": false,
|
||||
"name": "code",
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
"info": "",
|
||||
"load_from_db": false,
|
||||
"title_case": false
|
||||
},
|
||||
"description": {
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"load_from_db": false,
|
||||
"list": false,
|
||||
"required": true,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "description",
|
||||
"display_name": "Description",
|
||||
"advanced": false,
|
||||
"input_types": ["Message"],
|
||||
"dynamic": false,
|
||||
"info": "Descriptive text detailing task's purpose and execution.",
|
||||
"title_case": false,
|
||||
"type": "str"
|
||||
},
|
||||
"expected_output": {
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"load_from_db": false,
|
||||
"list": false,
|
||||
"required": true,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "expected_output",
|
||||
"display_name": "Expected Output",
|
||||
"advanced": false,
|
||||
"input_types": ["Message"],
|
||||
"dynamic": false,
|
||||
"info": "Clear definition of expected task outcome.",
|
||||
"title_case": false,
|
||||
"type": "str"
|
||||
}
|
||||
},
|
||||
"description": "Each task must have a description, an expected output and an agent responsible for execution.",
|
||||
"icon": "CrewAI",
|
||||
"base_classes": ["Task"],
|
||||
"display_name": "CrewAITask",
|
||||
"documentation": "https://docs.crewai.com/how-to/LLM-Connections/",
|
||||
"custom_fields": {},
|
||||
"output_types": [],
|
||||
"pinned": false,
|
||||
"conditional_paths": [],
|
||||
"frozen": false,
|
||||
"outputs": [
|
||||
{
|
||||
"types": ["Task"],
|
||||
"selected": "Task",
|
||||
"name": "task_output",
|
||||
"display_name": "Task",
|
||||
"method": "build_task",
|
||||
"value": "__UNDEFINED__",
|
||||
"cache": true
|
||||
}
|
||||
],
|
||||
"field_order": [
|
||||
"description",
|
||||
"expected_output",
|
||||
"tools",
|
||||
"agent",
|
||||
"async_execution"
|
||||
],
|
||||
"beta": false,
|
||||
"edited": true
|
||||
},
|
||||
"id": "CustomComponent-4UaNS",
|
||||
"description": "Each task must have a description, an expected output and an agent responsible for execution.",
|
||||
"display_name": "CrewAITask"
|
||||
},
|
||||
"selected": false,
|
||||
"width": 384,
|
||||
"height": 526,
|
||||
"dragging": false,
|
||||
"positionAbsolute": { "x": 677.4952370910181, "y": -169.34324846822471 }
|
||||
},
|
||||
{
|
||||
"id": "CustomComponent-OiXk9",
|
||||
"type": "genericNode",
|
||||
"position": { "x": 1096.3000687375263, "y": -163.76595453399347 },
|
||||
"data": {
|
||||
"type": "CustomComponent",
|
||||
"node": {
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"agents": {
|
||||
"trace_as_metadata": true,
|
||||
"list": true,
|
||||
"required": true,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "agents",
|
||||
"display_name": "Agents",
|
||||
"advanced": false,
|
||||
"input_types": ["Agent"],
|
||||
"dynamic": false,
|
||||
"info": "",
|
||||
"title_case": false,
|
||||
"type": "other"
|
||||
},
|
||||
"tasks": {
|
||||
"trace_as_metadata": true,
|
||||
"list": true,
|
||||
"required": true,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "tasks",
|
||||
"display_name": "Tasks",
|
||||
"advanced": false,
|
||||
"input_types": ["Task"],
|
||||
"dynamic": false,
|
||||
"info": "",
|
||||
"title_case": false,
|
||||
"type": "other"
|
||||
},
|
||||
"code": {
|
||||
"type": "code",
|
||||
"required": true,
|
||||
"placeholder": "",
|
||||
"list": false,
|
||||
"show": true,
|
||||
"multiline": true,
|
||||
"value": "from langflow.custom import Component\r\nfrom crewai import Crew, Task, Agent, Process\r\nfrom typing import List, Optional\r\nfrom langflow.field_typing import Text\r\nfrom langflow.io import NestedDictInput, DropdownInput, MessageTextInput, HandleInput\r\nfrom langflow.schema.message import Message\r\n\r\nclass CrewAICrew(Component):\r\n display_name: str = \"CrewAICrew\"\r\n description: str = \"Represents a group of agents, defining how they should collaborate and the tasks they should perform.\"\r\n documentation: str = \"https://docs.crewai.com/how-to/LLM-Connections/\"\r\n icon = \"CrewAI\"\r\n\r\n inputs = [\r\n HandleInput(name=\"agents\", display_name=\"Agents\", input_types=[\"Agent\"], is_list=True, required=True),\r\n HandleInput(name=\"tasks\", display_name=\"Tasks\", input_types=[\"Task\"], is_list=True, required=True),\r\n MessageTextInput(name=\"topic\", display_name=\"Topic\", value = \"\"),\r\n IntInput(name=\"verbose\", display_name=\"Verbose\", value=0, advanced=True),\r\n BoolInput(name=\"memory\", display_name=\"Memory\", value=False, advanced=True),\r\n BoolInput(name=\"use_cache\", display_name=\"Cache\", value=True, advanced=True),\r\n IntInput(name=\"max_rpm\", display_name=\"Max RPM\", value=100, advanced=True),\r\n DropdownInput(name=\"process\", display_name=\"Process\", value=Process.sequential, options=[Process.sequential,Process.hierarchical]),\r\n BoolInput(name=\"share_crew\", display_name=\"Share Crew\", value=False, advanced=True),\r\n NestedDictInput(name=\"input\", display_name=\"Input\", value={\"topic\": \"\"}, is_list=True),\r\n ]\r\n \r\n outputs = [\r\n Output(display_name=\"Output\", name=\"output\", method=\"build_output\"),\r\n ]\r\n\r\n async def build_output(self) -> Message:\r\n if not self.agents or not self.tasks:\r\n raise ValueError(\"No agents or tasks have been added.\")\r\n with open(\"dir.txt\",\"w\") as f:\r\n f.write(str(dir(Crew)))\r\n response = Crew(\r\n agents=self.agents,\r\n tasks=self.tasks,\r\n process=Process.sequential,\r\n verbose=self.verbose,\r\n memory=self.memory,\r\n cache=self.use_cache,\r\n max_rpm=self.max_rpm,\r\n share_crew=self.share_crew,\r\n )\r\n message = await response.kickoff_async(inputs=self.input)\r\n self.status = message\r\n return message\r\n\r\n",
|
||||
"fileTypes": [],
|
||||
"file_path": "",
|
||||
"password": false,
|
||||
"name": "code",
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
"info": "",
|
||||
"load_from_db": false,
|
||||
"title_case": false
|
||||
},
|
||||
"input": {
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"list": true,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": { "topic": "" },
|
||||
"name": "input",
|
||||
"display_name": "Input",
|
||||
"advanced": false,
|
||||
"dynamic": false,
|
||||
"info": "",
|
||||
"title_case": false,
|
||||
"type": "NestedDict"
|
||||
},
|
||||
"max_rpm": {
|
||||
"trace_as_metadata": true,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": 100,
|
||||
"name": "max_rpm",
|
||||
"display_name": "Max RPM",
|
||||
"advanced": true,
|
||||
"dynamic": false,
|
||||
"info": "",
|
||||
"title_case": false,
|
||||
"type": "int"
|
||||
},
|
||||
"memory": {
|
||||
"trace_as_metadata": true,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": false,
|
||||
"name": "memory",
|
||||
"display_name": "Memory",
|
||||
"advanced": true,
|
||||
"dynamic": false,
|
||||
"info": "",
|
||||
"title_case": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"process": {
|
||||
"trace_as_metadata": true,
|
||||
"options": ["sequential", "hierarchical"],
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "sequential",
|
||||
"name": "process",
|
||||
"display_name": "Process",
|
||||
"advanced": false,
|
||||
"dynamic": false,
|
||||
"info": "",
|
||||
"title_case": false,
|
||||
"type": "str"
|
||||
},
|
||||
"share_crew": {
|
||||
"trace_as_metadata": true,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": true,
|
||||
"name": "share_crew",
|
||||
"display_name": "Share Crew",
|
||||
"advanced": true,
|
||||
"dynamic": false,
|
||||
"info": "",
|
||||
"title_case": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"topic": {
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"load_from_db": false,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "topic",
|
||||
"display_name": "Topic",
|
||||
"advanced": false,
|
||||
"input_types": ["Message"],
|
||||
"dynamic": false,
|
||||
"info": "",
|
||||
"title_case": false,
|
||||
"type": "str"
|
||||
},
|
||||
"use_cache": {
|
||||
"trace_as_metadata": true,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": true,
|
||||
"name": "use_cache",
|
||||
"display_name": "Cache",
|
||||
"advanced": true,
|
||||
"dynamic": false,
|
||||
"info": "",
|
||||
"title_case": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"verbose": {
|
||||
"trace_as_metadata": true,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "0",
|
||||
"name": "verbose",
|
||||
"display_name": "Verbose",
|
||||
"advanced": true,
|
||||
"dynamic": false,
|
||||
"info": "",
|
||||
"title_case": false,
|
||||
"type": "int"
|
||||
}
|
||||
},
|
||||
"description": "Represents a group of agents, defining how they should collaborate and the tasks they should perform.",
|
||||
"icon": "CrewAI",
|
||||
"base_classes": ["Message"],
|
||||
"display_name": "CrewAICrew",
|
||||
"documentation": "https://docs.crewai.com/how-to/LLM-Connections/",
|
||||
"custom_fields": {},
|
||||
"output_types": [],
|
||||
"pinned": false,
|
||||
"conditional_paths": [],
|
||||
"frozen": false,
|
||||
"outputs": [
|
||||
{
|
||||
"types": ["Message"],
|
||||
"selected": "Message",
|
||||
"name": "output",
|
||||
"display_name": "Output",
|
||||
"method": "build_output",
|
||||
"value": "__UNDEFINED__",
|
||||
"cache": true
|
||||
}
|
||||
],
|
||||
"field_order": [
|
||||
"agents",
|
||||
"tasks",
|
||||
"topic",
|
||||
"verbose",
|
||||
"memory",
|
||||
"use_cache",
|
||||
"max_rpm",
|
||||
"process",
|
||||
"share_crew",
|
||||
"input"
|
||||
],
|
||||
"beta": false,
|
||||
"edited": true
|
||||
},
|
||||
"id": "CustomComponent-OiXk9",
|
||||
"description": "Represents a group of agents, defining how they should collaborate and the tasks they should perform.",
|
||||
"display_name": "CrewAICrew"
|
||||
},
|
||||
"selected": false,
|
||||
"width": 384,
|
||||
"height": 631,
|
||||
"positionAbsolute": {
|
||||
"x": 1096.3000687375263,
|
||||
"y": -163.76595453399347
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"id": "CustomComponent-ZGe4u",
|
||||
"type": "genericNode",
|
||||
"position": { "x": -181.09156441161912, "y": -164.86510111633868 },
|
||||
"data": {
|
||||
"type": "CustomComponent",
|
||||
"node": {
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"code": {
|
||||
"type": "code",
|
||||
"required": true,
|
||||
"placeholder": "",
|
||||
"list": false,
|
||||
"show": true,
|
||||
"multiline": true,
|
||||
"value": "# from langflow.field_typing import Data\nfrom langflow.custom import Component\nfrom langflow.schema import Data\nfrom langchain.agents import Tool\nfrom langflow.io import MessageTextInput, Output, SecretStrInput\nfrom crewai_tools import GithubSearchTool\n\n\nclass CrewAIGithubSearchTool(Component):\n display_name = \"CrewAIGithubSearchTool\"\n description = \"Search a github repo's content\"\n icon = \"CrewAI\"\n\n inputs = [\n MessageTextInput(name=\"github_repo\", display_name=\"Github Repo\", info=\"Fill it if you want to filter by specific github repo\"),\n SecretStrInput(name=\"gh_token\", display_name=\"Github Token\"),\n MessageTextInput(\n name=\"content_types\",\n display_name=\"Content Types\",\n value=[],\n info=\"Specifies the types of content to include in your search, options=['code', 'repo', 'pr', 'issue']\",\n is_list=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=\"Output\", name=\"output\", method=\"build_output\"),\n ]\n \n\n def build_output(self) -> Tool:\n if self.content_types is None or not all([(item in ['code', 'repo', 'pr', 'issue']) for item in self.content_types]):\n raise Exception(\"Each content_type must be one of: ['code', 'repo', 'pr', 'issue']\")\n kwargs = self.kwargs if self.kwargs else {}\n tool = GithubSearchTool(\n github_repo=self.github_repo,\n content_types=self.content_types,\n **kwargs\n ).to_langchain()\n self.status = tool\n return tool\n",
|
||||
"fileTypes": [],
|
||||
"file_path": "",
|
||||
"password": false,
|
||||
"name": "code",
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
"info": "",
|
||||
"load_from_db": false,
|
||||
"title_case": false
|
||||
},
|
||||
"content_types": {
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"load_from_db": false,
|
||||
"list": true,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": ["repo"],
|
||||
"name": "content_types",
|
||||
"display_name": "Content Types",
|
||||
"advanced": false,
|
||||
"input_types": ["Message"],
|
||||
"dynamic": false,
|
||||
"info": "Specifies the types of content to include in your search, options=['code', 'repo', 'pr', 'issue']",
|
||||
"title_case": false,
|
||||
"type": "str"
|
||||
},
|
||||
"gh_token": {
|
||||
"load_from_db": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "gh_token",
|
||||
"display_name": "Github Token",
|
||||
"advanced": false,
|
||||
"input_types": [],
|
||||
"dynamic": false,
|
||||
"info": "",
|
||||
"title_case": false,
|
||||
"password": true,
|
||||
"type": "str"
|
||||
},
|
||||
"github_repo": {
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"load_from_db": false,
|
||||
"list": false,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": "",
|
||||
"name": "github_repo",
|
||||
"display_name": "Github Repo",
|
||||
"advanced": false,
|
||||
"input_types": ["Message"],
|
||||
"dynamic": false,
|
||||
"info": "Fill it if you want to filter by specific github repo",
|
||||
"title_case": false,
|
||||
"type": "str"
|
||||
},
|
||||
"kwargs": {
|
||||
"trace_as_input": true,
|
||||
"list": true,
|
||||
"required": false,
|
||||
"placeholder": "",
|
||||
"show": true,
|
||||
"value": {},
|
||||
"name": "kwargs",
|
||||
"display_name": "kwargs",
|
||||
"advanced": true,
|
||||
"dynamic": false,
|
||||
"info": "kwargs of agent.",
|
||||
"title_case": false,
|
||||
"type": "dict"
|
||||
}
|
||||
},
|
||||
"description": "Search a github repo's content",
|
||||
"icon": "CrewAI",
|
||||
"base_classes": ["Tool"],
|
||||
"display_name": "GithubSearchToolSchema",
|
||||
"documentation": "",
|
||||
"custom_fields": {},
|
||||
"output_types": [],
|
||||
"pinned": false,
|
||||
"conditional_paths": [],
|
||||
"frozen": false,
|
||||
"outputs": [
|
||||
{
|
||||
"types": ["Tool"],
|
||||
"selected": "Tool",
|
||||
"name": "output",
|
||||
"display_name": "Output",
|
||||
"method": "build_output",
|
||||
"value": "__UNDEFINED__",
|
||||
"cache": true,
|
||||
"hidden": false
|
||||
}
|
||||
],
|
||||
"field_order": [
|
||||
"github_repo",
|
||||
"gh_token",
|
||||
"content_types",
|
||||
"kwargs"
|
||||
],
|
||||
"beta": false,
|
||||
"edited": false
|
||||
},
|
||||
"id": "CustomComponent-ZGe4u",
|
||||
"description": "Search a github repo's content",
|
||||
"display_name": "GithubSearchToolSchema"
|
||||
},
|
||||
"selected": false,
|
||||
"width": 384,
|
||||
"height": 495,
|
||||
"positionAbsolute": {
|
||||
"x": -181.09156441161912,
|
||||
"y": -164.86510111633868
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
],
|
||||
"edges": [],
|
||||
"viewport": {
|
||||
"x": 200.0180336822798,
|
||||
"y": 213.68209801369642,
|
||||
"zoom": 0.6935154845656925
|
||||
}
|
||||
},
|
||||
"description": "The CrewAI Bundle with Agent, Task, crew and tool components.",
|
||||
"name": "CrewAI Bundle",
|
||||
"last_tested_version": "",
|
||||
"endpoint_name": null,
|
||||
"is_component": false
|
||||
}
|
||||