通义千文发布的大模型API平台百炼qwen-plus,最近使用一下,用它来做了个小应用,代码如下:
import os
import json
from openai import OpenAIclient = OpenAI(# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx",api_key="xxxxxxxxxx",base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
)completion = client.chat.completions.create(model="qwen-plus",messages=[{'role': 'system', 'content': 'You are a linux assistant.'},{'role': 'user', 'content': 'how to use arecord tool capture spec device on Linux?'}],stream=True,stream_options={"include_usage": True}
)for chunk in com