mirror of
https://github.com/QwenLM/Qwen.git
synced 2026-05-21 00:45:48 +08:00
update readme
This commit is contained in:
12
README_CN.md
12
README_CN.md
@@ -325,6 +325,8 @@ python openai_api.py
|
||||
import openai
|
||||
openai.api_base = "http://localhost:8000/v1"
|
||||
openai.api_key = "none"
|
||||
|
||||
# 使用流式回复的请求
|
||||
for chunk in openai.ChatCompletion.create(
|
||||
model="Qwen-7B",
|
||||
messages=[
|
||||
@@ -334,6 +336,16 @@ for chunk in openai.ChatCompletion.create(
|
||||
):
|
||||
if hasattr(chunk.choices[0].delta, "content"):
|
||||
print(chunk.choices[0].delta.content, end="", flush=True)
|
||||
|
||||
# 不使用流式回复的请求
|
||||
response = openai.ChatCompletion.create(
|
||||
model="Qwen-7B",
|
||||
messages=[
|
||||
{"role": "user", "content": "你好"}
|
||||
],
|
||||
stream=False
|
||||
)
|
||||
print(response.choices[0].message.content)
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user