Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

MagMueller
Copy link
Collaborator

@MagMueller MagMueller commented Sep 7, 2025

Auto-generated PR for: qwen support


Summary by cubic

Adds first-class Qwen support via OpenAI-compatible API, with a working example using qwen-vl-max and setup docs. Also tightens action schema examples in prompts to improve output consistency.

  • New Features - New features added
    • Qwen support with example (examples/models/qwen.py) using qwen-vl-max, vision enabled, and DashScope-compatible base_url.
    • Documentation updates: Qwen guide, required ALIBABA_CLOUD env var, and warning about smaller models returning incorrect action schemas.
    • Prompt updates: replace generic action placeholder with a concrete go_to_url example to enforce the correct nested schema.

@MagMueller MagMueller merged commit c0f9a8e into main Sep 7, 2025
54 checks passed
@MagMueller MagMueller deleted the qwen-support branch September 7, 2025 23:32
Copy link

github-actions bot commented Sep 7, 2025

Agent Task Evaluation Results: 2/4 (50%)

View detailed results
Task Result Reason
amazon_laptop ✅ Pass The agent successfully navigated to amazon.com, searched for 'laptop', and returned the name of the first laptop result along with detailed information. The output meets all the criteria specified for success.
google_maps_3d ❌ Fail The agent successfully performed most steps: it used www.google.com/maps, searched for ETH Zurich Hauptgebäude, closed the side panel, enabled Satellite View and 3D mode. However, the agent failed to pan the map so that both ETH Zurich Hauptgebäude and Zurich Lake were clearly visible together as required. Additionally, no screenshot was taken due to this failure. Therefore, the task is only partially completed and does not meet all success criteria.
browser_use_pip ✅ Pass The agent correctly identified and provided the pip installation command 'pip install browser-use' as requested. The output includes the exact command and a brief explanation, meeting the success criteria.
captcha_cloudflare ❌ Fail The agent failed to solve the captcha and did not click the 'Check' button, which are essential steps to complete the task. Consequently, it could not extract the 'hostname' value from the dictionary displayed after successful captcha completion. Therefore, the task was incomplete and unsuccessful.

Check the evaluate-tasks job for detailed task execution logs.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 issues found across 6 files

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

api_key = os.getenv('ALIBABA_CLOUD')
base_url = 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1'

llm = ChatOpenAI(model='qwen-vl-max', api_key=api_key, base_url=base_url)
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Qwen model integration in examples/models/qwen.py directly uses the generic ChatOpenAI class, violating the established architectural pattern of creating a dedicated class for each LLM provider (e.g., ChatDeepSeek, ChatGoogle). This inconsistency makes the system harder to maintain and leaks provider-specific configuration like the base_url into example code instead of encapsulating it within a dedicated ChatQwen class.

Prompt for AI agents
Address the following comment on docs/customize/agent/supported-models.mdx at line 226:

<comment>The Qwen model integration in `examples/models/qwen.py` directly uses the generic `ChatOpenAI` class, violating the established architectural pattern of creating a dedicated class for each LLM provider (e.g., `ChatDeepSeek`, `ChatGoogle`). This inconsistency makes the system harder to maintain and leaks provider-specific configuration like the `base_url` into example code instead of encapsulating it within a dedicated `ChatQwen` class.</comment>

<file context>
@@ -208,7 +208,41 @@ llm = ChatOllama(model=&quot;llama3.1:8b&quot;)
+api_key = os.getenv(&#39;ALIBABA_CLOUD&#39;)
+base_url = &#39;https://dashscope-intl.aliyuncs.com/compatible-mode/v1&#39;
+
+llm = ChatOpenAI(model=&#39;qwen-vl-max&#39;, api_key=api_key, base_url=base_url)
+
+agent = Agent(
</file context>
Fix with Cubic

"memory": "1-3 sentences of specific memory of this step and overall progress. You should put here everything that will help you track progress in future steps. Like counting pages visited, items found, etc.",
"next_goal": "State the next immediate goal and action to achieve it, in one clear sentence."
"action":[{{"one_action_name": {{// action-specific parameter}}}}, // ... more actions in sequence]
"action":[{{"go_to_url": {{ "url": "url_value"}}}}, // ... more actions in sequence]
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example JSON for action contains extra braces and an inline comment, making it invalid JSON. Replace with a valid object structure without comments.

Prompt for AI agents
Address the following comment on browser_use/agent/system_prompt.md at line 212:

<comment>Example JSON for action contains extra braces and an inline comment, making it invalid JSON. Replace with a valid object structure without comments.</comment>

<file context>
@@ -209,7 +209,7 @@ You must ALWAYS respond with a valid JSON in this exact format:
   &quot;memory&quot;: &quot;1-3 sentences of specific memory of this step and overall progress. You should put here everything that will help you track progress in future steps. Like counting pages visited, items found, etc.&quot;,
   &quot;next_goal&quot;: &quot;State the next immediate goal and action to achieve it, in one clear sentence.&quot;
-  &quot;action&quot;:[{{&quot;one_action_name&quot;: {{// action-specific parameter}}}}, // ... more actions in sequence]
+  &quot;action&quot;:[{{&quot;go_to_url&quot;: {{ &quot;url&quot;: &quot;url_value&quot;}}}}, // ... more actions in sequence]
 }}
 
</file context>
Suggested change
"action":[{{"go_to_url": {{ "url": "url_value"}}}}, // ... more actions in sequence]
"action":[{"go_to_url": { "url": "url_value" }}]
Fix with Cubic

await agent.run()


asyncio.run(main())
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Script executes on import; wrap the entrypoint in a main guard to avoid side effects when imported.

Prompt for AI agents
Address the following comment on examples/models/qwen.py at line 26:

<comment>Script executes on import; wrap the entrypoint in a __main__ guard to avoid side effects when imported.</comment>

<file context>
@@ -0,0 +1,26 @@
+	await agent.run()
+
+
+asyncio.run(main())
</file context>
Suggested change
asyncio.run(main())
if __name__ == '__main__': asyncio.run(main())
Fix with Cubic

import asyncio

# get an api key from https://modelstudio.console.alibabacloud.com/?tab=playground#/api-key
api_key = os.getenv('ALIBABA_CLOUD')
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No validation for missing API key; running with api_key=None will fail later without a clear, early error.

Prompt for AI agents
Address the following comment on examples/models/qwen.py at line 11:

<comment>No validation for missing API key; running with api_key=None will fail later without a clear, early error.</comment>

<file context>
@@ -0,0 +1,26 @@
+import asyncio
+
+# get an api key from https://modelstudio.console.alibabacloud.com/?tab=playground#/api-key
+api_key = os.getenv(&#39;ALIBABA_CLOUD&#39;)
+base_url = &#39;https://dashscope-intl.aliyuncs.com/compatible-mode/v1&#39;
+
</file context>
Fix with Cubic

{{
"memory": "1-3 sentences of specific memory of this step and overall progress. You should put here everything that will help you track progress in future steps. Like counting pages visited, items found, etc.",
"action":[{{"one_action_name": {{// action-specific parameter}}}}, // ... more actions in sequence]
"action":[{{"go_to_url": {{ "url": "url_value"}}}}, // ... more actions in sequence]
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example JSON contains an inline comment and doubled curly braces, making it invalid JSON despite the instruction to output valid JSON.

Prompt for AI agents
Address the following comment on browser_use/agent/system_prompt_flash.md at line 180:

<comment>Example JSON contains an inline comment and doubled curly braces, making it invalid JSON despite the instruction to output valid JSON.</comment>

<file context>
@@ -177,7 +177,7 @@ You must ALWAYS respond with a valid JSON in this exact format:
 {{
   &quot;memory&quot;: &quot;1-3 sentences of specific memory of this step and overall progress. You should put here everything that will help you track progress in future steps. Like counting pages visited, items found, etc.&quot;,
-  &quot;action&quot;:[{{&quot;one_action_name&quot;: {{// action-specific parameter}}}}, // ... more actions in sequence]
+  &quot;action&quot;:[{{&quot;go_to_url&quot;: {{ &quot;url&quot;: &quot;url_value&quot;}}}}, // ... more actions in sequence]
 }}
 
</file context>
Suggested change
"action":[{{"go_to_url": {{ "url": "url_value"}}}}, // ... more actions in sequence]
"action":[{"go_to_url": { "url": "url_value"}}]
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant