AS中使用DeepSeek
DeepSeek 可称为国内最强大脑,那么在AS中如何使用它呢?
准备工作
- 在DeepSeek官网 注册并开通APIkey
代码案例
# 加载插件
from ascript.android import plug
plug.load("deepseek")
from deepseek import DeepSeek
# 初始化deepseek
ai = DeepSeek("你的apikey")
# 查询账号余额
余额 = ai.blance()
print(余额)
# 提问
res1 = ai.ask("你的智商得 分是多少呢?")
print(res1)
# 连续对话,连续的对话,耗费更多token
res2 = ai.ask("那么你觉得智商多少分才算优秀呢?",reset=False)
print(res2)
# 重置对话缓存,开启新的对话
res3 = ai.ask("那么你觉得智商多少分才算优秀呢?")
print(res3)
参数解释
# 方法原型
DeekSeep(apikey:str).ask(msg:str,reset=True)
- apikey:str 在DeepSeek官网 注册并开通APIkey
- msg:str 要对话的信息
- reset: 是否重置会话,默认是. 改为False则为连续对话. 连续对话会大量消耗token