-
Notifications
You must be signed in to change notification settings - Fork 8.2k
qwen support #2997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qwen support #2997
Conversation
…schema format issues with smaller models.
Agent Task Evaluation Results: 2/4 (50%)View detailed results
Check the evaluate-tasks job for detailed task execution logs. |
There was a problem hiding this 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) |
There was a problem hiding this comment.
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="llama3.1:8b")
+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)
+
+agent = Agent(
</file context>
"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] |
There was a problem hiding this comment.
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:
"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]
}}
</file context>
"action":[{{"go_to_url": {{ "url": "url_value"}}}}, // ... more actions in sequence] | |
"action":[{"go_to_url": { "url": "url_value" }}] |
await agent.run() | ||
|
||
|
||
asyncio.run(main()) |
There was a problem hiding this comment.
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>
asyncio.run(main()) | |
if __name__ == '__main__': asyncio.run(main()) |
import asyncio | ||
|
||
# get an api key from https://modelstudio.console.alibabacloud.com/?tab=playground#/api-key | ||
api_key = os.getenv('ALIBABA_CLOUD') |
There was a problem hiding this comment.
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('ALIBABA_CLOUD')
+base_url = 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1'
+
</file context>
{{ | ||
"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] |
There was a problem hiding this comment.
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:
{{
"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]
}}
</file context>
"action":[{{"go_to_url": {{ "url": "url_value"}}}}, // ... more actions in sequence] | |
"action":[{"go_to_url": { "url": "url_value"}}] |
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.