Qwen-Math menyediakan kemampuan penalaran dan perhitungan matematika yang kuat, dengan langkah-langkah pemecahan masalah yang rinci untuk memudahkan pemahaman dan verifikasi.
Dokumen ini hanya berlaku untuk wilayah China (Beijing). Untuk menggunakan model, gunakan Kunci API dari wilayah China (Beijing).
Model dan harga
Komersial
Model | Harga Input | Harga Keluaran | Jendela Konteks | Input Maksimum | Output Maksimum | Kuota gratis |
(Juta token) | (Token) | |||||
qwen-math-plus | $0,574 | $1,721 | 4.096 | 3.072 | 3.072 | Tidak ada kuota gratis |
qwen-math-turbo | $0,287 | $0,861 | ||||
Snapshots sepertiqwen-math-xxx-latestdanqwen-math-xxx-YYYY-MM-DDmemiliki harga dan spesifikasi yang sama dengan versiqwen-math-xxxsebelumnya.
Kemampuan model:qwen-math-xxx=qwen-math-xxx-latest=qwen-math-xxx-2024-09-19
Sumber Terbuka
Model | Harga input | Harga output | Jendela konteks | Input Maksimum | Output Maksimum | Kuota gratis |
(Juta token) | (Tokens) | |||||
qwen2.5-math-72b-instruct | $0,574 | $1,721 | 4.096 | 3.072 | 3.072 | Tidak ada kuota gratis |
qwen2.5-math-7b-instruct | $0,144 | $0,287 | ||||
qwen2.5-math-1.5b-instruct | Gratis untuk sementara waktu | Gratis untuk sementara waktu | ||||
Untuk informasi lebih lanjut tentang batas laju, lihat Batas Laju.
Memulai
Anda harus memperoleh Kunci API dan atur Kunci API sebagai Variabel Lingkungan. Jika Anda menggunakan SDK OpenAI atau DashScope SDK untuk membuat panggilan, Anda juga harus menginstal SDK.
Kompatibel dengan OpenAI
Python
from openai import OpenAI
import os
client = OpenAI(
api_key=os.getenv("DASHSCOPE_API_KEY"), # Jangan hard-code kredensial dalam kode Anda. Selalu gunakan variabel lingkungan atau layanan manajemen kunci.
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
)
completion = client.chat.completions.create(
model="qwen-math-plus",
messages=[{'role': 'user', 'content': 'Turunkan solusi universal untuk persamaan kuadrat $ Ax^2+Bx+C=0 $'}])
print(completion.choices[0].message.content)curl
curl --location "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "qwen-math-plus",
"messages": [
{
"role": "user",
"content": "Turunkan solusi universal untuk persamaan kuadrat $ Ax^2+Bx+C=0 $"
}
]
}'DashScope
Python
from http import HTTPStatus
import dashscope
def call_with_messages():
messages = [
{'role': 'user', 'content': 'Turunkan solusi universal untuk persamaan kuadrat $ Ax^2+Bx+C=0 $'}]
response = dashscope.Generation.call(
model='qwen-math-plus',
messages=messages,
# Atur format hasil ke pesan.
result_format='message',
)
if response.status_code == HTTPStatus.OK:
print(response)
else:
print('Request id: %s, Status code: %s, error code: %s, error message: %s' % (
response.request_id, response.status_code,
response.code, response.message
))
if __name__ == '__main__':
call_with_messages()
Java
import java.util.Arrays;
import com.alibaba.dashscope.aigc.generation.Generation;
import com.alibaba.dashscope.aigc.generation.GenerationResult;
import com.alibaba.dashscope.aigc.generation.GenerationParam;
import com.alibaba.dashscope.common.Message;
import com.alibaba.dashscope.common.Role;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
public class Main {
public static void callWithMessage()
throws NoApiKeyException, ApiException, InputRequiredException {
Generation gen = new Generation();
Message userMsg = Message.builder().role(Role.USER.getValue()).content("Turunkan solusi universal untuk persamaan kuadrat $ Ax^2+Bx+C=0 $").build();
GenerationParam param =GenerationParam.builder()
.apiKey(System.getenv("DASHSCOPE_API_KEY"))
.model("qwen-math-plus")
.messages(Arrays.asList(userMsg))
.resultFormat(GenerationParam.ResultFormat.MESSAGE)
.build();
GenerationResult result = gen.call(param);
System.out.println(result);
}
public static void main(String[] args){
try {
callWithMessage();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
}
}
curl
curl --location "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "qwen-math-plus",
"input":{
"messages":[
{
"role": "user",
"content": "Turunkan solusi universal untuk persamaan kuadrat $ Ax^2+Bx+C=0 $"
}
]
},
"parameters": {
"result_format": "message"
}
}'Anda juga dapat pergi ke Konsol Studio Model untuk mencoba model tersebut.
Rekomendasi
Gunakan Bahasa Inggris dan LaTeX: Qwen-Math dirancang untuk menangani masalah matematika dalam bahasa Inggris. Untuk hasil terbaik, gunakan LaTeX untuk simbol dan rumus matematika dalam input Anda.
Standarisasi Output: Gunakan mode sebagian untuk kontrol yang tepat. Ini memastikan bahwa output secara ketat mengikuti awalan yang diberikan, meningkatkan akurasi dan kontrol hasil.
Model diatur ke
suhu=0secara default. Tidak diperlukan penyesuaian.Ambil Hasil dengan Mudah: Qwen-Math menempatkan hasil akhir dalam blok
\boxed{}secara default.
FAQ
Bagaimana cara menggunakan Qwen-Math untuk menyelesaikan masalah matematika dalam gambar? |
Qwen-Math tidak mendukung input gambar.
Untuk informasi lebih lanjut tentang parameter input dan respons Qwen-Math, lihat Referensi API Qwen. |
Di mana saya bisa menemukan informasi rinci tentang kode kesalahan? |
Jika panggilan gagal, lihat Pesan Kesalahan untuk pemecahan masalah. |