Qwen3开源模型
复制成功!
立即体验加入对比
视觉理解推理
概述
视觉理解推理
Qwen3系列视觉理解模型,多模态思考能力显著增强,模型在STEM与数学推理方面进行了重点优化;视觉感知与识别能力全面提升、OCR能力迎来重大升级。
输入
文本图像视频
输出
文本
功能
前缀补全
函数调用
缓存
结构化输出
批量任务
联网搜索
微调
定价
- 输入(思考)¥2/M tokens
- 输出(思考)¥20/M tokens
上下文
上下文
131.07K
最大输入
126.97K
最大输出
32.76K
速率限制
- RPM每分钟请求数60
- TPM每分钟 Token 数100K
API 参考
获取 API Key复制成功!
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
import os
import dashscope
from dashscope import MultiModalConversation
# dashscope.base_http_api_url = "https://dashscope.aliyuncs.com/api/v1"
messages = [
{
"role": "user",
"content": [
{"image": "https://img.alicdn.com/imgextra/i1/O1CN01gDEY8M1W114Hi3XcN_!!6000000002727-0-tps-1024-406.jpg"},
{"text": "解答这道题?"}
]
}
]
response = MultiModalConversation.call(
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx",
api_key=os.getenv('DASHSCOPE_API_KEY'),
model="qwen3-vl-235b-a22b-thinking",
messages=messages,
stream=True,
# enable_thinking 参数开启思考过程
enable_thinking=True,
# thinking_budget 参数设置最大推理过程 Token 数
thinking_budget=81920,
)
# 定义完整思考过程
reasoning_content = ""
# 定义完整回复
answer_content = ""
# 判断是否结束思考过程并开始回复
is_answering = False
print("=" * 20 + "思考过程" + "=" * 20)
for chunk in response:
# 如果思考过程与回复皆为空,则忽略
message = chunk.output.choices[0].message
reasoning_content_chunk = message.get("reasoning_content", None)
if (chunk.output.choices[0].message.content == [] and
reasoning_content_chunk == ""):
pass
else:
# 如果当前为思考过程
if reasoning_content_chunk != None and chunk.output.choices[0].message.content == []:
print(chunk.output.choices[0].message.reasoning_content, end="")
reasoning_content += chunk.output.choices[0].message.reasoning_content
# 如果当前为回复
elif chunk.output.choices[0].message.content != []:
if not is_answering:
print("\n" + "=" * 20 + "完整回复" + "=" * 20)
is_answering = True
print(chunk.output.choices[0].message.content[0]["text"], end="")
answer_content += chunk.output.choices[0].message.content[0]["text"]
# 如果您需要打印完整思考过程与完整回复,请将以下代码解除注释后运行
# print("=" * 20 + "完整思考过程" + "=" * 20 + "\n")
# print(f"{reasoning_content}")
# print("=" * 20 + "完整回复" + "=" * 20 + "\n")
# print(f"{answer_content}")