griptape-ai / ComfyUI-Griptape

A suite of Griptape nodes for ComfyUI
Apache License 2.0
96 stars 11 forks source link

Anthropic API key error (OpenAI API key still works) #79

Closed vraagje closed 1 month ago

vraagje commented 1 month ago

Updated today and now facing an Anthropic API key error. OpenAI and Ollama are working fine. I've checked the key in .env , Anthropic credits, and reinstalled Griptape, but the issue remains. Any ideas on how to resolve this? And why is a "voyageai" key needed for Claude Sonnet?

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error occurred when executing Griptape Agent Config: Anthropic:

No API key provided. You can set your API key in code using 'voyageai.api_key = ', or set the environment variable VOYAGE_API_KEY=). If your API key is stored in a file, you can point the voyageai module at it with 'voyageai.api_key_path = ', or set the environment variable VOYAGE_API_KEY_PATH=. API keys can be generated in Voyage AI's dashboard (https://dash.voyageai.com).

File "F:\!COMFYUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I also noticed when re-installing Griptape I get the following warnings:

## ComfyUI-Manager: EXECUTE => ['F:\\!COMFYUI\\ComfyUI_windows_portable\\python_embeded\\python.exe', '-m', 'pip', 'install', 'griptape [cohere,anthropic,huggingface-hub,transformers,boto3,google-generativeai,ollama,voyageai,trafilatura,playwright,beautifulsoup4,duckduckgo-search,pandas,pypdf,pillow,mail-parser,filetype] == 0.28.2']

## Execute install/(de)activation script for 'F:\!COMFYUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Griptape'
[!] WARNING: griptape 0.28.2 does not provide the extra 'anthropic'
[!] WARNING: griptape 0.28.2 does not provide the extra 'beautifulsoup4'
[!] WARNING: griptape 0.28.2 does not provide the extra 'boto3'
[!] WARNING: griptape 0.28.2 does not provide the extra 'cohere'
[!] WARNING: griptape 0.28.2 does not provide the extra 'duckduckgo-search'
[!] WARNING: griptape 0.28.2 does not provide the extra 'filetype'
[!] WARNING: griptape 0.28.2 does not provide the extra 'google-generativeai'
[!] WARNING: griptape 0.28.2 does not provide the extra 'huggingface-hub'
[!] WARNING: griptape 0.28.2 does not provide the extra 'mail-parser'
[!] WARNING: griptape 0.28.2 does not provide the extra 'ollama'
[!] WARNING: griptape 0.28.2 does not provide the extra 'pandas'
[!] WARNING: griptape 0.28.2 does not provide the extra 'pillow'
[!] WARNING: griptape 0.28.2 does not provide the extra 'playwright'
[!] WARNING: griptape 0.28.2 does not provide the extra 'pypdf'
[!] WARNING: griptape 0.28.2 does not provide the extra 'trafilatura'
[!] WARNING: griptape 0.28.2 does not provide the extra 'transformers'
[!] WARNING: griptape 0.28.2 does not provide the extra 'voyageai'
shhlife commented 1 month ago

Hi @vraagje, thank you for the notes!

Anthropic doesn't come with an embeddings driver, so in their documentation they recommend using VoyageAI: https://docs.anthropic.com/en/docs/build-with-claude/embeddings.

I'll find out if there's another service we can use that doesn't require an api key, but in the meantime you can pick one up at their website in your dashboard: https://dash.voyageai.com/

Thank you for the note about the extras! I'll fix that right away!

-Jason

shhlife commented 1 month ago

I've just merged in a fix for fixing the requirements.txt extras.

As for the embeddings, I can create drivers for those so you can swap out a different embeddings driver for your agent if you want. That way you can use any of the embeddings drivers here:

https://docs.griptape.ai/stable/griptape-framework/drivers/embedding-drivers/

vraagje commented 1 month ago

Eh.. thanks Jason, but I'm still confused. The Anthropic API key in the .env file was working fine before. At this point, I don't believe I need embeddings for simple image descriptions, right?. My main concern is getting the "Griptape Agent Config: Anthropic" to function... Anyway I try tomorrow the voyageai thing.

shhlife commented 1 month ago

It's strange it was working before, because the VoyageAI key should have always been required with Anthropic - but by tomorrow I should have this new functionality checked in that lets you build your own config.. with any embedding driver/image generation driver/prompt model configuration you want.

image

I'm just building out all the nodes now. :)

vraagje commented 1 month ago

Thanks!, I try tomorrow. (and yes, it all worked before without VoyageAI, never used or heard of them before)

vraagje commented 1 month ago

Just had time to test Anthropic API config with additional VoyageAI API key, and yes it worked as expected. Thanks for your help. I'm really impressed by these nodes. Great work!