anynode  by lks-ai

ComfyUI node for LLM-driven image/data manipulation via generated Python functions

created 1 year ago
536 stars

Top 60.0% on sourcepulse

GitHubView on GitHub
Project Summary

AnyNode is a ComfyUI custom node that leverages Large Language Models (LLMs) to dynamically generate Python code for custom functionalities within ComfyUI workflows. It empowers users, from researchers to power users, to create bespoke nodes for image processing, data manipulation, and more, by simply describing the desired operation in natural language.

How It Works

AnyNode functions by taking a natural language prompt describing a desired operation and connecting inputs/outputs. It then generates Python code for a ComfyUI node based on this description. This generated code is executed within a sandboxed environment, with strict controls on allowed libraries and network access, ensuring safety. The node can then be integrated into any ComfyUI workflow, allowing for complex, LLM-driven operations without manual Python coding.

Quick Start & Requirements

  • Install via ComfyUI Manager or by cloning lks-ai/anynode into comfy/custom_nodes.
  • Requires ComfyUI.
  • For OpenAI: pip install openai and set OPENAI_API_KEY environment variable.
  • For Gemini: Set GOOGLE_API_KEY environment variable.
  • For Local LLMs: Ensure an OpenAI-compatible LLM server (e.g., Ollama, vLLM) is running.
  • Restart ComfyUI.

Highlighted Details

  • Supports OpenAI, Gemini, and local LLMs (Ollama, vLLM) via OpenAI-compatible endpoints.
  • Features a code sanitizer and restricted imports (numpy, torch, collections, re are allowed) for security.
  • Includes error mitigation: auto-correction by re-queuing and incremental code editing.
  • Can generate complex functions with input type awareness for ComfyUI's MODEL, VAE, and CLIP.

Maintenance & Community

  • Beta status (v0.1).
  • Active community engagement encouraged via Discord.
  • Roadmap includes features like exporting generated code as a new ComfyUI node and RAG-based function storage.

Licensing & Compatibility

  • License not explicitly stated in the README.
  • Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

The project is in beta, and LLM-generated code may contain errors that require prompt engineering or re-queuing to fix. Complex operations might necessitate some programming knowledge, and smaller LLMs may have limited coding capabilities. Generated code is only visible in the console.

Health Check
Last commit

1 year ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
1
Star History
8 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.