input = new HashMap<>();
+ input.put("city", "北京");
+ AppBuilderClientRunRequest.ToolChoice.Function func = new AppBuilderClientRunRequest.ToolChoice.Function(
+ "WeatherQuery", input);
+ AppBuilderClientRunRequest.ToolChoice choice = new AppBuilderClientRunRequest.ToolChoice("function", func);
+ request.setToolChoice(choice);
+
+ AppBuilderClientIterator itor = builder.run(request);
+ while (itor.hasNext()) {
+ AppBuilderClientResult result = itor.next();
+ System.out.println(result);
+ }
+ }
+}
+
+```
+
+
+#### ToolChoice示例代码--Go
+
+* 注意:当前功能为试运行阶段,可能存在如下问题,如使用过程遇到其他问题,欢迎提issue或微信群讨论。
+
+ * 需开启"组件/知识库结论可直接作为回复"
+
+ * 组件名称不是界面上的原始名字,而是个人空间组件列表中的英文名
+
+ * 自定义组件的参数不能使用系统参数,可以使用用户添加的参数
+
+ * 部分官方组件使用的参数与界面上的参数不一致
+
+
+```go
+package main
+
+import (
+ "errors"
+ "fmt"
+ "io"
+ "os"
+
+ "github.com/baidubce/app-builder/go/appbuilder"
+)
+
+func main() {
+ // 设置APPBUILDER_TOKEN、GATEWAY_URL_V2环境变量
+ os.Setenv("APPBUILDER_TOKEN", "请设置正确的应用密钥")
+ // 默认可不填,默认值是 https://qianfan.baidubce.com
+ os.Setenv("GATEWAY_URL_V2", "")
+ config, err := appbuilder.NewSDKConfig("", "")
+ if err != nil {
+ fmt.Println("new config failed: ", err)
+ return
+ }
+ // 初始化实例
+ appID := "请填写正确的应用ID"
+ builder, err := appbuilder.NewAppBuilderClient(appID, config)
+ if err != nil {
+ fmt.Println("new agent builder failed: ", err)
+ return
+ }
+ // 创建对话ID
+ conversationID, err := builder.CreateConversation()
+ if err != nil {
+ fmt.Println("create conversation failed: ", err)
+ return
+ }
+
+ // 注意使用创建应用中用到的组件。名称、参数均以实际使用的组件为准。
+ input := make(map[string]any)
+ input["city"] = "北京"
+ end_user_id := "go_toolchoice_demo"
+ i, err := client.Run(AppBuilderClientRunRequest{
+ ConversationID: conversationID,
+ AppID: appID,
+ Query: "",
+ EndUserID: &end_user_id,
+ Stream: false,
+ ToolChoice: &ToolChoice{
+ Type: "function",
+ Function: ToolChoiceFunction{
+ Name: "WeatherQuery",
+ Input: input,
+ },
+ },
+ })
+
+ if err != nil {
+ fmt.Println("run failed: ", err)
+ return
+ }
+
+ for answer, err := i.Next(); err == nil; answer, err = i.Next() {
+ for _, ev := range answer.Events {
+ evJSON, _ := json.Marshal(ev)
+ fmt.Println(string(evJSON))
+ }
+ }
+}
+```
\ No newline at end of file
diff --git a/docs/Application/Agent/UseOfficialComponents/use_official_components.md b/docs/Application/Agent/UseOfficialComponents/use_official_components.md
new file mode 100644
index 000000000..0be61140f
--- /dev/null
+++ b/docs/Application/Agent/UseOfficialComponents/use_official_components.md
@@ -0,0 +1,32 @@
+# Client应用调用官方组件
+
+## 简介
+
+Agent是基于线上Agent应用的问答组件,可以使用该组件利用线上Agent应用进行问答,同时可以在线上为Client应用添加组件,丰富Agent能力。
+
+## Agent添加Components官方组件
+
+整体使用流程包括以下两个环节:
+
+1. 在[百度智能云千帆AppBuilder官网](https://cloud.baidu.com/product/AppBuilder)创建并发布应用(在创建应用时可添加官方组件)、获取应用ID、获取密钥
+2. 引用AppBuilderSDK代码,初始化AppBuilderClient实例、创建会话、上传文档(可选)、执行对话
+
+## 示例
+
+- 接下来将展示创建一个机票查询Agent应用,并添加官方组件。
+
+### 创建应用
+
+- 创建应用并添加自己的角色指令,并按照自己的需求设置模型、记忆功能等参数
+![](https://bj.bcebos.com/v1/appbuilder-sdk-components/%E5%88%9B%E5%BB%BA%E8%88%AA%E7%8F%AD%E6%9F%A5%E8%AF%A2%E5%BA%94%E7%94%A8.png?authorization=bce-auth-v1%2FALTAKGa8m4qCUasgoljdEDAzLm%2F2024-12-17T03%3A51%3A31Z%2F-1%2Fhost%2Fde4a26a46469066111552bf91d50202433ef1cdd89f4945e7924ad11de38fb36)
+
+### 添加官方组件
+
+- 添加官方组件航班查询组件
+![](https://bj.bcebos.com/v1/appbuilder-sdk-components/%E6%B7%BB%E5%8A%A0%E8%88%AA%E7%8F%AD%E6%9F%A5%E8%AF%A2%E6%8C%87%E4%BB%A4.png?authorization=bce-auth-v1%2FALTAKGa8m4qCUasgoljdEDAzLm%2F2024-12-17T03%3A52%3A17Z%2F-1%2Fhost%2F9dfcafb04d9e5992a4feda63f58ffe2211afb01b1e7b0f4f3ec4822ba840562c)
+
+### 发布应用并调用
+
+- 完成应用设置,并发布应用,接下来就可以调用添加了官方组件的Client应用了,应用的具体调用方法请参考[Agent应用基础知识](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/BasicKnowledge/agent.md)
+
+
diff --git a/docs/Application/RAG/DatasetManage/dataset_manage.md b/docs/Application/RAG/DatasetManage/dataset_manage.md
new file mode 100644
index 000000000..057332145
--- /dev/null
+++ b/docs/Application/RAG/DatasetManage/dataset_manage.md
@@ -0,0 +1,64 @@
+# console端知识库操作助手
+
+## 目标
+用户可通过SDK对console端知识库进行操作,实现创建知识库、添加知识文档、查询知识库文档、删除知识文档等操作,可在平台console中查看结果。
+
+```python
+# 设置环境变量
+import os
+
+# 设置环境变量
+# 请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5
+os.environ["APPBUILDER_TOKEN"] = "..."
+```
+
+## 管理知识库
+
+### 初始化已有知识库
+获取线上已有知识库的ID,可在[console](https://console.bce.baidu.com/ai_apaas/dataset)端查看,示例
+
+
+
+```python
+import appbuilder
+# 初始化已有线上知识库, dataset_id 可在平台console中查看
+dataset_id = "..."
+dataset = appbuilder.console.Dataset(dataset_id)
+```
+
+### 创建全新知识库
+
+```python
+# 创建全新知识库
+dataset = appbuilder.console.Dataset.create_dataset("my_dataset")
+```
+
+### 上传文档到知识库
+
+```python
+# 设置文档路径,例如“./test.pdf”
+file_path1 = "..."
+file_path2 = "..."
+file_paths = [file_path1, file_path2]
+# 将文档上传到知识库
+document_infos = dataset.add_documents(file_paths)
+print(document_infos)
+```
+
+### 获取知识库关联文档
+```python
+# 获取第一页的文档列表, 每页10条
+document_list = dataset.get_documents(1, 10)
+print(document_list)
+```
+
+### 删除知识库中的文档
+```python
+# 删除第一个文档
+document_ids = [document_list.data[0].id]
+dataset.delete_documents(document_ids)
+```
+
+### 知识库使用示例
+
+- [知识库使用示例](https://github.com/baidubce/app-builder/blob/master/cookbooks/end2end_application/rag/qa_system_1_dataset.ipynb)
\ No newline at end of file
diff --git a/docs/DevelopGuide/AdvancedDevelopment/README.md b/docs/DevelopGuide/AdvancedDevelopment/README.md
new file mode 100644
index 000000000..0c496f2dd
--- /dev/null
+++ b/docs/DevelopGuide/AdvancedDevelopment/README.md
@@ -0,0 +1,14 @@
+# 开发指引
+
+该文档目录包含以下内容:
+
+- [二次开发基本介绍](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/AdvancedDevelopment/README.md)
+- [AppBuilder SDK 运行环境超参配置说明](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/EnvironmentalParameters/env.md)
+
+
+## 二次开发
+当前已集成Python版本AppBuilder-SDK 0.9.4及相关依赖,方便开发者融入个人已有的大模型应用程序。此部分仍在不断建设中。
+二次开发可以采用官方提供的开发镜像,便于快速安装各种依赖库。也可在镜像中使用已安装的`appbuilder_trace_server`、`appbuilder_bce_deploy`工具。
+``` shell
+docker pull registry.baidubce.com/appbuilder/appbuilder-sdk-devel:0.9.8
+```
\ No newline at end of file
diff --git a/docs/DevelopGuide/ErrorMessage/error_message.md b/docs/DevelopGuide/ErrorMessage/error_message.md
new file mode 100644
index 000000000..de9205112
--- /dev/null
+++ b/docs/DevelopGuide/ErrorMessage/error_message.md
@@ -0,0 +1,92 @@
+# SDK 错误信息
+
+1、 `BaseRPCException`
+
+- 报错解释:
+ - Base RPC exception,
+ - SDK基类异常
+
+2、 `BadRequestException`
+
+- 报错解释:
+ - BadRequestException represent HTTP Code 400
+ - BadRequestException 表示请求错误,错误码为400
+
+3、 `ForbiddenException`
+
+- 报错解释:
+ - ForbiddenException represent HTTP Code 403
+ - ForbiddenException 表示禁止访问,错误码为403
+
+4、 `NotFoundException`
+
+- 报错解释:
+ - NotFoundException represent HTTP Code 404
+ - NotFoundException 表示资源不存在,错误码为404
+
+5、 `PreconditionFailedException`
+
+- 报错解释:
+ - PreconditionFailedException represent HTTP Code 412
+ - PreconditionFailedException 表示前置条件失败,错误码为412
+
+6、 `InternalServerErrorException`
+
+- 报错解释:
+ - InternalServerErrorException represent HTTP Code 500
+ - InternalServerErrorException 表示内部服务器错误,错误码为500
+
+
+7、 `HTTPConnectionException`
+
+- 报错解释:
+ - HTTPConnectionException represent HTTP Connection error
+ - HTTPConnectionException 表示HTTP连接错误
+
+8、 `ModelNotSupportedException`
+
+- 报错解释:
+ - ModelNotSupportedException represent model is not supported
+ - ModelNotSupportedException 表示模型不支持
+
+9、 `TypeNotSupportedException`
+
+- 报错解释:
+ - TypeNotSupportedException represent type is not supported
+ - TypeNotSupportedException 表示类型不支持
+
+10、 `AppBuilderServerException`
+
+- 报错解释:
+ - AppBuilderServerException represent backend server failed response
+ - AppBuilderServerException 表示后端服务器响应失败
+
+11、 `AssistantServerException`
+
+- 报错解释:
+ - AssistantSercerException represent assistant server failed response.
+ - AssistantSercerException 表示助理服务器响应失败
+
+12、 `InvalidRequestArgumentError`
+
+- 报错解释:
+ - InvalidRequestArgumentError invalid request param
+ - InvalidRequestArgumentError 表示请求参数无效
+
+13、 `RiskInputException`
+
+- 报错解释:
+ - RiskInputException represent risk input error
+ - RiskInputException 表示异常输入错误
+
+14、 `AppbuilderBuildexException`
+
+- 报错解释:
+ - Appbuilder buledex exception
+ - AppbuilderBuildexException 表示AppBuilder-SDK构建异常,报错使用与Appbuilder-SDK的构造代码单元检测不符合规范
+
+15、 `AppbuilderTraceException`
+
+- 报错解释:
+ - Appbuilder trace exception
+ - AppbuilderTraceException 表示AppBuilder-SDK追踪框架异常,使用`export APPBUILDER_TRACE_DEBUG=TRUE`来开启Appbuilder-SDK的追踪框架的DEBUG模式,展示报错的完整链路并调试
\ No newline at end of file
diff --git a/docs/DevelopGuide/HowToContributeCode/README.md b/docs/DevelopGuide/HowToContributeCode/README.md
index e56877380..46433c917 100644
--- a/docs/DevelopGuide/HowToContributeCode/README.md
+++ b/docs/DevelopGuide/HowToContributeCode/README.md
@@ -1,19 +1,23 @@
-# 开发指引
+# SDK 贡献代码规范
-该文档目录包含以下内容:
+## 组件开发规范
-- [二次开发基本介绍](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/HowToContributeCode/README.md)
-- [AppBuilder SDK 运行环境超参配置说明](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/EnvironmentalParameters/env.md)
+### 组件整体介绍
+在无特殊情况下,一个官方组件(class Component)的实现可以拆解为以下几个关键模块,分别是
-## 二次开发
-当前已集成Python版本AppBuilder-SDK 0.9.4及相关依赖,方便开发者融入个人已有的大模型应用程序。此部分仍在不断建设中。
-二次开发可以采用官方提供的开发镜像,便于快速安装各种依赖库。也可在镜像中使用已安装的`appbuilder_trace_server`、`appbuilder_bce_deploy`工具。
-``` shell
-docker pull registry.baidubce.com/appbuilder/appbuilder-sdk-devel:0.9.8
-```
+* def run:组件的run函数,规范体现在该函数的输入和输出
+ * 输入规范
+ * 输出规范
+* def tool_eval:组件功能的核心实现,规范体现在该函数的输入和输出
+ * 输入规范
+ * 输出规范
+* dict manifest:组件参与FunctionCall时,帮助大模型理解组件功能的说明,规范体现在manifest的内容和格式
+ * manifest规范
+
+### `run` 函数
-### 消息(Message)
+#### 消息(Message)
- 构建大模型应用的统一数据结构,基于Pydantic构建,在不同的Component之间流动。Message基类的默认字段是content,类型是Any。
```python
from appbuilder import Message
@@ -22,9 +26,13 @@ input_list = Message(["text1", "text2", "text3"])
input_str = Message("红烧肉怎么做")
```
-### 组件(Component)
-- 所有能力单元的标准结构,以Message结构作为输入输出,内部执行逻辑可在本地执行或调用云端服务,以下是官方组件的实现示例。
+#### `run` 函数输入输出规范
+
+- 所有能力单元的标准结构,以Message结构作为输入输出,内部执行逻辑可在本地执行或调用云端服务,以下是官方组件的实现示例。`run` 函数需要添加 `@components_run_trace` 装饰器,实现对组件的trace。
+
```python
+from appbuilder.utils.trace.tracer_wrapper import components_run_trace
+
class SimilarQuestionMeta(ComponentArguments):
""" SimilarQuestionMeta
"""
@@ -67,6 +75,7 @@ class SimilarQuestion(CompletionBaseComponent):
"""
super().__init__(SimilarQuestionMeta, model=model)
+ @components_run_trace
def run(self, message, stream=False, temperature=1e-10):
"""
给定输入(message)到模型运行,同时指定运行参数,并返回结果。
@@ -80,4 +89,411 @@ class SimilarQuestion(CompletionBaseComponent):
obj:`Message`: 模型运行后的输出消息。
"""
return super().run(message=message, stream=stream, temperature=temperature)
-```
\ No newline at end of file
+```
+
+### `tool_eval` 函数
+
+#### `ComponentOutput` 类
+
+```python
+class ComponentOutput(BaseModel):
+ role: str = Field(default="tool",
+ description="role是区分当前消息来源的重要字段,对于绝大多数组件而言,都是填写tool,标明role所在的消息来源为组件。部分思考及问答组件,role需要填写为assistant")
+ content: list[Content] = Field(default=[],
+ description="content是当前组件返回内容的主要payload,List[Content],每个Content Dict 包括了当前输出的一个元素")
+```
+
+#### `tool_eval` 函数输入输出规范
+
+- 组件的核心实现,需要添加 `@components_run_stream_trace` 装饰器,实现对组件的trace。
+
+##### `tool_eval` 函数 输入参数
+
+* 组件tool_eval方法的输入,除了在manifest中约定的参数外,也可能会传入以下系统变量,辅助组件的运行。
+* 系统入参列表中的字段是保留字段,组件定义的manifest不能与系统参数重名。系统参数中有可以被用户设置的参数例如uploaded_files,也有不能设置的字段例如traceid等。
+* 在组件的开发中,以下系统输入字段体现为 def tool_eval(self, key1, key2, \*\*kwargs)中\*\*kwargs包含的内容,key1和key2是manifest中约定的参数,kwargs中的内容是系统入参。
+
+##### `tool_eval` 函数 组件返回字段
+
+* 组件返回参数统一采用json字段,固定key名称和对应的value,value默认是dict类型,value本身需要指定visible_scope。
+* 非流式返回结果,按照所有流式内容的key-value进行合并,例如两个event都是references,那么需要两组references合并,所有组件需要支持非流式返回。
+* 基于sse协议提供流式数据
+* content 本身是个 List[Dict],每个 Dict是当前 event 的一个元素,一般有多个元素的返回例如 urls/files 才需要多个 Dict
+
+###### 组件返回字段总览
+
+|字段|类型|是否必须|默认值 及 取值范围|作用说明|备注|
+|---|---|---|---|---|---|
+|role|str|否|- tool 默认
- user
- assistant
|ole是区分当前消息来源的重要字段,对于绝大多数组件而言,都是填写tool,标明role所在的消息来源为组件。部分思考及问答组件,role需要填写为assistant|{"role": "tool"}|
+|content|list[dict]|是|[]Event|当前组件返回内容的主要payload,List[Dict],每个 Dict 包括了当前 event 的一个元素||
+|+ name|str|否|part1,part2或者3d_pics,title|介绍当前yield内容的step name使用name的必要条件,是有不同content需要是属于结构上的不同字段,但又是streaming的||
+|+ type|str|是|* text 默认
* code
* files
* urls
* oral_text
* references
* image
* chart
* audio
* json|代表event 类型,包括 text、code、files、urls、oral_text、references、image、chart、audio、tought、json
该字段的取值决定了下面text字段的内容结构||
+|+ text|dict
object|是|{}|代表当前 event 元素的内容,每一种 event 对应的 text 结构固定|保留字段
"text": {'filename': 'chart_url.png', 'url': 'https://chart_url.png'},|
+|+ visible_scope|str|否|all 默认
llm
user
空|为了界面展示明确的说明字段
* llm为思考模型可见,类似function calling结果中submit的执行结果
* user为终端用户可见|workflow中存在消息通知节点,类型为notice
目前实测,llm、user、all用户都可见,只是气泡不一样。llm在下拉框中,user直接输出到气泡中。|
+|+ raw_data|dict
object|否|{}|内部信息,由开发者请求透传,内部系统返回的信息,例如API节点收到的resp,大模型节点的MB resp|{
"origin_response": "xxxxx"
}|
+|+ usage|list of dict
object|否|{}|大模型的token用量|{
"prompt_tokens": 1547,
"completion_tokens": 2,
"total_tokens": 1549,
"name": "ERNIE Speed-AppBuilder"
}|
+|+ metrics|dict
object|否|{}|耗时、性能、内存等trace及debug所需信息|{
"begin_timestamp": xxxxx
"end_timestamp": xxxxx
}|
+
+##### 包含 `manifests` 定义的 `tool_eval` 函数返回示例
+
+```python
+class SimilarQuestion(CompletionBaseComponent):
+ r"""
+ 基于输入的问题, 挖掘出与该问题相关的类似问题。广泛用于客服、问答等场景。
+
+ Examples:
+
+ .. code-block:: python
+
+ import os
+ import appbuilder
+
+ os.environ["APPBUILDER_TOKEN"] = "..."
+
+ qa_mining = appbuilder.SimilarQuestion(model="Qianfan-Agent-Speed-8k")
+
+ msg = "我想吃冰淇淋,哪里的冰淇淋比较好吃?"
+ msg = appbuilder.Message(msg)
+ answer = qa_mining(msg)
+
+ print("Answer: \n{}".format(answer.content))
+ """
+ name = "similar_question"
+ version = "v1"
+ meta = SimilarQuestionMeta
+
+ manifests = [
+ {
+ "name": "similar_question",
+ "description": "基于输入的问题,挖掘出与该问题相关的类似问题。",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "query": {
+ "type": "string",
+ "description": "输入的问题,用于大模型根据该问题输出相关的类似问题。"
+ }
+ },
+ "required": [
+ "query"
+ ]
+ }
+ }
+ ]
+
+ def __init__(
+ self,
+ model: str="Qianfan-Agent-Speed-8K",
+ secret_key: Optional[str] = None,
+ gateway: str = "",
+ lazy_certification: bool = True,
+ ):
+ """初始化StyleRewrite模型。
+
+ Args:
+ model (str|None): 模型名称,用于指定要使用的千帆模型。
+ secret_key (str, 可选): 用户鉴权token, 默认从环境变量中获取: os.getenv("APPBUILDER_TOKEN", "").
+ gateway (str, 可选): 后端网关服务地址,默认从环境变量中获取: os.getenv("GATEWAY_URL", "")
+ lazy_certification (bool, 可选): 延迟认证,为True时在第一次运行时认证. Defaults to False.
+
+ Returns:
+ None
+
+ """
+ super().__init__(
+ SimilarQuestionMeta, model=model, secret_key=secret_key, gateway=gateway,
+ lazy_certification=lazy_certification)
+
+ @components_run_stream_trace
+ def tool_eval(self,
+ query: str,
+ **kwargs):
+ """
+ 根据给定的query和可选参数生成并返回文本输出。
+
+ Args:
+ query (str): 需要生成文本的输入查询字符串。
+ **kwargs: 其他可选参数。
+
+ Returns:
+ Generator[Output]: 返回一个生成器,生成类型为Output的对象。
+
+ """
+ traceid = kwargs.get("_sys_traceid")
+ msg = Message(query)
+ model_configs = kwargs.get('model_configs', {})
+ temperature = model_configs.get("temperature", 1e-10)
+ top_p = model_configs.get("top_p", 0.0)
+ message = super().run(message=msg, stream=False, temperature=temperature, top_p=top_p, request_id=traceid)
+
+ yield self.create_output(type="text", text=str(message.content), name="text", usage=message.token_usage)
+```
+
+### `manifest` 规范
+
+* 若组件有tool_eval方法,则必须要求存在manifest
+ * 现状:算法手动撰写;未来:提供工具,自动从python函数的入参及注释转manifest
+* mainfests是一个list[dict],是对组件多个能力的规范化描述,如无特殊情况,一般list中只有一个元素,对应tool_eval的能力
+* manifest dict要满足json schema协议要求
+* 要求manifest dict中parameters-properties定义的参数,与def tool_eval的入参一致
+* 组件中的version字段,会影响的组件URL,参考组件API:组件调用形如:
+ * /v2/components/${component}/version/{$version}?action=${action}
+* 遵循新规范的组件,因输入输出与原组件不兼容,在实现上有显著的标志区分
+
+#### Json Schema协议
+
+- [Json Schema协议](https://json-schema.org/overview/what-is-jsonschema),以下是示例
+
+```python
+class BaiduSearchWithModel(Component):
+ r"""
+ 百度搜索总结工具
+ """
+ name = "baidu_search_with_model"
+ version = "v1" # 修改此处,会影响组件的调用URL
+ manifests = [
+ {
+ "name": "baidu_search_with_model", # 组件名称
+ "description": "对百度搜索结果进行大模型总结", # 组件描述,该字段重要,影响 function calling 效果
+ "parameters": { # parameters 描述组件入参列表
+ "type": "object",
+ "properties": { # 多个参数可以指定多个 properties
+ "query": {
+ "type": "string", # 参数query 的类型
+ "description": "搜索关键词" # 参数query 的描述,该字段重要,影响 function calling 效果
+ }
+ },
+ "required": [
+ "query" # query参数为必填字段
+ ]
+ }
+ }
+ ]
+```
+
+## 代码合入单元测试规范
+
+* 现状: 当前开源Appbuilder-SDK已经部署了单元测试流水线,并要求90%的单元测试覆盖率合入要求,要求开发者实现完整已开发的代码的端到端的测试,并且要求代码增量行覆盖率为90%
+
+### 单元测试规范
+
+#### 单元测试要求
+
+- 覆盖if-else分支
+ - 对于包含if-else逻辑的代码,需要编写测试用例来确保每个分支都被执行到
+- 输入的边界条件检查
+ - 边界条件通常指的是数据范围的极值(如最小值和最大值),或者特定情况下的特殊值(如空值、空字符串、负值等)
+- Error raise的覆盖
+ - 确保测试覆盖了所有可能抛出异常的代码路径,包括代码自身的预期错误,以及访问远程服务失败后的错误处理
+
+#### Test文件目录
+
+* test文件需要为『test_』开头
+* 测试类需要形如『class TestAgentRuntime(unittest.TestCase)::』的定义方式
+* test文件需要置于appbuilder-sdk-ext/appbuilder_sdk_ext/tests路径下
+
+#### UnitTest提供三种标签实现两种运行模式
+
+* 添加下列标签,单元测试脚本实现cpu并行
+ * @unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_PARALLEL", "")
+* 不添加标签,单元测试脚本默认使用cpu串行
+* 添加下列标签,暂时跳过当前单元测试脚本
+ * @unittest.skip(reason="单测暂时跳过")
+
+##### SKIP标签代码示例
+```python
+@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_PARALLEL", "")
+class TestCreateChatPrompt(unittest.TestCase):
+ pass
+
+
+class TestCreateChatPrompt(unittest.TestCase):
+ pass
+
+
+@unittest.skip(reason="单测暂时跳过")
+class TestCreateChatPrompt(unittest.TestCase):
+ pass
+```
+
+#### SDK测试代码示例
+
+下面给出一个通过parameterized库进行多种参数组合的示例,可以大幅简化单测代码,但需注意,多种参数的测试case会并行运行,对服务的QPS有要求
+
+```python
+import unittest
+from parameterized import parameterized, param
+import appbuilder
+
+class TestHandwritingOcr(unittest.TestCase):
+ @parameterized.expand([
+ param(image_url, None, None),
+ param(image_url, None, 0),
+ param(image_url, float(120), None),
+ param(image_url, None, 1),
+ param(image_url, 120.5, 1),
+ param(image_url, float(12000), None),
+ ])
+ def test_normal_case(self, image, timeout, retry):
+ """
+ 正常用例
+ """
+ # 创建表格识别组件实例
+ handwrite_ocr = appbuilder.HandwriteOCR()
+ # 执行识别操作并获取结果
+ if timeout is None and retry is None:
+ out = handwrite_ocr.run(appbuilder.Message(content={"url": image}))
+ elif timeout is None:
+ out = handwrite_ocr.run(appbuilder.Message(content={"url": image}), retry=retry)
+ elif retry is None:
+ out = handwrite_ocr.run(appbuilder.Message(content={"url": image}), timeout=timeout)
+ else:
+ out = handwrite_ocr.run(appbuilder.Message(content={"url": image}), timeout=timeout, retry=retry)
+ res = out.content
+ self.assertIsNotNone(res["contents"], "识别结果为空")
+ self.assertEqual(len(res["contents"]), 6)
+
+ @parameterized.expand([
+ # timeout为0
+ param(image_url, 0, 0, "ValueError", "timeout", 'but the timeout cannot be set to a value '
+ 'less than or equal to 0.'),
+ # timeout为字符串
+ param(image_url, "a", 0, "appbuilder.core._exception.InvalidRequestArgumentError", "timeout",
+ 'timeout must be float or tuple of float'),
+ # timeout为0.1,太短了
+ param(image_url, float(0.1), 0, "requests.exceptions.ReadTimeout", "timeout",
+ "Read timed out. (read timeout=0.1)"),
+ # retry为字符串
+ param(image_url, float(10), "a", "TypeError", "str", "'<' not supported between instances of"
+ " 'str' and 'int'"),
+ # image_url错误
+ param("https://bj.bcebos.com/v1/appbuilder/xxx", 12.5, 1,
+ "appbuilder.core._exception.AppBuilderServerException", "url",
+ "service_err_message=url format illegal"),
+ ])
+ def test_abnormal_case(self, image, timeout, retry, err_type, err_param, err_msg):
+ """
+ 异常用例
+ """
+ try:
+ # 创建表格识别组件实例
+ handwrite_ocr = appbuilder.HandwriteOCR()
+ # 执行识别操作并获取结果
+ out = handwrite_ocr.run(appbuilder.Message(content={"url": image}), timeout=timeout, retry=retry)
+ res = out.content
+ log.info(res)
+ assert False, "未捕获到错误信息"
+ except Exception as e:
+ self.assertIsInstance(e, eval(err_type), "捕获的异常不是预期的类型 实际:{}, 预期:{}".format(e, err_type))
+ self.assertIn(err_param, str(e), "捕获的异常参数类型不正确, 预期 参数:{}, 实际:{}".format(err_param, str(e)))
+ self.assertIn(err_msg, str(e), "捕获的异常消息不正确, 预期:{}, 实际:{}".format(err_msg, str(e)))
+```
+
+## 注释规范
+
+- SDK使用注释自动生成API文档,因此非私有函数的注释需要严格按照Google代码注释规范编写
+
+### object类注释
+
+```python
+class AppBuilderClient(Component):
+ r"""
+ AppBuilderClient 组件支持调用在[百度智能云千帆AppBuilder](https://cloud.baidu.com/product/AppBuilder)平台上
+ 构建并发布的智能体应用,具体包括创建会话、上传文档、运行对话等。
+
+ Examples:
+
+ .. code-block:: python
+
+ import appbuilder
+ # 请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5
+ os.environ["APPBUILDER_TOKEN"] = '...'
+ # 可在Console 应用页面获取
+ app_id = "app_id"
+ client = appbuilder.AppBuilderClient("app_id")
+ conversation_id = client.create_conversation()
+ file_id = client.upload_local_file(conversation_id, "/path/to/file")
+ message = client.run(conversation_id, "今天你好吗?")
+ # 打印对话结果
+ print(message.content)
+
+ """
+```
+- 注意
+ - 注释必须使用 Examples:之后必须存在一行空行,.. code-block:: python之后也必须要有一行空行
+ - code-block前为两点(..)之后为两个冒号(::)
+ - 方法的示例注释与此规范相同
+
+### 函数注释
+
+- 私有函数如_recognize_w_post_process等无需按照规范注释函数
+
+```python
+@components_run_stream_trace
+def tool_eval(
+ self,
+ name: str,
+ streaming: bool,
+ origin_query: str,
+ **kwargs,
+) -> Union[Generator[str, None, None], str]:
+ """
+ 执行工具函数,通过调用底层接口进行动物识别。
+
+ Args:
+ name (str): 工具名
+ streaming (bool): 是否流式返回结果,True 表示流式返回,False 表示一次性返回
+ origin_query (str): 用户原始查询字符串
+ **kwargs: 工具调用的额外关键字参数
+
+ Returns:
+ Union[Generator[str, None, None], str]: 动物识别结果。如果 streaming 为 True,则返回一个生成器,可以逐个返回识别结果;
+ 如果 streaming 为 False,则返回一个字符串,包含识别出的动物类别和相应的置信度信息。
+
+ """
+```
+
+### google风格指南与规范示例
+
+- Google详情见 [Google注释风格指南](https://google.github.io/styleguide/pyguide.html)
+
+
+```python
+class GoogleStyle:
+ '''Google注释风格
+ 用 ``缩进`` 分隔,
+ 适用于倾向水平,短而简单的文档
+ Attributes:
+ dividend (int or float): 被除数
+ name (:obj:`str`, optional): 该类的命名
+ '''
+
+ def __init__(self, dividend, name='GoogleStyle'):
+ '''初始化'''
+ self.dividend = dividend
+ self.name = name
+
+ def divide(self, divisor):
+ '''除法
+ Google注释风格的函数,
+ 类型主要有Args、Returns、Raises、Examples
+ Args:
+ divisor (int):除数
+ Returns:
+ 除法结果
+ Raises:
+ ZeroDivisionError: division by zero
+ Examples:
+
+ .. code-block:: python
+
+ # 实例代码
+
+ References:
+ 除法_百度百科 https://baike.baidu.com/item/%E9%99%A4%E6%B3%95/6280598
+ '''
+ try:
+ return self.dividend / divisor
+ except ZeroDivisionError as e:
+ return e
+```
diff --git a/docs/README.md b/docs/README.md
index 8bb36d53f..5bf0a4f9e 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -9,53 +9,48 @@
- 产业实践应用范例:
- [SDK使用示例](https://github.com/baidubce/app-builder/blob/master/docs/QuickStart/ExamplesOfIndustrialPracticeApplications/README.md)
- [SDK当前支持的编程语言](https://github.com/baidubce/app-builder/blob/master/docs/QuickStart/CurrentlySupportedProgrammingLanguages/README.md)
- - 基础:
- - 模型:
- - [获取模型列表](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Model/get_model_list.md)
- - [组件](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Components/Components.md)
- - 监控:
- - [TRACE基础功能](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/basic.md)
- - [TRACE拓展功能](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/phoenix_method.md)
- - 部署:
- - [交互式前端部署](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/AgentChainlit.md)
- - [公有云部署](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/cloud.md)
- - [API 访问](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/flask.md)
- - [AgentRuntime](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/agentruntime.md)
- - [UserSession](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/usersession.md)
- - 平台:
- - 应用:
- - [AppBuilderClient组件](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/appbuilder_client.md)
- - [获取AppBuilder已发布的应用列表](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/get_app_list.md)
- - 知识库:
- - [知识库组件](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/KnowledgeBase/knowledgebase.md)
- - 自定义组件:
- - [基础能力组件](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/CustomComponents/components.md)
- - 应用:
- - Agent:
- - [基础知识](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [使用官方组件](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [ToolCall](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [ToolChoice](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [使用异步和流式加速客户端调用](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - RAG:
- - [基础知识](https://github.com/baidubce/app-builder/blob/master/docs/Application/RAG/BasicKnowledge/rag.md)
- - [知识库管理](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Reference信息处理](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - Workflow:
- - [基础知识](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [从零使用Workflow组装一个RAG应用](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [从零使用Workflow组装一个Agent应用](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - 开发者指南:
- - [如何贡献代码](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/HowToContributeCode/README.md)
- - [版本升级日志](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/ChangeLog/changelog.md)
- - [常见问题FAQ](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [日志管理](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [错误信息](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [环境参数](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/EnvironmentalParameters/env.md)
- - API Reference:
- - [Python API Reference](https://github.com/baidubce/app-builder/blob/master/docs/API-Reference/Python/PythonAPI.md)
- - [Java API Reference](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Go API Reference](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - 基础:
+ - 模型:
+ - [获取模型列表](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Model/get_model_list.md)
+ - [组件](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Components/Components.md)
+ - 监控:
+ - [TRACE基础功能](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/basic.md)
+ - [TRACE拓展功能](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/phoenix_method.md)
+ - 部署:
+ - [交互式前端部署](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/AgentChainlit.md)
+ - [公有云部署](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/cloud.md)
+ - [API 访问](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/flask.md)
+ - [AgentRuntime](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/agentruntime.md)
+ - [UserSession](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/usersession.md)
+ - 平台:
+ - 应用:
+ - [AppBuilderClient组件](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/appbuilder_client.md)
+ - [获取AppBuilder已发布的应用列表](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/get_app_list.md)
+ - 知识库:
+ - [知识库组件](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/KnowledgeBase/knowledgebase.md)
+ - 自定义组件:
+ - [基础能力组件](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/CustomComponents/components.md)
+ - 应用:
+ - Agent:
+ - [基础知识](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/BasicKnowledge/agent.md)
+ - [使用官方组件](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/UseOfficialComponents/use_official_components.md)
+ - [ToolCall](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/ToolCall/tool_call.md)
+ - [ToolChoice](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/ToolChoice/tool_choice.md)
+ - [使用异步和流式加速客户端调用](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - RAG:
+ - [基础知识](https://github.com/baidubce/app-builder/blob/master/docs/Application/RAG/BasicKnowledge/rag.md)
+ - [知识库管理](https://github.com/baidubce/app-builder/blob/master/docs/Application/RAG/DatasetManage/dataset_manage.md)
+ - [Reference信息处理](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - Workflow:
+ - [基础知识](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - [从零使用Workflow组装一个RAG应用](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - [从零使用Workflow组装一个Agent应用](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - 开发者指南:
+ - [如何贡献代码](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/HowToContributeCode/README.md)
+ - [二次开发](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/AdvancedDevelopment/README.md)
+ - [版本升级日志](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/ChangeLog/changelog.md)
+ - [错误信息](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/ErrorMessage/error_message.md)
+ - [环境参数](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/EnvironmentalParameters/env.md)
## 平台文档
diff --git a/docs/README_en.md b/docs/README_en.md
index 99b24c4d6..88a1a5594 100644
--- a/docs/README_en.md
+++ b/docs/README_en.md
@@ -254,54 +254,49 @@ Hook:
- Industrial practice application examples:
- [SDK usage examples](https://github.com/baidubce/app-builder/blob/master/docs/QuickStart/ExamplesOfIndustrialPracticeApplications/README.md)
- [Currently supported programming languages by SDK](https://github.com/baidubce/app-builder/blob/master/docs/QuickStart/CurrentlySupportedProgrammingLanguages/README.md)
- - Basics:
- - Models:
- - [Get model list](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Model/get_model_list.md)
- - [Components](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Components/Components.md)
- - Monitoring:
- - [TRACE basic functions](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/basic.md)
- - [TRACE extended functions](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/phoenix_method.md)
- - [Debug functionality](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/Debug.md)
- - Deployment:
- - [Interactive front-end deployment](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/AgentChainlit.md)
- - [Public cloud deployment](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/cloud.md)
- - [API access](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/flask.md)
- - [AgentRuntime](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/agentruntime.md)
- - [UserSession](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/usersession.md)
- - Platform:
- - Applications:
- - [AppBuilderClient component](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/appbuilder_client.md)
- - [Get the list of applications published by AppBuilder](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/get_app_list.md)
- - Knowledge Base:
- - [Knowledge Base component](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/KnowledgeBase/knowledgebase.md)
- - Custom Components:
- - [Basic capabilities component](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/CustomComponents/components.md)
- - Applications:
- - Agent:
- - [Basic knowledge](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Using official components](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [ToolCall](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [ToolChoice](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Using asynchronous and streaming accelerated client calls](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - RAG:
- - [Basic knowledge](https://github.com/baidubce/app-builder/blob/master/docs/Application/RAG/BasicKnowledge/rag.md)
- - [Knowledge Base Management](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Reference Information Processing](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - Workflow:
- - [Basic knowledge](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Assembling a RAG application from scratch using Workflow](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Assembling an Agent application from scratch using Workflow](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - Developer Guide:
- - [How to contribute code](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/HowToContributeCode/README.md)
- - [Version upgrade log](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/ChangeLog/changelog.md)
- - [FAQ](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Log Management](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Error messages](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Environmental parameters](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/EnvironmentalParameters/env.md)
- - API Reference:
- - [Python API Reference](https://github.com/baidubce/app-builder/blob/master/docs/API-Reference/Python/PythonAPI.md)
- - [Java API Reference](https://github.com/baidubce/app-builder/blob/master/docs/API-Reference/Java/JavaAPI.md)
- - [Go API Reference](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - Basics:
+ - Models:
+ - [Get model list](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Model/get_model_list.md)
+ - [Components](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Components/Components.md)
+ - Monitoring:
+ - [TRACE basic functions](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/basic.md)
+ - [TRACE extended functions](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/phoenix_method.md)
+ - [Debug functionality](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/Debug.md)
+ - Deployment:
+ - [Interactive front-end deployment](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/AgentChainlit.md)
+ - [Public cloud deployment](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/cloud.md)
+ - [API access](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/flask.md)
+ - [AgentRuntime](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/agentruntime.md)
+ - [UserSession](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/usersession.md)
+ - Platform:
+ - Applications:
+ - [AppBuilderClient component](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/appbuilder_client.md)
+ - [Get the list of applications published by AppBuilder](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/get_app_list.md)
+ - Knowledge Base:
+ - [Knowledge Base component](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/KnowledgeBase/knowledgebase.md)
+ - Custom Components:
+ - [Basic capabilities component](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/CustomComponents/components.md)
+ - Applications:
+ - Agent:
+ - [Basic knowledge](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/BasicKnowledge/agent.md)
+ - [Using official components](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/UseOfficialComponents/use_official_components.md)
+ - [ToolCall](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/ToolCall/tool_call.md)
+ - [ToolChoice](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/ToolChoice/tool_choice.md)
+ - [Using asynchronous and streaming accelerated client calls](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - RAG:
+ - [Basic knowledge](https://github.com/baidubce/app-builder/blob/master/docs/Application/RAG/BasicKnowledge/rag.md)
+ - [Knowledge Base Management](https://github.com/baidubce/app-builder/blob/master/docs/Application/RAG/DatasetManage/dataset_manage.md)
+ - [Reference Information Processing](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - Workflow:
+ - [Basic knowledge](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - [Assembling a RAG application from scratch using Workflow](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - [Assembling an Agent application from scratch using Workflow](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - Developer Guide:
+ - [How to contribute code](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/HowToContributeCode/README.md)
+ - [Secondary Development](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/AdvancedDevelopment/README.md)
+ - [Version upgrade log](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/ChangeLog/changelog.md)
+ - [Error messages](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/ErrorMessage/error_message.md)
+ - [Environmental parameters](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/EnvironmentalParameters/env.md)
## Open source community and activities
diff --git a/docs/README_ja.md b/docs/README_ja.md
index bfac2b37d..54c2eca31 100644
--- a/docs/README_ja.md
+++ b/docs/README_ja.md
@@ -250,54 +250,49 @@ print(answer.content.answer)
- 産業実践アプリケーション例:
- [SDK使用例](https://github.com/baidubce/app-builder/blob/master/docs/QuickStart/ExamplesOfIndustrialPracticeApplications/README.md)
- [現在SDKがサポートしているプログラミング言語](https://github.com/baidubce/app-builder/blob/master/docs/QuickStart/CurrentlySupportedProgrammingLanguages/README.md)
- - 基本:
- - モデル:
- - [モデルリストの取得](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Model/get_model_list.md)
- - [コンポーネント](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Components/Components.md)
- - 監視:
- - [TRACE基本機能](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/basic.md)
- - [TRACE拡張機能](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/phoenix_method.md)
- - [Debug機能](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/Debug.md)
- - デプロイ:
- - [インタラクティブなフロントエンドデプロイ](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/AgentChainlit.md)
- - [パブリッククラウドデプロイ](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/cloud.md)
- - [API アクセス](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/flask.md)
- - [AgentRuntime](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/agentruntime.md)
- - [UserSession](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/usersession.md)
- - プラットフォーム:
- - アプリケーション:
- - [AppBuilderClientコンポーネント](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/appbuilder_client.md)
- - [AppBuilderで公開されたアプリケーションリストの取得](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/get_app_list.md)
- - ナレッジベース:
- - [ナレッジベースコンポーネント](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/KnowledgeBase/knowledgebase.md)
- - カスタムコンポーネント:
- - [基本機能コンポーネント](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/CustomComponents/components.md)
- - アプリケーション:
- - エージェント:
- - [基本知識](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [公式コンポーネントの使用](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [ToolCall](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [ToolChoice](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [非同期およびストリーミングを使用してクライアント呼び出しを加速する](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - RAG:
- - [基本知識](https://github.com/baidubce/app-builder/blob/master/docs/Application/RAG/BasicKnowledge/rag.md)
- - [ナレッジベース管理](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Reference情報処理](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - ワークフロー:
- - [基本知識](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Workflowを使ってRAGアプリケーションをゼロから組み立てる](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [Workflowを使ってAgentアプリケーションをゼロから組み立てる](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - 開発者ガイド:
- - [コードの貢献方法](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/HowToContributeCode/README.md)
- - [バージョンアップログ](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/ChangeLog/changelog.md)
- - [よくある質問FAQ](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [ログ管理](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [エラーメッセージ](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
- - [環境パラメータ](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/EnvironmentalParameters/env.md)
- - APIリファレンス:
- - [Python APIリファレンス](https://github.com/baidubce/app-builder/blob/master/docs/API-Reference/Python/PythonAPI.md)
- - [Java APIリファレンス](https://github.com/baidubce/app-builder/blob/master/docs/API-Reference/Java/JavaAPI.md)
- - [Go APIリファレンス](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - 基本:
+ - モデル:
+ - [モデルリストの取得](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Model/get_model_list.md)
+ - [コンポーネント](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Components/Components.md)
+ - 監視:
+ - [TRACE基本機能](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/basic.md)
+ - [TRACE拡張機能](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/phoenix_method.md)
+ - [Debug機能](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/Debug.md)
+ - デプロイ:
+ - [インタラクティブなフロントエンドデプロイ](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/AgentChainlit.md)
+ - [パブリッククラウドデプロイ](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/cloud.md)
+ - [API アクセス](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/flask.md)
+ - [AgentRuntime](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/agentruntime.md)
+ - [UserSession](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/usersession.md)
+ - プラットフォーム:
+ - アプリケーション:
+ - [AppBuilderClientコンポーネント](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/appbuilder_client.md)
+ - [AppBuilderで公開されたアプリケーションリストの取得](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/get_app_list.md)
+ - ナレッジベース:
+ - [ナレッジベースコンポーネント](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/KnowledgeBase/knowledgebase.md)
+ - カスタムコンポーネント:
+ - [基本機能コンポーネント](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/CustomComponents/components.md)
+ - アプリケーション:
+ - エージェント:
+ - [基本知識](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - [公式コンポーネントの使用](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/UseOfficialComponents/use_official_components.md)
+ - [ToolCall](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/ToolCall/tool_call.md)
+ - [ToolChoice](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/ToolChoice/tool_choice.md)
+ - [非同期およびストリーミングを使用してクライアント呼び出しを加速する](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - RAG:
+ - [基本知識](https://github.com/baidubce/app-builder/blob/master/docs/Application/RAG/BasicKnowledge/rag.md)
+ - [ナレッジベース管理](https://github.com/baidubce/app-builder/blob/master/docs/Application/RAG/DatasetManage/dataset_manage.md)
+ - [Reference情報処理](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - ワークフロー:
+ - [基本知識](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - [Workflowを使ってRAGアプリケーションをゼロから組み立てる](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - [Workflowを使ってAgentアプリケーションをゼロから組み立てる](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
+ - 開発者ガイド:
+ - [コードの貢献方法](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/HowToContributeCode/README.md)
+ - [にじかいせっか](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/AdvancedDevelopment/README.md)
+ - [バージョンアップログ](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/ChangeLog/changelog.md)
+ - [エラーメッセージ](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/ErrorMessage/error_message.md)
+ - [環境パラメータ](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/EnvironmentalParameters/env.md)
## オープンソースコミュニティと活動
diff --git a/mkdocs.yml b/mkdocs.yml
index 044ab306a..7311aa4c1 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -82,15 +82,15 @@ nav:
- 自定义组件:
- 基础能力组件: BasisModule/Platform/CustomComponents/components.md
- 应用:
- # - Agent:
- # - 基础知识:
- # - 使用官方组件:
- # - ToolCall:
- # - ToolChoice:
+ - Agent:
+ - 基础知识: Application/Agent/BasicKnowledge/agent.md
+ - 使用官方组件: Application/Agent/UseOfficialComponents/use_official_components.md
+ - ToolCall: Application/Agent/ToolCall/tool_call.md
+ - ToolChoice: Application/Agent/ToolChoice/tool_choice.md
# - 使用异步和流式加速客户端调用:
- RAG:
- 基础知识: Application/RAG/BasicKnowledge/rag.md
- # - 知识库管理:
+ - 知识库管理: Application/RAG/DatasetManage/dataset_manage.md
# - Reference信息处理:
# - Workflow:
# - 基础知识:
@@ -98,10 +98,9 @@ nav:
# - 从零使用Workflow组装一个Agent应用:
- 开发者指南:
- 如何贡献代码: DevelopGuide/HowToContributeCode/README.md
+ - 二次开发: DevelopGuide/AdvancedDevelopment/README.md
- 版本升级日志: DevelopGuide/ChangeLog/changelog.md
- # - 常见问题FAQ:
- # - 日志管理:
- # - 错误信息:
+ - 错误信息: DevelopGuide/ErrorMessage/error_message.md
- 环境参数: DevelopGuide/EnvironmentalParameters/env.md
- API Reference:
- Python API Reference: API-Reference/Python/PythonAPI.md