from openai import OpenAI
client = OpenAI(
api_key="xxx",
base_url="https://api.moonshot.cn/v1",
)
completion = client.chat.completions.create(
model="kimi-k2-0711-preview",
messages=[
{
"role": "user",
"content": "Who are you?",
},
{"role": "assistant", "content": "Hi", "partial": True},
],
temperature=0.3,
)
print(completion.choices[0].message.content)
from openai import OpenAI
client = OpenAI(
api_key="xxx",
base_url="https://llm.chutes.ai/v1",
)
completion = client.chat.completions.create(
model="moonshotai/Kimi-K2-Instruct",
messages=[
{
"role": "user",
"content": "who are you",
},
{"role": "assistant", "content": "I am", "partial": True, "prefix": True},
],
temperature=0.3,
)
print(completion.choices[0].message.content)
From the code above, first code I get
Hi! I'm Kimi, your AI assistant and good friend. I'm here to help you with any questions or tasks you have. How can I assist you today?
the second code I get
I’m Kimi, your AI friend from Moonshot AI. How can I assist you today?
Because prefill is not working.
From the code above, first code I get
Hi! I'm Kimi, your AI assistant and good friend. I'm here to help you with any questions or tasks you have. How can I assist you today?the second code I get
I’m Kimi, your AI friend from Moonshot AI. How can I assist you today?Because prefill is not working.