Icon

CrewAI - AI-Agents scan your document and solve your Task using Ollama

KNIME and CrewAI - use an AI-Agent system to use a local file like (PDF, CSV, TXT, JSON ...) and let a local LLM like Llama3 solve your tasks

KNIME and CrewAI - use an AI-Agent system to use a local file like (PDF, CSV, TXT, JSON ...) and let a local LLM like Llama3 solve your tasks

The agents will 'discuss' among themselvesm use the documents provided and come back with a (hopefully) perfect soltion to your task based on the instructions you gave

---
Adapted from:

Integrating Agent Frameworks into Low Code Tools: Making CrewAI work in KNIME
https://medium.com/p/a7fecb042915
https://hub.knime.com/lowcodeaiftw/spaces/Public/LLMs/CrewAI~lgdow45tWuhhb4fT/

by https://medium.com/@martindausa


Prerequisites:Ideally, the KNIME 4.7 (or higher) Version Installed including Python Integration Extension.Custom Python Environment set up including key KNIME Packages and CrewAI package aswell as Ollama (also pull the LLM models you want to use).cf. "py_knime_crewai.yml" in the /data/ folderDefine Agents:Agent NameAgent GoalAgent BackstoryAgent Model (currently Llama3 and Mistral, vou can add more)Define Tasks with Documents:Task NameTask DescriptionAssign Agent to perform the TaskThe Parameter with the document path is preassigned (Do not change)Flexibility to inject certain parameters into the task (ParameterName: ParameterValue)Further Hints:Using an agent system seem attractive but will provide you with an additional set ofchallenges (especially when wrapping it in KNIME nodes to meke it easier to access).Currently we try to get back a JSON file that should either stand alone of be enclosed inbackticks (```) that you might have to process further.One option would b eto further explore the "expected_output" setting (currently empty) in orderto get the system to give back a -well- defined output. Define Agents and their models Define the Tasks - in this case we have tasks that would have adocument as a parameter. And although we also provide thedocument in the code it seems the agents also do want to havethe document within the task itself.{path_to_document} Concatenate Agent and Task OutputsNote:Add new Agents / Tasks by copying respective components. Make sureto add additional input ports to Concat nodes and connect new Agents/tasks accordingly Kickoff your Agents - you can check the progress and the results in the log folder../data/chat/ollama_crewai_rag_<...> Adapted from:Integrating Agent Frameworks into Low Code Tools: Making CrewAI work in KNIMEhttps://medium.com/p/a7fecb042915by https://medium.com/@martindausa KNIME and CrewAI - use an AI-Agent system to use a local file like (PDF, CSV, TXT, JSON ...) and let a local LLM like Llama3 solve your tasksThe agents will 'discuss' among themselvesm use the documents provided and come back with a (hopefully) perfect soltion to your task based on the instructions you gave Maybe download the whole LLM workflow group in order to get all the folders and documents(https://hub.knime.com/mlauber71/spaces/LLM_Space/~17k4zAECNryrZw1X/) Make sure you have the Ollama models pulled locally andthey are runningollama pull mxbai-embed-largeollama pull mistral:instructollama pull llama3:instructollama pull llama3.1ollama run mistral:instructollama run llama3:instructollama run llama3.1 work in progress A Task without access to documents Propagate Python environmentfor KNIME on MacOSX (Apple Scilicon)OR Windowswith Miniforge / Minicondaconfigure how to handle the environmentdefault = just check the namesExpert for Bank StatementsJSON Structure ExpertCreate a sample JSON structure from Bank Statements=> provide the link to the document as Parameter (again){path_to_document} collect AgentsTask DetailsTaskParameterDetailsCrewAI using localOllama / Llama3 / Mistralcurrent timescan for PDF-FilesURIFile Pathollama_crewai_rag_olama_crewai_locate and create/data/ folderwith absolute pathslist_files=> if you want just one filepath_to_documentconvert to string!!! only one document currentlypath_to_documentWrite a flat JSON filevar_document_folderbank_01=> try to avoid special characers and blanks in paths and file namesvar_document_folderFile Path escapedpath_to_documentlist_fileskeep as Listlist_filescooperationmax iterationsTask DetailsTaskParameterDetailsWrite a flat JSON file=> provide the link to the document as Parameter (again){path_to_document} conda_crewai_knime4 Define Agent Define Agent Define Taskwith Document Concatenate Concatenate Concatenate Python Script Create Date&TimeRange List Files/Folders Path to URI URL to File Path GroupBy create filename to collect Table Writer Collect LocalMetadata Java EditVariable (simple) Column Rename Row Filter Table Rowto Variable Agents Tasks TaskDetails Define Task Java EditVariable (simple) String to Path(Variable) Java Snippet Column Expressions Column Rename Table Rowto Variable Merge Variables Basic Settings Java Snippet Java Snippet Define Taskwith Document Prerequisites:Ideally, the KNIME 4.7 (or higher) Version Installed including Python Integration Extension.Custom Python Environment set up including key KNIME Packages and CrewAI package aswell as Ollama (also pull the LLM models you want to use).cf. "py_knime_crewai.yml" in the /data/ folderDefine Agents:Agent NameAgent GoalAgent BackstoryAgent Model (currently Llama3 and Mistral, vou can add more)Define Tasks with Documents:Task NameTask DescriptionAssign Agent to perform the TaskThe Parameter with the document path is preassigned (Do not change)Flexibility to inject certain parameters into the task (ParameterName: ParameterValue)Further Hints:Using an agent system seem attractive but will provide you with an additional set ofchallenges (especially when wrapping it in KNIME nodes to meke it easier to access).Currently we try to get back a JSON file that should either stand alone of be enclosed inbackticks (```) that you might have to process further.One option would b eto further explore the "expected_output" setting (currently empty) in orderto get the system to give back a -well- defined output. Define Agents and their models Define the Tasks - in this case we have tasks that would have adocument as a parameter. And although we also provide thedocument in the code it seems the agents also do want to havethe document within the task itself.{path_to_document} Concatenate Agent and Task OutputsNote:Add new Agents / Tasks by copying respective components. Make sureto add additional input ports to Concat nodes and connect new Agents/tasks accordingly Kickoff your Agents - you can check the progress and the results in the log folder../data/chat/ollama_crewai_rag_<...> Adapted from:Integrating Agent Frameworks into Low Code Tools: Making CrewAI work in KNIMEhttps://medium.com/p/a7fecb042915by https://medium.com/@martindausa KNIME and CrewAI - use an AI-Agent system to use a local file like (PDF, CSV, TXT, JSON ...) and let a local LLM like Llama3 solve your tasksThe agents will 'discuss' among themselvesm use the documents provided and come back with a (hopefully) perfect soltion to your task based on the instructions you gave Maybe download the whole LLM workflow group in order to get all the folders and documents(https://hub.knime.com/mlauber71/spaces/LLM_Space/~17k4zAECNryrZw1X/) Make sure you have the Ollama models pulled locally andthey are runningollama pull mxbai-embed-largeollama pull mistral:instructollama pull llama3:instructollama pull llama3.1ollama run mistral:instructollama run llama3:instructollama run llama3.1 work in progress A Task without access to documents Propagate Python environmentfor KNIME on MacOSX (Apple Scilicon)OR Windowswith Miniforge / Minicondaconfigure how to handle the environmentdefault = just check the namesExpert for Bank StatementsJSON Structure ExpertCreate a sample JSON structure from Bank Statements=> provide the link to the document as Parameter (again){path_to_document} collect AgentsTask DetailsTaskParameterDetailsCrewAI using localOllama / Llama3 / Mistralcurrent timescan for PDF-FilesURIFile Pathollama_crewai_rag_olama_crewai_locate and create/data/ folderwith absolute pathslist_files=> if you want just one filepath_to_documentconvert to string!!! only one document currentlypath_to_documentWrite a flat JSON filevar_document_folderbank_01=> try to avoid special characers and blanks in paths and file namesvar_document_folderFile Path escapedpath_to_documentlist_fileskeep as Listlist_filescooperationmax iterationsTask DetailsTaskParameterDetailsWrite a flat JSON file=> provide the link to the document as Parameter (again){path_to_document} conda_crewai_knime4 Define Agent Define Agent Define Taskwith Document Concatenate Concatenate Concatenate Python Script Create Date&TimeRange List Files/Folders Path to URI URL to File Path GroupBy create filename to collect Table Writer Collect LocalMetadata Java EditVariable (simple) Column Rename Row Filter Table Rowto Variable Agents Tasks TaskDetails Define Task Java EditVariable (simple) String to Path(Variable) Java Snippet Column Expressions Column Rename Table Rowto Variable Merge Variables Basic Settings Java Snippet Java Snippet Define Taskwith Document

Nodes

Extensions

Links