qse ([personal profile] qse) wrote2025-01-30 05:46 pm

Понеслось по трубам

Побольше всяких интеллектов...

Since the APIs of Qwen are OpenAI-API compatible, we can directly follow the common practice of using OpenAI APIs.

Below is an example of using Qwen2.5-Max in Python:


from openai import OpenAI
import os

client = OpenAI(
api_key=os.getenv("API_KEY"),
base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
model="qwen-max-2025-01-25",
messages=[
{'role': 'system', 'content': 'You are a helpful assistant.'},
{'role': 'user', 'content': 'Which number is larger, 9.11 or 9.8?'}
]
)

print(completion.choices[0].message)


Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting