support aliyun eval of qwen3vl

This commit is contained in:
ludunjie.ldj
2025-10-16 16:20:54 +08:00
parent 55372c4432
commit afd29115da
2 changed files with 9 additions and 9 deletions

View File

@@ -61,7 +61,7 @@ class Qwen3VLAgent:
self,
platform: str = "ubuntu",
model: str = "qwen3-vl",
max_tokens: int = 40960,
max_tokens: int = 32768,
top_p: float = 0.9,
temperature: float = 0.0,
action_space: str = "pyautogui",
@@ -70,7 +70,7 @@ class Qwen3VLAgent:
add_thought_prefix: bool = False,
coordinate_type: str = "relative",
api_backend: str = "dashscope", # "openai" or "dashscope"
enable_thinking: bool = True, # Enable thinking mode for DashScope
enable_thinking: bool = False, # Enable thinking mode for DashScope
thinking_budget: int = 32768, # Token budget for reasoning
):
self.platform = platform
@@ -628,8 +628,8 @@ Previous actions:
def _call_llm_openai(self, messages, model):
"""Call LLM using OpenAI SDK (compatible with OpenAI-compatible endpoints)."""
base_url = "https://dashscope.aliyuncs.com/compatible-mode/v1"
api_key = "sk-123"
base_url = os.environ.get("OPENAI_BASE_URL", "https://dashscope.aliyuncs.com/compatible-mode/v1")
api_key = os.environ.get("OPENAI_API_KEY", "sk-123")
client = openai.OpenAI(base_url=base_url, api_key=api_key)
for attempt in range(1, MAX_RETRY_TIMES + 1):
@@ -653,8 +653,8 @@ Previous actions:
def _call_llm_dashscope(self, messages, model):
"""Call LLM using DashScope SDK."""
dashscope.base_http_api_url = "https://dashscope.aliyuncs.com/api/v1"
dashscope.api_key = "sk-123"
dashscope.base_http_api_url = os.environ.get("DASHSCOPE_BASE_URL", "https://dashscope.aliyuncs.com/api/v1")
dashscope.api_key = os.environ.get("DASHSCOPE_API_KEY", "sk-123")
# Convert message schema
ds_messages = self._to_dashscope_messages(messages)
@@ -669,7 +669,7 @@ Previous actions:
call_params = {
"model": model,
"messages": ds_messages,
"max_tokens": min(self.max_tokens, 2048),
"max_tokens": self.max_tokens,
# "temperature": self.temperature,
# "top_p": self.top_p,
"vl_high_resolution_images": True,