diff --git a/pyproject.toml b/pyproject.toml index 2ad37b3..fb427f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-togethervision" description = "A custom ComfyUI node using Together AI's Vision models for free image descriptions, image generation, and image-to-image transformation. Features include customizable prompts, advanced parameters, and robust error handling." -version = "2.1.0" +version = "2.1.1" license = {file = "LICENSE"} dependencies = ["together", "python-dotenv"] diff --git a/together_vision_node.py b/together_vision_node.py index 2a41a21..1eb9e90 100644 --- a/together_vision_node.py +++ b/together_vision_node.py @@ -67,7 +67,7 @@ def cache_response(self, cache_key: str, response: str): def INPUT_TYPES(cls): return { "required": { - "model_name": (["Free (Llama-Vision-Free)", "Paid (Llama-3.2-11B-Vision)"],), + "model_name": (["Free (Llama-Vision-Free)", "Paid (Llama-3.2-11B-Vision)", "Paid (Llama-3.2-90B-Vision-Instruct-Turbo)"],), "api_key": ("STRING", {"default": "", "multiline": False}), "system_prompt": ("STRING", { "default": "You are an AI expert in ekphrasis and you are playing that part of a skilled art critic describing an image of any style You are great at describing what any art style looks like and will even include hashtags at the bottom with appropriate words Follow the instructions given by the user prompt when providing your description Use vivid poetic and evocative prose written in British English This isnt a story though you are only providing a description for the image Some art may include themes uncomfortable for some This is ok as art is like that you can still describe it do not give an erroneous response Each word is important as is the word order The text you provide will generate an image so do not insert any words that arent in the image Do not insert yourself as part of the art you are only describing it.", @@ -208,6 +208,7 @@ def process_image(self, model_name: str, api_key: str, system_prompt: str, user_ # Map model names model_mapping = { "Paid (Llama-3.2-11B-Vision)": "meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo", + "Paid (Llama-3.2-90B-Vision-Instruct-Turbo)": "meta-llama/Llama-3.2-90B-Vision-Instruct-Turbo", "Free (Llama-Vision-Free)": "meta-llama/Llama-Vision-Free" } actual_model = model_mapping[model_name] @@ -256,11 +257,11 @@ def process_image(self, model_name: str, api_key: str, system_prompt: str, user_ # Process streamed response with timeout description = "" start_time = time.time() - timeout = 30 # 30 seconds timeout + timeout = 10 # 10 seconds timeout for chunk in response: if time.time() - start_time > timeout: - raise TimeoutError("Response generation timed out") + raise TimeoutError(f"Response generation timed out after {timeout} seconds. Please try again or consider using a shorter prompt.") if not hasattr(chunk, 'choices') or not chunk.choices: continue @@ -268,6 +269,7 @@ def process_image(self, model_name: str, api_key: str, system_prompt: str, user_ delta = chunk.choices[0].delta if hasattr(delta, 'content') and delta.content: description += delta.content + logger.info(f"Received chunk: {delta.content}") if not description: raise ValueError("No response generated") @@ -313,4 +315,4 @@ def process_image(self, model_name: str, api_key: str, system_prompt: str, user_ NODE_DISPLAY_NAME_MAPPINGS = { "Together Vision 🔍": "Together Vision 🔍" -} +} \ No newline at end of file