1 Star 0 Fork 265

37创客/python-learn

forked from mktime/python-learn 
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
kimi.py 614 Bytes
Copy Edit Raw Blame History
mktime authored 2025-01-13 00:46 +08:00 . 提交人脸检测代码
from openai import OpenAI
import os
API_KEY = os.environ['KIMI_SECRET']
print(f'API: {API_KEY}')
client = OpenAI(
api_key=API_KEY,
base_url="https://api.moonshot.cn/v1",
)
completion = client.chat.completions.create(
model = "moonshot-v1-8k",
messages = [
{"role": "system", "content": "你是一名经验丰富的新生儿儿科医生"},
{"role": "user", "content": "四月龄孩子如何避免甲流?"}
],
temperature = 0.3,
)
# 通过 API 我们获得了 Kimi 大模型给予我们的回复消息(role=assistant)
print(completion.choices[0].message.content)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/i37ck/python-learn.git
git@gitee.com:i37ck/python-learn.git
i37ck
python-learn
python-learn
master

Search