From 0971464c8d33d3161914e7ba879ee796e7afe93c Mon Sep 17 00:00:00 2001 From: Dillon DuPont Date: Sun, 27 Jul 2025 15:20:24 -0400 Subject: [PATCH] 0.4.0b2 --- libs/python/agent2/agent/__init__.py | 2 +- .../adapters/huggingfacelocal_adapter.py | 19 ++++++++++++++++--- libs/python/agent2/pyproject.toml | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/libs/python/agent2/agent/__init__.py b/libs/python/agent2/agent/__init__.py index 9515a9bb..9fea2f1f 100644 --- a/libs/python/agent2/agent/__init__.py +++ b/libs/python/agent2/agent/__init__.py @@ -16,4 +16,4 @@ __all__ = [ "AgentResponse" ] -__version__ = "0.1.0" +__version__ = "0.4.0b2" diff --git a/libs/python/agent2/agent/adapters/huggingfacelocal_adapter.py b/libs/python/agent2/agent/adapters/huggingfacelocal_adapter.py index 83352447..f8706868 100644 --- a/libs/python/agent2/agent/adapters/huggingfacelocal_adapter.py +++ b/libs/python/agent2/agent/adapters/huggingfacelocal_adapter.py @@ -1,10 +1,17 @@ import asyncio import warnings from typing import Iterator, AsyncIterator, Dict, List, Any, Optional -import torch -from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor from litellm.types.utils import GenericStreamingChunk, ModelResponse -from litellm import CustomLLM, completion, acompletion +from litellm.llms.custom_llm import CustomLLM +from litellm import completion, acompletion + +# Try to import HuggingFace dependencies +try: + import torch + from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor + HF_AVAILABLE = True +except ImportError: + HF_AVAILABLE = False class HuggingFaceLocalAdapter(CustomLLM): @@ -102,6 +109,12 @@ class HuggingFaceLocalAdapter(CustomLLM): Returns: Generated text response """ + if not HF_AVAILABLE: + raise ImportError( + "HuggingFace transformers dependencies not found. " + "Please install with: pip install \"cua-agent[uitars-hf]\"" + ) + # Extract messages and model from kwargs messages = kwargs.get('messages', []) model_name = kwargs.get('model', 'ByteDance-Seed/UI-TARS-1.5-7B') diff --git a/libs/python/agent2/pyproject.toml b/libs/python/agent2/pyproject.toml index cd5530d3..031b26e5 100644 --- a/libs/python/agent2/pyproject.toml +++ b/libs/python/agent2/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "pdm.backend" [project] name = "cua-agent" -version = "0.4.0b1" +version = "0.4.0b2" description = "CUA (Computer Use) Agent for AI-driven computer interaction" readme = "README.md" authors = [