19 lines
516 B
Python
19 lines
516 B
Python
from openai import OpenAI
|
|
|
|
client = OpenAI(
|
|
base_url="http://192.168.0.11:8000/v1",
|
|
api_key="dummy" # vLLM 不需要真实的 API key
|
|
)
|
|
|
|
# 聊天完成
|
|
response = client.chat.completions.create(
|
|
model="/opt/model/Qwen3-Next-80B-A3B-Instruct-AWQ-4bit",
|
|
messages=[
|
|
{"role": "system", "content": "You are a helpful assistant."},
|
|
{"role": "user", "content": "你好,请介绍一下你自己"}
|
|
],
|
|
max_tokens=500,
|
|
temperature=0.7
|
|
)
|
|
|
|
print(response.choices[0].message.content) |