Skip to content

Commit

Permalink
Merge branch 'baidubce:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
barrierye authored Mar 13, 2024
2 parents b01f034 + bbfa7ec commit a647a1c
Show file tree
Hide file tree
Showing 87 changed files with 312 additions and 191 deletions.
1 change: 1 addition & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
name: Python package

on:
workflow_dispatch:
push:
branches: [ "master" ]
pull_request:
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ ERNIE-Bot 4.0, ERNIE-Bot-8K, ERNIE-Bot, ERNIE-Bot-turbo, EB-turbo-AppBuilder专
| ERNIE-Bot-8K | eb-8k |
| ERNIE-Bot | eb |
| ERNIE-Bot-turbo | eb-turbo |
| EB-turbo-AppBuilder专用版 | eb-turbo-appbuilder |
| EB-turbo-AppBuilder专用版 | ernie_speed_appbuilder |
| ERNIE Speed-AppBuilder | ernie_speed_appbuilder |


### 典型示例
Expand All @@ -94,7 +95,7 @@ import appbuilder

# 空模版组件
template_str = "你扮演{role}, 请回答我的问题。\n\n问题:{question}\n\n回答:"
playground = appbuilder.Playground(prompt_template=template_str, model="eb-turbo-appbuilder")
playground = appbuilder.Playground(prompt_template=template_str, model="ERNIE Speed-AppBuilder")

# 定义输入,调用空模版组件
input = appbuilder.Message({"role": "java工程师", "question": "java语言的内存回收机制是什么"})
Expand All @@ -107,7 +108,7 @@ print(playground(input, stream=False, temperature=1e-10))
import appbuilder

# 相似问生成组件
similar_q = appbuilder.SimilarQuestion(model="eb-turbo-appbuilder")
similar_q = appbuilder.SimilarQuestion(model="ERNIE Speed-AppBuilder")

# 定义输入,调用相似问生成
input = appbuilder.Message("我想吃冰淇淋,哪里的冰淇淋比较好吃?")
Expand Down Expand Up @@ -149,7 +150,7 @@ import appbuilder
# 空模版组件
playground = appbuilder.Playground(
prompt_template="{query}",
model="eb-turbo-appbuilder"
model="ERNIE Speed-AppBuilder"
)

# 使用 AgentRuntime 来服务化playground组件
Expand Down Expand Up @@ -196,7 +197,7 @@ class SimilarQuestion(CompletionBaseComponent):
os.environ["APPBUILDER_TOKEN"] = "..."
qa_mining = appbuilder.SimilarQuestion(model="eb-turbo-appbuilder")
qa_mining = appbuilder.SimilarQuestion(model="ERNIE Speed-AppBuilder")
msg = "我想吃冰淇淋,哪里的冰淇淋比较好吃?"
msg = appbuilder.Message(msg)
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class AgentRuntime(BaseModel):
class PlaygroundWithHistory(Component):
def __init__(self):
super().__init__()
self.query_rewrite = QueryRewrite(model="eb-turbo-appbuilder")
self.query_rewrite = QueryRewrite(model="ERNIE Speed-AppBuilder")
self.play = Playground(
prompt_template="{query}",
model="eb-4"
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/animal_recognize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ print(out.content)
## 参数说明

### 鉴权说明
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
# 设置环境中的TOKEN,以下示例略
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
Expand Down
7 changes: 1 addition & 6 deletions appbuilder/core/components/animal_recognize/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,14 @@ def _recognize_w_post_process(self, img_path, img_url, file_urls) -> str:
返回:
str: 动物识别结果,包括识别出的动物类别和相应的置信度信息
"""
if not img_path and not img_url:
return "Image path and image url cannot be all empty"
req = AnimalRecognitionRequest()
if img_path in file_urls:
req.url = file_urls[img_path]
if img_url:
req.url = img_url
req.top_num = 6
req.baike_num = 0
try:
result = self._recognize(req)
except Exception as ex:
return "API call failed: {}".format(str(ex))
result = self._recognize(req)
result_dict = proto.Message.to_dict(result)
rec_res = "模型识别结果为:\n"
for rec_info in result_dict['result']:
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/asr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ print(out.content)
## 参数说明

### 鉴权配置
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
# 设置环境中的TOKEN,以下示例略
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/dish_recognize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ print(resp.content)

## 参数说明
### 鉴权说明
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
# 设置环境中的TOKEN,以下示例略
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/doc_crop_enhance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ print(out.content)
## 参数说明

### 鉴权说明
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
# 设置环境中的TOKEN,以下示例略
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/doc_parser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ print(parse_result.content)
## 参数说明

### 鉴权说明
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
# 设置环境中的TOKEN,以下示例略
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
Expand Down
4 changes: 2 additions & 2 deletions appbuilder/core/components/doc_splitter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ print(res_paras.content)
## 参数说明

### 鉴权说明
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
# 设置环境中的TOKEN,以下示例略
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
Expand Down Expand Up @@ -128,7 +128,7 @@ print(res_paras.content)
## 参数说明:

### 鉴权配置
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
# 设置环境中的TOKEN,以下示例略
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/embeddings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ print(outs.content)
## 参数说明

### 鉴权说明
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
# 设置环境中的TOKEN,以下示例略
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/extract_table/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ logger.info("Tables: {}".format(

## 参数说明
### 鉴权说明
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
# 设置环境中的TOKEN,以下示例略
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/gbi/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ class ColumnItem(BaseModel):


SUPPORTED_MODEL_NAME = {
"ERNIE-Bot 4.0", "ERNIE-Bot-8K", "ERNIE-Bot", "ERNIE-Bot-turbo", "EB-turbo-AppBuilder"
"ERNIE-Bot 4.0", "ERNIE-Bot-8K", "ERNIE-Bot", "ERNIE-Bot-turbo", "ERNIE Speed-AppBuilder"
}
2 changes: 1 addition & 1 deletion appbuilder/core/components/gbi/nl2sql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ print(f"llm result: {nl2sql_result_message.content.llm_result}")
## 参数说明

### 初始化参数
- model_name: 支持的模型名字 ERNIE-Bot 4.0, ERNIE-Bot-8K, ERNIE-Bot, ERNIE-Bot-turbo, EB-turbo-AppBuilder"
- model_name: 支持的模型名字 ERNIE-Bot 4.0, ERNIE-Bot-8K, ERNIE-Bot, ERNIE-Bot-turbo, ERNIE Speed-AppBuilder
- table_schemas: 表的 schema,例如:

```
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/gbi/nl2sql/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, model_name: str, table_schemas: List[str], knowledge: Dict =
"""
创建 gbi nl2sql 对象
Args:
model_name: 支持的模型名字 ERNIE-Bot 4.0, ERNIE-Bot-8K, ERNIE-Bot, ERNIE-Bot-turbo, EB-turbo-AppBuilder
model_name: 支持的模型名字 ERNIE-Bot 4.0, ERNIE-Bot-8K, ERNIE-Bot, ERNIE-Bot-turbo, ERNIE Speed-AppBuilder
table_schemas: 表的 schema 列表,例如: ```
CREATE TABLE `mytable` (
`d_year` COMMENT '年度,2019,2020..2022..',
Expand Down
10 changes: 5 additions & 5 deletions appbuilder/core/components/gbi/select_table/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# GBI 选表

## 简介
GBI 选表根据提供的多个 MySql 表名 以及 表名对应的描述信息,通过 query 选择一个或多个最合适的表来回答该 query.
一般的试用场景是,当有数据库有多个表的时候,但是实际只有1个表能回答该 query,那么,通过该能力将该表选择出来,用于后面的 问表 环节。
GBI 选表根据提供的多个 MySql 表名 以及 表名对应的描述信息,通过 query 选择一个或多个最合适的表来回答该 query
一般的适用场景是,当有数据库有多个表的时候,但是实际只有1个表能回答该 query,那么,通过该能力将该表选择出来,用于后面的 问表 环节。


### 功能介绍
GBI 选表,根据提供的多个 MySql 表名 以及 表名对应的描述信息,通过 query 选择一个或多个最合适的表来回答该 query.
一般的试用场景是,当有数据库有多个表的时候,但是实际只有1个表能回答该 query,那么,通过该能力将该表选择出来,用于后面的 问表 环节。
GBI 选表,根据提供的多个 MySql 表名 以及 表名对应的描述信息,通过 query 选择一个或多个最合适的表来回答该 query
一般的适用场景是,当有数据库有多个表的时候,但是实际只有1个表能回答该 query,那么,通过该能力将该表选择出来,用于后面的 问表 环节。

### 特色优势
可直接通过上传Excel进行数据问答
Expand Down Expand Up @@ -51,7 +51,7 @@ print(f"选的表是: {select_table_result_message.content}")

## 参数说明
### 初始化参数
- model_name: 支持的模型名字 ERNIE-Bot 4.0, ERNIE-Bot-8K, ERNIE-Bot, ERNIE-Bot-turbo, EB-turbo-AppBuilder
- model_name: 支持的模型名字 ERNIE-Bot 4.0, ERNIE-Bot-8K, ERNIE-Bot, ERNIE-Bot-turbo, ERNIE Speed-AppBuilder
- table_descriptions: 表的描述是个字典,key: 是表的名字, value: 是表的描述,例如:

```
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/gbi/select_table/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, model_name: str, table_descriptions: Dict[str, str],
"""
创建 GBI 选表对象
Args:
model_name: 支持的模型名字 ERNIE-Bot 4.0, ERNIE-Bot-8K, ERNIE-Bot, ERNIE-Bot-turbo, EB-turbo-AppBuilder
model_name: 支持的模型名字 ERNIE-Bot 4.0, ERNIE-Bot-8K, ERNIE-Bot, ERNIE-Bot-turbo, ERNIE Speed-AppBuilder
table_descriptions: 表的描述是个字典,key: 是表的名字, value: 是表的描述,例如:
{
"超市营收明细表": "超市营收明细表,包含超市各种信息等",
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/general_ocr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ print(out.content)
## 参数说明

### 鉴权说明
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
# 设置环境中的TOKEN,以下示例略
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/handwrite_ocr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ print(out.content)
## 参数说明

### 鉴权说明
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
import os

Expand Down
14 changes: 12 additions & 2 deletions appbuilder/core/components/handwrite_ocr/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,20 @@ def tool_eval(self, name: str, streaming: bool, **kwargs):
response = self._recognize(req)
result[file_name] = [w.words for w in response.words_result]

result = json.dumps(result, ensure_ascii=False)
if streaming:
yield json.dumps(result, ensure_ascii=False)
yield {
"type": "text",
"text": result,
"visible_scope": 'llm',
}
yield {
"type": "text",
"text": "",
"visible_scope": "user",
}
else:
return json.dumps(result, ensure_ascii=False)
return result

def _recognize(self, request: HandwriteOCRRequest, timeout: float = None, retry: int = 0) -> HandwriteOCRResponse:
r"""调用底层接口进行通用文字识别
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/image_understand/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ print(out.content)
## 参数说明

### 鉴权说明
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
import os
os.environ["APPBUILDER_TOKEN"] = "..."
Expand Down
7 changes: 1 addition & 6 deletions appbuilder/core/components/image_understand/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,13 @@ def _recognize_w_post_process(self, img_path, img_url, file_urls, question="图
返回:
str: 图片内容理解结果
"""
if question == "":
return "Question cannot be empty"
req = ImageUnderstandRequest()
req.question = question
if img_path in file_urls:
req.url = file_urls[img_path]
if img_url:
req.url = img_url
try:
response = self.__recognize(req)
except Exception as ex:
return "API call failed: {}".format(str(ex))
response = self.__recognize(req)
description_to_llm = response.result.description_to_llm
description_processed = description_to_llm.rsplit("。", 2)[0]
return description_processed
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/landmark_recognize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ print(out.content) # eg: {"landmark": "尼罗河"}
## 参数说明

### 鉴权说明
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
import os

Expand Down
4 changes: 2 additions & 2 deletions appbuilder/core/components/llms/dialog_summary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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"] = "bce-YOURTOKEN"

dialog_summary = appbuilder.DialogSummary("eb-turbo-appbuilder")
dialog_summary = appbuilder.DialogSummary("ERNIE Speed-AppBuilder")
text = "用户:喂我想查一下我的话费\n坐席:好的女士您话费余的话还有87.49元钱\n用户:好的知道了谢谢\n坐席:嗯不客气祝您生活愉快再见"
answer = dialog_summary(appbuilder.Message(text))
print(answer)
Expand All @@ -32,7 +32,7 @@ print(answer)
## 参数说明

### 鉴权配置
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
# 设置环境中的TOKEN,以下示例略
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DialogSummary(CompletionBaseComponent):
# 请前往千帆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"] = '...'
dialog_summary = appbuilder.DialogSummary("eb-turbo-appbuilder")
dialog_summary = appbuilder.DialogSummary("ERNIE Speed-AppBuilder")
text = "用户:喂我想查一下我的话费\n坐席:好的女士您话费余的话还有87.49元钱\n用户:好的知道了谢谢\n坐席:嗯不客气祝您生活愉快再见"
answer = dialog_summary(appbuilder.Message(text))
print(answer)
Expand Down
6 changes: 3 additions & 3 deletions appbuilder/core/components/llms/is_complex_query/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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"] = "..."

is_complex_query = appbuilder.IsComplexQuery(model="eb-turbo-appbuilder")
is_complex_query = appbuilder.IsComplexQuery(model="ERNIE Speed-AppBuilder")

msg = "吸塑包装盒在工业化生产和物流运输中分别有什么重要性?"
msg = appbuilder.Message(msg)
Expand All @@ -33,7 +33,7 @@ print("Answer: \n{}".format(answer.content))
## 参数说明

### 鉴权说明
使用组件之前,请首先申请并设置鉴权参数,可参考[使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)
```python
# 设置环境中的TOKEN,以下示例略
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
Expand All @@ -42,7 +42,7 @@ os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
### 初始化参数
|参数名称 |参数类型 |是否必须 |描述 |示例值|
|--------|--------|--------|----|------|
|model |str ||模型名称,用于指定要使用的千帆模型|eb-turbo-appbuilder|
|model |str ||模型名称,用于指定要使用的千帆模型|ERNIE Speed-AppBuilder|

### 调用参数
|参数名称 |参数类型 |是否必须 |描述 |示例值|
Expand Down
Loading

0 comments on commit a647a1c

Please sign in to comment.