构建聊天机器人只需5分钟:Claude API接入指南
3 分钟为您的项目,小程序,网页免费接入 Claude-API
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
1.
了解Claude
Claude
Claude 采用了创新的 Constitutional AI(CAI)方法。现有的聊天 AI 系统,如 ChatGPT,主要采用人类反馈强化学习(RLHF)算法。
该方法通过拟合大量人工标注的数据来训练模型,以学习满足人类的偏好并产生有用(Helpful)、诚恳(Honest)和无害(Harmless)的回复。
作为目前唯一能和ChatGPT相抗衡的免费AI。目前也只能在slack上使用。
下面将介绍如何将 Claude 免费接入到我们自己项目并使用他的API
2.
注册工作区
注册工作区
工作区的注册方式
登录网站,创建一个工作区
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/640wx_fmtpngamptpwxpicampwxfrom5ampwx_lazy1ampwx_co1.png)
图1
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/1_640wx_fmtpngamptpwxpicampwxfrom5ampwx_lazy1ampwx_co1.png)
图2
输入需要注册的邮件
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/2_640wx_fmtpngamptpwxpicampwxfrom5ampwx_lazy1ampwx_co1.png)
图3
输入邮箱里的验证码
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/3_640wx_fmtpngamptpwxpicampwxfrom5ampwx_lazy1ampwx_co1.png)
图4
返回首页创建一个新的工作区
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/4_640wx_fmtpngamptpwxpicampwxfrom5ampwx_lazy1ampwx_co1.png)
图5
设置团队名称
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/5_640wx_fmtpngamptpwxpicampwxfrom5ampwx_lazy1ampwx_co1.png)
图6
这一步可以进行跳过
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/6_640wx_fmtpngamptpwxpicampwxfrom5ampwx_lazy1ampwx_co1.png)
图7
设置团队的目标
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/7_640wx_fmtpngamptpwxpicampwxfrom5ampwx_lazy1ampwx_co1.png)
图8
将Claude添加到我们的频道
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/8_640wx_fmtpngamptpwxpicampwxfrom5ampwx_lazy1ampwx_co1.png)
图9
选择允许添加到我们频道
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/9_640wx_fmtpngamptpwxpicampwxfrom5ampwx_lazy1ampwx_co1.png)
图10
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/10_640wx_fmtpngamptpwxpicampwxfrom5ampwx_lazy1ampwx_co1.png)
图11
选择我们添加的频道并同意政策,随后就可以正常操作
3.创建频道
创建频道
创建频道
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/1_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/2_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
创建属于自己的频道
4.
获取授权bot
获取授权 bot
进入 slack 官网 https://slack.com/intl/zh-cn/并登录
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/3_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
进入 api 配置界面 https://api.slack.com 选择Your apps
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/4_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/5_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/6_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
将工作区加入到App中
5.
设置权限
设置权限
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/7_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/8_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/9_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
将上列选项加入到权限中
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/10_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/11_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/12_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/13_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
获取到的成员id和OAuthToken保存下来
6.
构建函数
构建函数
打开 laf(云函数) https://laf.dev 构建一个函数
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/14_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/15_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
安装好所需的依赖,并将代码导入配置好三个”中的内容
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/16_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
7.
运行测试
运行测试
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/17_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
![构建聊天机器人只需5分钟:Claude API接入指南](https://chatgptprompt.cc/wp-content/uploads/2023/06/18_640wx_fmtpngampwxfrom5ampwx_lazy1ampwx_co1.png)
可以看到我们已经可以得到答案且Claude里也有相应的数据
© 版权声明
The copyright of the article belongs to the author, please do not reprint without permission.
相关文章
暂无评论...