course_4/README.md

19 lines
790 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 第四次 rust 语言作业
1. 购买一个 deepseek api key
2. 使用 rig 框架( [https://docs.rig.rs](https://docs.rig.rs) ,请阅读)构建一个 agent
3. 实现功能:主程序为 loop构建一个可以给 ai 调用的函数: 创建文件,删除文件,阅读文件,操作命令行(如果指令前三个无法完成,再去操作命令行)
4. 让 ai 帮你执行对应的命令行指令。例如下面的场景
```sh
> cargo run --release
user prompt > 删除文件 a.txt
(然后 rig 框架会调用 ai 模型,然后自动调用你刚才定义的那个删除文件的函数,删掉 a.txt)
agent > 已经删除文件 a.txt
user prompt > 列出当前目录所有内容
agent command > ls -al
b.txt c.txt d.txt
agent > 好的,已经列出所有内容
```