Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some notes in 1_3_快速开始 #198

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion docs/guidebook/zh/1_3_快速开始.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,41 @@ class RagAgentTest(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
```

在`test_rag_agent`方法中,我们通过`AgentManager().get_instance_obj`获取了`demo_rag_agent`的实例对象,然后通过`instance.run`方法执行了agent的逻辑。

通过测试,你可以观察agent的思路与答案是否符合你的预期,并且优化对应的设定、增强工具与知识,不断的重复这个步骤直到效果达到满意。

### 运行测试

#### 目录结构要求
agentUniverse期望从 `app/bootstrap` 目录启动,这样才能正确解析配置文件路径。agentUniverse 使用相对路径来定位配置文件,并且以 `bootstrap` 目录作为基准点。

#### 正确的测试运行方式
```bash
# 1. 进入 bootstrap 目录
cd sample_standard_app/app/bootstrap

# 2. 设置 PYTHONPATH 以确保能够正确导入依赖
export PYTHONPATH=/path/to/your/agentUniverse # 替换为你的 agentUniverse 实际路径

# 3. 运行测试
python -m pytest ../test/test_rag_agent.py
```

#### 常见问题
1. **配置文件找不到**
```
FileNotFoundError: [Errno 2] No such file or directory: '../../config/config.toml'
```
这通常是因为没有从 `bootstrap` 目录运行测试导致的。请确保按照上述步骤在正确的目录下运行测试。

2. **警告信息**
```
Warn: Boot file is not located under directory 'bootstrap'
```
这个警告表明当前不是在 `bootstrap` 目录下运行,可能会导致路径解析问题。

## 对agent进行快速服务化
### 使用配置注册服务
在工程的`service`目录下创建`xx_service.yaml`文件,内容样例如下:
Expand All @@ -226,9 +257,12 @@ cd `your bootstrap directory path`
python server_application.py
```

当出现如下命令行说明监听成功,默认监听127.0.0.1地址8000端口,worker数为5,可在`config/gunicorn_config.toml`中修改配置。(注意windows系统与直接使用flask启动的目前默认监听8888端口
当出现如下命令行说明监听成功,默认监听127.0.0.1地址8000端口,worker数为5,可在`config/gunicorn_config.toml`中修改配置。(注意windows系统与直接使用`flask`启动的目前默认监听8888端口
![image](../_picture/1_3_Quick%20Start_0.png)


我们已经将启动服务的必要的步骤写在了 `agentUniverse/sample_standard_app/quick_start.sh` (或者 `quick_start.ps1` 或者 `quick_start.bat`) 中,你可以使用 `quick_start` 脚本启动服务。

### 服务访问
#### 本机或局域网访问
你可以在终端通过curl指令或者如postman工具进行服务访问,curl访问指令如下:
Expand Down