Skip to content

Commit

Permalink
add doc of agent api
Browse files Browse the repository at this point in the history
  • Loading branch information
yangj1211 committed Sep 27, 2024
1 parent 4ede0d2 commit da92da9
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 19 deletions.
7 changes: 7 additions & 0 deletions docs/APIDocs/agent_api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sidebar_position: 3
title: Agent api
sidebar_label: Agent api
---


8 changes: 0 additions & 8 deletions docs/APIDocs/power-api/_category_.json

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
sidebar_position: 3
title: Agent API
sidebar_label: Agent API
---

## 公共聊天 API

**POST** `https://gateway.neolink-ai.com/byoa/api/v1/agents/chat_public`

### API 描述

当用户的 Agent 发布后,可以通过调用此接口进行聊天会话。

### 请求参数

|参数 |类型 | 说明 |
|------------------|----------|---------|
|deploy_url_suffix |string | agent_id |
|messages |json | 请求的内容 |


### 示例

- 非流式请求

```python
import requests

url = "https://gateway.neolink-ai.com/byoa/api/v1/agents/chat_public"

data = {
"deploy_url_suffix": "BMZOzoDkpnpuQGplVtXAIaYuCouGivRAvdn29xxxx",
"messages": [
{
"role": "user",
"content": "hello!"
},
{
"role": "assistant",
"content": "Hello, how can I help you?"
},
{
"role": "user",
"content": "中国奥运会是哪年举行的?"
}
]
}

response = requests.post(url, json=data)
print(response.text)
```

- 流式请求

```python
import requests

url = "https://gateway.neolink-ai.com/byoa/api/v1/agents/chat_public"

data = {
"deploy_url_suffix": "BMZOzoDkpnpuQGplVtXAIaYuCouGivRAvdn29xxxx",
"messages": [
{
"role": "user",
"content": "hello!"
},
{
"role": "assistant",
"content": "Hello, how can I help you?"
},
{
"role": "user",
"content": "请生成一篇800字的高考作文"
}
]
}

response = requests.post(url, json=data, stream=True)
for line in response.iter_lines():
print(line.decode("utf-8"))
```

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ sidebar_label: 算力API

在平台右上角的下拉菜单中选择 **API 凭证**,将跳转至 API 凭证页面。

<img src={require('../../../../../../static/img/apikey/token-1.png').default} alt="获取token" style={{width: '800px', height: 'auto'}} />
<img src={require('../../../../../static/img/apikey/token-1.png').default} alt="获取token" style={{width: '800px', height: 'auto'}} />

点击**新增 Token**,输入自定义的 Token 名称,默认有效期为 3650 天,可根据需要进行调整。

<img src={require('../../../../../../static/img/apikey/token-2.png').default} alt="获取token" style={{width: '800px', height: 'auto'}} />
<img src={require('../../../../../static/img/apikey/token-2.png').default} alt="获取token" style={{width: '800px', height: 'auto'}} />

点击 **确定** 后,您将看到新生成的 Token 显示在列表中。请注意,Token 仅会生成一次,请务必及时复制并妥善保存!如果您遗失了 Token,可以选择新增 Token 或 **重新生成**

<img src={require('../../../../../../static/img/apikey/token-3.png').default} alt="获取token" style={{width: '800px', height: 'auto'}} />
<img src={require('../../../../../static/img/apikey/token-3.png').default} alt="获取token" style={{width: '800px', height: 'auto'}} />

## 获取 region id 和 clusterName

Expand Down

0 comments on commit da92da9

Please sign in to comment.