中文 | English
- Added universal API call node and a large number of auxiliary nodes for constructing the request body and grabbing the information in the response.
- Added empty model node, you can uninstall LLM from video memory at any location!
- The chatTTS node has been added, thank you very much for the contribution of guobalove!
model_path
parameter can be empty! It is recommended to useHF
mode to load the model, the model will be automatically downloaded from hugging face, no need to download manually; if usinglocal
loading, please put the model'sasset
andconfig
folders in the root directory. Baidu cloud address, extraction code: qyhu; if usingcustom
mode to load, please put the model'sasset
andconfig
folders undermodel_path
.
comfyui is an extremely minimalist UI interface, primarily used for AI drawing and other workflows based on the SD model. Comfyui_llm_party aims to develop a complete set of nodes for LLM workflow construction based on comfyui. It allows users to quickly and conveniently build their own LLM workflows and easily integrate them into their existing SD workflows.The picture shows a workflow of LLM implementing multi-tool calling, for more workflows please refer to the workflow folder.
-
Building a Modular AI with ComfyUI×LLM: A Step-by-Step Tutorial (Super Easy!)
-
Teach you GPT-4o access to comfyui | Make workflow call another workflow | Make LLM a tool
-
Disguise your workflow as GPT to access WeChat | Omost compatible! Flexibly create your own dalle3
-
For the instructions for using the node, please refer to: how to use nodes
-
If there are any issues with the plugin or you have other questions, feel free to join the QQ group: 931057213.
- Support all API calls in openai format, base_url selection reference config.ini.example, which has been tested so far:
- Most of the local models supported by the transformer library have been tested so far:
- THUDM/chatglm3-6b
- meta-llama/llama-2-7b-chat-hf
- Qwen/Qwen2-7B-Instruct
- xtuner/llava-llama-3-8b-v1_1-gguf
- omost-llama-3-8b-4bits
- Model download
- Baidu cloud address, extraction code: qyhu
- You can right-click in the comfyui interface, select
llm
from the context menu, and you will find the nodes for this project. how to use nodes - Supports API integration or local large model integration. Modular implementation for tool invocation.When entering the base_url, please use a URL that ends with
/v1/
.You can use ollama to manage your model. Then, enterhttp://127.0.0.1:11434/v1/
for the base_url,ollama
for the api_key, and your model name for the model_name, such as: llama3.
- API access sample workflow: start_with_LLM_api
- Local model access sample workflow: start_with_LLM_local
- ollama access sample workflow: ollama
- Local knowledge base integration with RAG support.sample workflow: Knowledge Base RAG Search
- Ability to invoke code interpreters.
- Enables online queries, including Google search support.sample workflow: movie query workflow
- Implement conditional statements within ComfyUI to categorize user queries and provide targeted responses.sample workflow: intelligent customer service
- Supports looping links for large models, allowing two large models to engage in debates.sample workflow: Tram Challenge Debate
- Attach any persona mask, customize prompt templates.
- Supports various tool invocations, including weather lookup, time lookup, knowledge base, code execution, web search, and single-page search.
- Use LLM as a tool node.sample workflow: LLM Matryoshka dolls
- Rapidly develop your own web applications using API + Streamlit.The picture below is an example of a drawing application.
- Added a dangerous omnipotent interpreter node that allows the large model to perform any task.
- It is recommended to use the
show_text
node under thefunction
submenu of the right-click menu as the display output for the LLM node. - Supported the visual features of GPT-4O!sample workflow:GPT-4o
- A new workflow intermediary has been added, which allows your workflow to call other workflows!sample workflow:Invoke another workflow
- Adapted to all models with an interface similar to OpenAI, such as: Tongyi Qianwen/QWEN, Zhigu Qingyan/GLM, DeepSeek, Kimi/Moonshot. Please fill in the base_url, api_key, and model_name of these models into the LLM node to call them.
- Added an LVM loader, now you can call the LVM model locally, support lava-llama-3-8b-v1_1-gguf model, other LVM models should theoretically run if they are GUFF format.The example workflow can be found here: start_with_LVM.json.
- I wrote a
fastapi.py
file, and if you run it directly, you’ll get an OpenAI interface onhttp://127.0.0.1:8817/v1/
. Any application that can call GPT can now invoke your comfyui workflow! I will create a tutorial to demonstrate the details on how to do this. - I’ve separated the LLM loader and the LLM chain, dividing the model loading and model configuration. This allows for sharing models across different LLM nodes!
- macOS and mps devices are now supported! Thanks to bigcat88 for their contribution!
- You can build your own interactive novel game, and go to different endings according to the user's choice! Example workflow reference: interactive_novel
- Adapted to OpenAI's whisper and tts functions, voice input and output can be realized. Example workflow reference: voice_input&voice_output
- Compatible with Omost!!! Please download omost-llama-3-8b-4bits to experience it now! Sample workflow reference: start_with_OMOST
- Added LLM tools to send messages to WeCom, DingTalk, and Feishu, as well as external functions to call.
- Added a new text iterator, which can output only part of the characters at a time. It is safe to split the text according to Carriage Return and chunk size, and will not be divided from the middle of the text. chunk_overlap refers to how many characters the divided text overlaps. In this way, you can enter super long text in batches, as long as you don't have a brain to click, or open the loop in comfyui to execute, it can be automatically executed. Remember to turn on the is_locked property, which can automatically lock the workflow at the end of the input and will not continue to execute. Example workflow: text iteration input
- Added the model name attribute to the local LLM loader, local llava loader, and local guff loader. If it is empty, it will be loaded using various local paths in the node. If it is not empty, it will be loaded using the path parameters you fill in yourself in
config.ini
. If it is not empty and not inconfig.ini
, it will be downloaded from huggingface or loaded from the model save directory of huggingface. If you want to download from huggingface, please fill in the format of for example:THUDM/glm-4-9b-chat
.Attention! Models loaded in this way must be adapted to the transformer library. - Adapted to CosyVoice, now you can use the TTS function directly without downloading any model or any API key. Currently the interface is only adapted to Chinese.
- Added JSON file parsing node and JSON value node, which allows you to get the value of a key from a file or text. Thanks to guobalove for your contribution!
- Improved the code of tool call. Now LLM without tool call function can also open is_tools_in_sys_prompt attribute (local LLM does not need to be opened by default, automatic adaptation). After opening, the tool information will be added to the system prompt word, so that LLM can call the tool.Related papers on implementation principles: Achieving Tool Calling Functionality in LLMs Using Only Prompt Engineering Without Fine-Tuning
- A new custom_tool folder is created to store the code of the custom tool. You can refer to the code in the custom_tool folder, put the code of the custom tool into the custom_tool folder, and you can call the custom tool in LLM.
- Added Knowledge Graph tool, so that LLM and Knowledge Graph can interact perfectly. LLM can modify Knowledge Graph according to your input, and can reason on Knowledge Graph to get the answers you need. Example workflow reference: graphRAG_neo4j
- Added personality AI function, 0 code to develop your own girlfriend AI or boyfriend AI, unlimited dialogue, permanent memory, stable personality. Example workflow reference: Mylover Personality AI
Install using one of the following methods:
- Search for comfyui_LLM_party in the comfyui manager and install it with one click.
- Restart comfyui.
- Navigate to the
custom_nodes
subfolder under the ComfyUI root folder. - Clone this repository with
git clone https://github.com/heshengtao/comfyui_LLM_party.git
.
- Click
CODE
in the upper right corner. - Click
download zip
. - Unzip the downloaded package into the
custom_nodes
subfolder under the ComfyUI root folder.
- Navigate to the
comfyui_LLM_party
project folder. - Enter
pip install -r requirements.txt
in the terminal to deploy the third-party libraries required by the project into the comfyui environment. Please ensure you are installing within the comfyui environment and pay attention to anypip
errors in the terminal. - If you are using the comfyui launcher, you need to enter
path_in_launcher_configuration\python_embeded\python.exe -m pip install -r requirements.txt
in the terminal to install. Thepython_embeded
folder is usually at the same level as yourComfyUI
folder. - If you have some environment configuration problems, you can try to use the dependencies in
requirements_fixed.txt
.
Configure the APIKEY using one of the following methods:
- Open the
config.ini
file in thecomfyui_LLM_party
project folder. - Enter your
openai_api_key
andbase_url
inconfig.ini
. - If you want to use the Google search tool, enter your
google_api_key
andcse_id
inconfig.ini
.
- Open the comfyui interface.
- Create a new Large Language Model (LLM) node and directly enter your
openai_api_key
andbase_url
in the node. - Create a new Google Search Tool (google_tool) node and directly enter your
google_api_key
andcse_id
in the node.
- More model adaptations, at least covering the API interfaces of mainstream large models and local calls of mainstream open-source models, as well as more LVM model adaptations. Currently, I have only adapted the visual function calls of GPT-4;
- More ways to build agents. The work I have completed in this area includes importing an LLM as a tool to another LLM, achieving radial construction of LLM workflows, and importing one workflow as a node into another workflow. I might develop some cooler functions in this area in the future.
- More automation features. In the future, I will introduce more nodes that automatically push images, text, videos, and audio to other applications, as well as listening nodes that implement automatic replies to mainstream social software and forums.
- More knowledge base management functions. The project already supports local file search and web search. In the future, I will introduce knowledge graph search and long-term memory search. This will allow agents to think logically about professional knowledge and always remember certain key information when conversing with users.
- More tools, more persona. This part is the easiest to do but also requires the most accumulation. I hope that in the future, this project can have as many custom nodes as comfyui, with a multitude of tools and persona.
This open-source project and its contents (hereinafter referred to as "Project") are provided for reference purposes only and do not imply any form of warranty, either expressed or implied. The contributors of the Project shall not be held responsible for the completeness, accuracy, reliability, or suitability of the Project. Any reliance you place on the Project is strictly at your own risk. In no event shall the contributors of the Project be liable for any indirect, special, or consequential damages or any damages whatsoever resulting from the use of the Project.