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_free_al.py

28 lines
744 B

# -*- coding: utf-8 -*-
from openai import OpenAI
class FREEAI(object):
def call_ai(self, message):
try:
client = OpenAI(
api_key="sk-rM32T5VuyyCFyZGyEe006aEdFe6e4301A7627f7a3973Df17",
base_url="https://knox.chat/v1",
)
completion = client.chat.completions.create(
model="deepseek-ai/DeepSeek-R1-Distill-Llama-70B-free",
messages=[{"role": "user", "content": f"{message}"}],
temperature=0.3,
)
result = completion.choices[0].message.content
return result
except Exception as e:
print(e)
# free = FREEAI()
# chat = free.call_kimi('你好')
# print(chat)