You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
auto/utils/utils_call_kimi.py

28 lines
728 B

# -*- coding: utf-8 -*-
from openai import OpenAI
class KIMI(object):
def call_kimi(self, message):
try:
print('call kimi')
client = OpenAI(
api_key="sk-Fz9tRF8naXReN2H7zcB1AEtnpOmhonFPJgxlVvQHpql54Ymu",
base_url="https://api.moonshot.cn/v1",
)
completion = client.chat.completions.create(
model="moonshot-v1-8k",
messages=[{"role": "user", "content": f"{message}"}],
temperature=0.3,
)
result = completion.choices[0].message.content
return result
except Exception as e:
print(e)
def call_ai(self, message):
pass