2024-05-19 21:27:33 +12:00
2024-07-02 04:48:53 +12:00
2024-07-02 05:31:12 +12:00
2024-06-29 14:41:08 +12:00
2024-06-21 10:08:24 +12:00
2024-07-02 05:31:12 +12:00
2024-04-25 10:36:14 +12:00
2024-06-07 13:05:50 +12:00
2024-04-24 13:26:04 +12:00
2024-05-22 15:34:57 -07:00
2024-06-22 12:05:23 +12:00
2024-06-29 09:15:37 +12:00

ComfyUI Griptape Nodes

This repo creates a series of nodes that enable you to utilize the Griptape Python Framework with ComfyUI, integrating LLMs (Large Language Models) and AI into your workflow.

This example creates two Griptape Agents - a Writer and an Editor. The writer has a WebScraper tool and gets a description of a website. It then generates blog topic ideas and passes them to_ the Editor Agent. The editor chooses the top 3 topics, and generates outlines and next actions for the next two. A third Agent generates thumbnail images for each blog post using a Prompt Image Generation Task based on the outlines.

Writer and Editor agents

The repo currently has a subset of Griptape nodes, with more to come soon. Current nodes can:

Example

In this example, we're using three Image Description nodes to describe the given images. Those descriptions are then Merged into a single string which is used as inspiration for creating a new image using the Create Image from Text node, driven by an OpenAI Driver.

Three image descriptions being used to generate a new image

Using the nodes - Video Tutorials

  1. Installation: https://youtu.be/L4-HnKH4BSI?si=Q7IqP-KnWug7JJ5s
  2. Griptape Agents: https://youtu.be/wpQCciNel_A?si=WF_EogiZRGy0cQIm
  3. Controlling which LLM your Agents use: https://youtu.be/JlPuyH5Ot5I?si=KMPjwN3wn4L4rUyg
  4. Griptape Tools - Featuring Task Memory and Off-Prompt: https://youtu.be/TvEbv0vTZ5Q
  5. Griptape Rulesets, and Image Creation: https://youtu.be/DK16ouQ_vSs
  6. Image Generation with multiple drivers: https://youtu.be/Y4vxJmAZcho

Installation

1. ComfyUI

Install ComfyUI using the instructions for your particular operating system.

2. Use Ollama

If you'd like to run with a local LLM, you can use Ollama and install a model like llama3.

  1. Download and install Ollama from their website: https://ollama.com

  2. Download a model by running ollama run <model>. For example:

    ollama run llama3

  3. You now have ollama available to you.

3. Add API Keys to your environment

For advanced features, it's recommended to use a more powerful model. These are available from the providers listed bellow, and will require API keys.

It's recommended to add these to a .env file in your base comfyUI folder before you start ComfyUI.

Note: Most nodes will work fine with just the OPENAI_API_KEY, so at least make sure you have that one.

OPENAI_API_KEY=
GOOGLE_API_KEY=
GOOGLE_API_SEARCH_ID=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
LEONARDO_API_KEY=
ANTHROPIC_API_KEY=
VOYAGE_API_KEY=
GRIPTAPE_API_KEY=

You can get the appropriate API keys from these respective sites:

4. Install Griptape-ComfyUI

There are two methods for installing the Griptape-ComfyUI repository. You can either download or git clone this repository inside the ComfyUI/custom_nodes, or use the ComfyUI Manager.

  • Option A - ComfyUI Manager (Recommended)

    1. Install ComfyUI Manager by following the installation instructions.
    2. Click Manager in ComfyUI to bring up the ComfyUI Manager
    3. Search for "Griptape"
    4. Find the ComfyUI-Griptape repo.
    5. Click INSTALL
    6. Follow the rest of the instructions.
  • Option B - Git Clone

    1. Open a terminal and input the following commands:

      cd /path/to/comfyUI
      cd custom_nodes
      git clone https://github.com/griptape-ai/ComfyUI-Griptape
      

5. Make sure libraries are loaded

Libraries should be installed automatically, but if you're having trouble, hopefully this can help.

There are certain libraries required for Griptape nodes that are called out in the requirements.txt file.

griptape[all]
python-dotenv
duckduckgo_search

These should get installed automatically if you used the ComfyUI Manager installation method. However, if you're running into issues, please install them yourself either using pip or poetry, depending on your installation method.

  • Option A - pip

    pip install "griptape[all]" python-dotenv duckduckgo_search
    
  • Option B - poetry

    poetry add "griptape[all]" python-dotenv duckduckgo_search
    

6. Restart ComfyUI

Now if you restart comfyUI, you should see the Griptape menu when you click with the Right Mouse button.

If you don't see the menu, please come to our Discord and let us know what kind of errors you're getting - we would like to resolve them as soon as possible!


Troubleshooting

Griptape Not Updating

Sometimes you'll find that the Griptape library didn't get updated properly. This seems to be especially happening when using the ComfyUI Manager. You might see an error like:

ImportError: cannot import name 'OllamaPromptDriver' from 'griptape.drivers' (C:\Users\evkou\Documents\Sci_Arc\Sci_Arc_Studio\ComfyUi\ComfyUI_windows_portable\python_embeded\Lib\site-packages\griptape\drivers\__init__.py)

To resolve this, you must make sure Griptape is runnig with the appropriate version. Things to try:

  • Update again via the ComfyUI Manager
  • Uninstall & Re-install the Griptape nodes via the ComfyUI Manager
  • In the terminal, go to your ComfyUI directory and type: python -m pip install griptape -U
  • Reach out on Discord and ask for help.

API Keys

When you run ComfyUI with the Griptape nodes installed, the installation method will check your environment variables and automatically install the appropriate API keys in a file called: griptape_config.json.

If for some reason your environment variables aren't being set properly, you can do this manually by simply copying over the griptape_config.json.default file to griptape_config.json and add the proper keys there.

If you ever need to change your API keys, go ahead and update that configuration file with the proper key.


Thank you

Massive thank you for help and inspiration from the following people and repos!

S
Description
No description provided
Readme Apache-2.0
74 MiB
Languages
Python 85.3%
JavaScript 14.5%