Skip to content

Commit fdb403d

Browse files
authored
Merge branch 'main' into feat/mem0
2 parents d8aa642 + df4b1e8 commit fdb403d

38 files changed

+1364
-442
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ cython_debug/
167167
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168168
.idea/
169169

170+
# Visual Studio Code
171+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
172+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
173+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
174+
# you could uncomment the following to ignore the entire vscode folder
175+
.vscode/
176+
170177
# Ruff stuff:
171178
.ruff_cache/
172179

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ A [tutorial](https://github.com/volcengine/veadk-python/blob/main/veadk_tutorial
1515

1616
## Installation
1717

18+
### From PyPI
19+
20+
```python
21+
pip install veadk-python
22+
23+
# install extensions
24+
pip install veadk-python[extensions]
25+
```
26+
27+
### Build from source
28+
1829
We use `uv` to build this project ([how-to-install-uv](https://docs.astral.sh/uv/getting-started/installation/)).
1930

2031
```bash

docs/content/1.introduction/4.troubleshooting.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,12 @@ navigation:
2424

2525
1. **卡在 release 阶段**
2626
- 请先在 VeFaaS 平台开通权限。
27+
28+
- ![开通权限](/images/troubleshooting-01.png)
29+
30+
- 新账号开通后,缺少ServerlessApplicationRole授权
31+
- 前往火山引擎函数服务官网,进入创建应用页面(例如[这里](https://console.volcengine.com/vefaas/region:vefaas+cn-beijing/application/create?templateId=67f7b4678af5a6000850556c))点击「一键授权」即可
32+
- ![角色授权](/images/troubleshooting-02.png)
33+
34+
2. **安装依赖失败,显示依赖安装空间不足**
35+
- VeFaaS 最大依赖安装大小默认为 250 MB,若需更大空间,请联系 VeFaaS 产品团队扩容。

docs/content/7.knowledgebase/1.knowledgebase.md

Lines changed: 88 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,24 @@ navigation:
55
icon: i-lucide-database
66
---
77

8-
VeADK 支持将结构化或文档型知识作为 Agent 的外部知识源接入。开发者可选择自建知识库,或使用火山引擎现有知识库。自建知识库与使用火山引擎现有知识库的最大区别是:知识文档的分片和数据库维护。VeADK 中知识库的创建如下:
8+
## 概述
9+
10+
VeADK 基于 Llama-index 作为知识库的主要处理入口。开发者可上传文本、文件、目录,我们会为您进行自动切片。
11+
12+
创建知识库时,您必须要提供您的 `app_name`(将会用来自动构建索引名称),或指定一个知识库的索引:
913

1014
```python
11-
from veadk.knowledgebase.knowledgebase import KnowledgeBase
15+
from veadk.knowledgebase import KnowledgeBase
16+
17+
# 通过指定 `app_name`
18+
knowledgebase = KnowledgeBase(
19+
backend="local", app_name="my_app_name"
20+
)
1221

13-
knowledgebase = KnowledgeBase(backend=...)
22+
# 通过指定 `index`
23+
knowledgebase = KnowledgeBase(
24+
backend="local", index="my_index"
25+
)
1426
```
1527

1628
知识库中的 backend 字段定义如下:
@@ -23,39 +35,90 @@ knowledgebase = KnowledgeBase(backend=...)
2335
| redis | Redis 数据库,但不具备向量搜索功能 |
2436
| mysql | MySQL 数据库,但不具备向量搜索功能 |
2537

26-
## 自建知识库
38+
## 使用知识库
2739

28-
自建知识库需要开发者本地进行知识文档的切片,并维护一个数据库(或云数据库)来存储知识文档。
40+
以下示例通过建设一个智能客服 Agent,来说明知识库的能力:
2941

30-
以下示例通过使用 opensearch 定义一个如下的自建知识库:
42+
::code-tree{default-value="agent.py"}
3143

32-
```python
33-
from veadk import Agent
34-
from veadk.knowledgebase.knowledgebase import KnowledgeBase
44+
```markdown[qa.md]
45+
# 智能客服知识库
46+
47+
## 1. 公司简介
48+
49+
VE科技是一家专注于智能客服与知识管理的高科技公司。我们的核心产品是 **智能客服系统**,通过自然语言处理与知识库检索,为企业客户提供高效、智能的自动化客服解决方案。
50+
51+
---
52+
53+
## 2. 产品功能说明
54+
55+
- **自动问答**:基于知识库,快速响应常见问题。
56+
- **多渠道接入**:支持网页、App、微信、飞书等渠道。
57+
- **智能推荐**:根据上下文推荐相关答案。
58+
- **数据分析**:提供用户问题统计与客服绩效报告。
59+
- **自助知识库管理**:支持非技术人员快速编辑知识内容。
60+
61+
---
62+
63+
## 3. 常见问题 (FAQ)
64+
65+
### Q1: 智能客服系统支持哪些语言?
3566
36-
knowledgebase = KnowledgeBase(backend="opensearch")
37-
knowledgebase.add(
38-
knowledgebase_data, app_name=app_name, user_id=user_id, session_id=session_id
39-
) # knowledgebase_data 应当是已切片完成的格式,定义为`list[str]`
67+
A1: 目前支持 **中文** 和 **英文**,后续将逐步增加日语、韩语等多语言支持。
4068
41-
# 将知识库挂载至Agent
42-
agent = Agent(knowledgebase=knowledgebase)
69+
### Q2: 系统可以接入现有的 CRM 吗?
70+
71+
A2: 可以。我们的系统支持通过 API 与主流 CRM 系统(如 Salesforce、Zoho、金蝶)进行无缝集成。
72+
73+
### Q3: 如果机器人无法回答用户问题,会怎么办?
74+
75+
A3: 系统会自动将问题转接至人工客服,并在后台记录该问题,方便管理员补充到知识库。
76+
77+
### Q4: 知识库内容多久更新一次?
78+
79+
A4: 知识库支持 **实时更新**,管理员提交后即可立即生效。
80+
81+
---
82+
83+
## 4. 联系我们
84+
85+
- 官网:[https://www.example.com](https://www.example.com)
86+
- 客服邮箱:support@ve
87+
- 服务热线:400-123-4567
4388
```
4489

45-
## 火山知识库
90+
```python[agent.py]
91+
import asyncio
4692
47-
VeADK 中提供了火山引擎支持的知识库 [VikingDB](https://www.volcengine.com/docs/84313/1254437),支持用户直接上传本地文档,文档切片和存储维护均在云上自动执行:
93+
from veadk import Agent, Runner
94+
from veadk.knowledgebase import KnowledgeBase
95+
from veadk.memory import ShortTermMemory
4896
49-
```python
50-
from veadk import Agent
51-
from veadk.knowledgebase.knowledgebase import KnowledgeBase
97+
app_name = "app"
98+
user_id = "user"
99+
session_id = "session"
52100
53-
FILE_PATH = ...
101+
knowledgebase = KnowledgeBase(backend="local", app_name=app_name)
102+
knowledgebase.add_from_files(files=["./qa.md"])
103+
104+
agent = Agent(
105+
name="customer_service",
106+
instruction="Answer customer's questions according to your knowledgebase.",
107+
knowledgebase=knowledgebase,
108+
)
54109
55-
knowledgebase = KnowledgeBase(backend="viking")
56-
knowledgebase.add(
57-
FILE_PATH, app_name=app_name, user_id=user_id, session_id=session_id
110+
runner = Runner(
111+
agent=agent,
112+
short_term_memory=ShortTermMemory(),
113+
app_name=app_name,
114+
user_id=user_id,
58115
)
59116
60-
agent = Agent(knowledgebase=knowledgebase)
117+
response = asyncio.run(
118+
runner.run(messages="你们的产品叫什么?都有什么功能?", session_id=session_id)
119+
)
120+
121+
print(response)
61122
```
123+
124+
::

0 commit comments

Comments
 (0)