-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
18 lines (15 loc) · 710 Bytes
/
test.py
File metadata and controls
18 lines (15 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from openai import OpenAI
client = OpenAI(
api_key="",
base_url="https://api.moonshot.ai/v1",
)
completion = client.chat.completions.create(
model="kimi-1.5-flash",
messages=[
{"role": "system",
"content": "You are Kimi, an AI assistant provided by Moonshot AI. You are proficient in Chinese and English conversations. You provide users with safe, helpful, and accurate answers. You will reject any questions involving terrorism, racism, or explicit content. Moonshot AI is a proper noun and should not be translated."},
{"role": "user", "content": "Hello, my name is Li Lei. What is 1+1?"}
],
temperature=0.3,
)
print(completion.choices[0].message.content)