Skip to content

Commit 7800462

Browse files
authored
Merge pull request #2 from Serverless-Devs/fix-quick-start
docs(quick-start.md): update quick-start
2 parents 96cf257 + 40b6ee0 commit 7800462

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

docs/tutorial/quick-start.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ AgentRunServer(invoke_agent=invoke_agent).start()
8080
## 5. 调用 Agent
8181

8282
```bash
83-
curl 127.0.0.1:9000/v1/chat/completions \
83+
curl 127.0.0.1:9000/openai/v1/chat/completions \
8484
-XPOST \
8585
-H "content-type: application/json" \
8686
-d '{"messages": [{"role": "user", "content": "通过代码查询现在是几点?"}], "stream":true}'
@@ -90,7 +90,11 @@ curl 127.0.0.1:9000/v1/chat/completions \
9090

9191
项目中已经存在 `s.yaml` 文件,这是 Serverless Devs 的部署配置文件,通过这个文件,您可以配置当前 Agent 在 Agent Run 上的名称、CPU/内存规格、日志投递信息
9292

93-
在示例情况下,您只需要简单修改该文件即可。修改 `role` 字段为拥有 AgentRun Full Access 的角色(如果您拥有精细化权限控制的需求,可以根据实际使用的 API 收敛权限)
93+
在示例情况下,您只需要简单修改该文件即可。修改 `role` 字段为授信给阿里云函数计算(FC)服务,需要拥有AliyunAgentRunFullAccess权限的角色(如果您拥有精细化权限控制的需求,可以根据实际使用的 API 收敛权限)
94+
95+
> 您可以点击此[快速授权链接](https://ram.console.aliyun.com/authorize?request=%7B%22template%22%3A%22OldRoleCommonAuthorize%22%2C%22referrer%22%3A%22https%3A%2F%2Ffunctionai.console.aliyun.com%2Fcn-hangzhou%2Fexplore%22%2C%22payloads%22%3A%5B%7B%22missionId%22%3A%22OldRoleCommonAuthorize.FC%22%2C%22roleName%22%3A%22agentRunRole%22%2C%22roleDescription%22%3A%22AgentRun%20auto%20created%20role.%22%2C%22rolePolicies%22%3A%5B%7B%22policyName%22%3A%22AliyunAgentRunFullAccess%22%7D%2C%7B%22policyName%22%3A%22AliyunDevsFullAccess%22%7D%5D%7D%5D%2C%22callback%22%3A%22https%3A%2F%2Ffunctionai.console.aliyun.com%22%7D),创建一个符合相关权限的角色agentRunRole。
96+
>
97+
> 此快速创建角色的RoleArn为:acs:ram::{您的阿里云主账号 ID}:role/agentRunRole
9498
9599
```yaml
96100
role: acs:ram::{您的阿里云主账号 ID}:role/{您的阿里云角色名称}
@@ -100,9 +104,13 @@ role: acs:ram::{您的阿里云主账号 ID}:role/{您的阿里云角色名称}
100104
101105
在部署前,您需要配置您的部署密钥,使用 `s config add` 进入交互式密钥管理,并按照引导录入您在阿里云的 Access Key ID 与 Access Key Secret。在录入过程中,您需要短期记忆一下您输入的密钥对名称(假设为 `agentrun-deploy`)
102106

103-
配置完成后,即可执行部署
107+
配置完成后,需要首先执行`s build`构建,该步骤依赖本地的`docker`服务,对代码目录下的`requirements.txt`进行构建,以便部署在云端。
108+
109+
随后即可执行`s deploy`进行部署操作。
110+
104111

105112
```bash
113+
s build
106114
s deploy -a agentrun-deploy
107115
# agentrun-deploy 是您使用的密钥对名称,也可以将该名称写入到 s.yaml 开头的 access: 字段中
108116
```
@@ -123,7 +131,7 @@ endpoints:
123131
此处的 url 为您的 Agent 调用地址,将实际的请求 path 拼接到该 base url 后,即可调用云上的 Agent 资源
124132
125133
```bash
126-
curl https://12345.agentrun-data.cn-hangzhou.aliyuncs.com/agent-runtimes/abcd/endpoints/prod/invocations/v1/chat/completions \
134+
curl https://12345.agentrun-data.cn-hangzhou.aliyuncs.com/agent-runtimes/abcd/endpoints/prod/invocations/openai/v1/chat/completions \
127135
-XPOST \
128136
-H "content-type: application/json" \
129137
-d '{"messages": [{"role": "user", "content": "通过代码查询现在是几点?"}], "stream":true}'

0 commit comments

Comments
 (0)