更新README.md,临时解决文档模式渲染超时问题

This commit is contained in:
zstar 2025-03-25 16:48:23 +08:00
parent dbfcc1b011
commit 7086f2d11d
1 changed files with 20 additions and 0 deletions

20
python_api/api_doc.py Normal file
View File

@ -0,0 +1,20 @@
from openai import OpenAI
model = "deepseek-r1:1.5b"
client = OpenAI(api_key="ragflow-FiNzM5YTEyMDk0MjExZjA5OTg4MDI0Mm", base_url=f"http://localhost/api/v1/chats_openai/ec69b3f4fbeb11ef862c0242ac120002")
completion = client.chat.completions.create(
model=model,
messages=[
{"role": "system", "content": "你是一个乐于助人的助手"},
{"role": "user", "content": "Who are you?"},
],
stream=False
)
stream = False
if stream:
for chunk in completion:
print(chunk)
else:
print(completion.choices[0].message.content)