install linting solution and pre-commit hook

This commit is contained in:
Luan Citta
2024-06-05 11:53:04 +01:00
parent 0a3105a536
commit 6ea99ed0ff
6 changed files with 123 additions and 17 deletions
+9
View File
@@ -0,0 +1,9 @@
[flake8]
max-line-length = 95
exclude =
.git,
__pycache__,
docs,
old,
build,
dist
+10
View File
@@ -0,0 +1,10 @@
repos:
- repo: local
hooks:
- id: flake8
name: Run flake8
entry: bash -c "flake8"
language: python
pass_filenames: false
files: ^.py/
types: [python]
+2 -2
View File
@@ -1,4 +1,4 @@
# from .nodes.textview_node import TextViewNode
from .nodes.textview_node import TextViewNode
from .nodes.agent_node import AgentNode
from .nodes.task_node import TaskNode
from .nodes.crew_node import CrewNode
@@ -11,7 +11,7 @@ NODE_CLASS_MAPPINGS = {
"📎CrewAI Crew": CrewNode,
"📎CrewAI Task List": TaskList,
"📎CrewAI Agent List": AgentList,
# "📎CrewAI View Text": TextViewNode, (WIP)
"📎CrewAI View Text": TextViewNode,
}
WEB_DIRECTORY = "./js"
+11 -5
View File
@@ -1,5 +1,6 @@
from crewai import Agent
class AgentNode:
def __init__(self):
pass
@@ -8,13 +9,19 @@ class AgentNode:
def INPUT_TYPES(s):
return {
"required": {
"role": ("STRING", {"forceInput": True, "multiline": True, "default": ""}),
"goal": ("STRING", {"forceInput": True, "multiline": True, "default": ""}),
"backstory": ("STRING", {"forceInput": True, "multiline": True, "default": ""}),
"role": ("STRING", {
"forceInput": True, "multiline": True, "default": ""
}),
"goal": ("STRING", {
"forceInput": True, "multiline": True, "default": ""
}),
"backstory": ("STRING", {
"forceInput": True, "multiline": True, "default": ""
}),
},
"optional": {
"verbose": ("BOOL", {"default": False}),
"allow_delegation": ("BOOL", { "default": True}),
"allow_delegation": ("BOOL", {"default": True}),
},
}
@@ -24,7 +31,6 @@ class AgentNode:
CATEGORY = "📎CrewAi"
def create_agent(self, role, goal, backstory, verbose=False, allow_delegation=True):
agent = Agent(
role=role,
goal=goal,
+11 -8
View File
@@ -1,6 +1,7 @@
from .base_node import BaseNode
from crewai import Crew, Process
class CrewNode(BaseNode):
def __init__(self):
pass
@@ -12,9 +13,14 @@ class CrewNode(BaseNode):
"tasks": ("TASK", {"default": []}),
},
"optional": {
"topic": ("STRING", {"forceInput": False, "multiline": True,"default": ""}),
"topic": ("STRING", {
"forceInput": False, "multiline": True, "default": ""
}),
"agents": ("AGENT", {"forceInput": False, "default": []}),
"process": ("STRING", {"default": "sequential", "choices": ["sequential", "hierarchical"]}),
"process": ("STRING", {
"default": "sequential",
"choices": ["sequential", "hierarchical"]
}),
},
}
INPUT_IS_LIST = (True, True, False, False)
@@ -23,7 +29,8 @@ class CrewNode(BaseNode):
def create_crew(self, tasks, process, topic="", agents=[]):
# Determine the process type
process_type = Process.sequential if process[0] == "sequential" else Process.hierarchical
isSequential: bool = process[0] == "sequential"
process_type = Process.sequential if isSequential else Process.hierarchical
# Create the Crew instance
crew = Crew(
@@ -32,11 +39,7 @@ class CrewNode(BaseNode):
process=process_type,
topic=topic,
)
# Kick off the process and capture the result
result = crew.kickoff(inputs={'topic': topic})
print("\n\n📎Crew AI - result", result)
return (result, crew.usage_metrics)
return (result, crew.usage_metrics)
+80 -2
View File
@@ -1,2 +1,80 @@
crewai==0.30.11
crewai-tools==0.2.6
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
_libgcc_mutex=0.1=main
_openmp_mutex=5.1=1_gnu
aiohttp=3.9.5=pypi_0
aiosignal=1.3.1=pypi_0
annotated-types=0.7.0=pypi_0
anyio=4.4.0=pypi_0
async-timeout=4.0.3=pypi_0
attrs=23.2.0=pypi_0
ca-certificates=2024.3.11=h06a4308_0
certifi=2024.6.2=pypi_0
cfgv=3.4.0=pypi_0
charset-normalizer=3.3.2=pypi_0
crewai=0.5.0=pypi_0
dataclasses-json=0.6.6=pypi_0
distlib=0.3.8=pypi_0
distro=1.9.0=pypi_0
exceptiongroup=1.2.1=pypi_0
filelock=3.14.0=pypi_0
flake8=7.0.0=pypi_0
frozenlist=1.4.1=pypi_0
greenlet=3.0.3=pypi_0
h11=0.14.0=pypi_0
httpcore=1.0.5=pypi_0
httpx=0.27.0=pypi_0
identify=2.5.36=pypi_0
idna=3.7=pypi_0
jsonpatch=1.33=pypi_0
jsonpointer=2.4=pypi_0
langchain=0.1.0=pypi_0
langchain-community=0.0.20=pypi_0
langchain-core=0.1.23=pypi_0
langchain-openai=0.0.2.post1=pypi_0
langsmith=0.0.87=pypi_0
ld_impl_linux-64=2.38=h1181459_1
libffi=3.4.4=h6a678d5_1
libgcc-ng=11.2.0=h1234567_1
libgomp=11.2.0=h1234567_1
libstdcxx-ng=11.2.0=h1234567_1
marshmallow=3.21.2=pypi_0
mccabe=0.7.0=pypi_0
multidict=6.0.5=pypi_0
mypy-extensions=1.0.0=pypi_0
ncurses=6.4=h6a678d5_0
nodeenv=1.9.1=pypi_0
numpy=1.26.4=pypi_0
openai=1.31.0=pypi_0
openssl=3.0.13=h7f8727e_2
packaging=23.2=pypi_0
pip=24.0=py39h06a4308_0
platformdirs=4.2.2=pypi_0
pre-commit=3.7.1=pypi_0
pycodestyle=2.11.1=pypi_0
pydantic=2.7.3=pypi_0
pydantic-core=2.18.4=pypi_0
pyflakes=3.2.0=pypi_0
python=3.9.19=h955ad1f_1
pyyaml=6.0.1=pypi_0
readline=8.2=h5eee18b_0
regex=2024.5.15=pypi_0
requests=2.32.3=pypi_0
setuptools=69.5.1=py39h06a4308_0
sniffio=1.3.1=pypi_0
sqlalchemy=2.0.30=pypi_0
sqlite=3.45.3=h5eee18b_0
tenacity=8.3.0=pypi_0
tiktoken=0.5.2=pypi_0
tk=8.6.14=h39e8969_0
tqdm=4.66.4=pypi_0
typing-extensions=4.12.1=pypi_0
typing-inspect=0.9.0=pypi_0
tzdata=2024a=h04d1e81_0
urllib3=2.2.1=pypi_0
virtualenv=20.26.2=pypi_0
wheel=0.43.0=py39h06a4308_0
xz=5.4.6=h5eee18b_1
yarl=1.9.4=pypi_0
zlib=1.2.13=h5eee18b_1