Skip to content

Commit

Permalink
Update model names (ernie-longtext -> ernie-3.5-8k) (#340)
Browse files Browse the repository at this point in the history
* update model names

* replace all ernie-longtext
  • Loading branch information
sijunhe authored Apr 17, 2024
1 parent c97b9f9 commit 91b9d78
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 30 deletions.
8 changes: 4 additions & 4 deletions docs/modules/chat_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

为了降低使用门槛和开发工作,我们推荐通过`ERNIE Bot Agent`来调用文心一言模型,助力大家快速开发出AI应用。

`ERNIE Bot Agent`支持多个文心一言模型,包括`ernie-3.5``ernie-turbo``ernie-4.0``ernie-longtext`
`ERNIE Bot Agent`支持多个文心一言模型,包括`ernie-3.5``ernie-turbo``ernie-4.0``ernie-3.5-8k`

| 模型名称 | 说明 | 功能 | 输入token数量上限 |
|:--- | :--- | :--- | :--- |
| ernie-3.5 | 文心大模型3.5版本。具备优秀的知识增强和内容生成能力,在文本创作、问答、推理和代码生成等方面表现出色。 | 对话补全,函数调用 | 3000 |
| ernie-turbo | 文心大模型。相比ernie-3.5模型具备更快的响应速度和学习能力,API调用成本更低。 | 对话补全 | 3000 |
| ernie-4.0 | 文心大模型4.0版本,具备目前系列模型中最优的理解和生成能力。 | 对话补全,函数调用 | 3000 |
| ernie-longtext | 文心大模型。在ernie-3.5模型的基础上增强了对长对话上下文的支持,输入token数量上限为7000。 | 对话补全,函数调用 | 7000 |
| ernie-3.5-8k | 文心大模型。在ernie-3.5模型的基础上增强了对长对话上下文的支持,输入token数量上限为7000。 | 对话补全,函数调用 | 7000 |

## 2. 核心类

Expand All @@ -25,7 +25,7 @@

| 属性 | 类型 | 描述 |
| ---------- | -------------- | ------------------------------------------------------- |
| model | str | 文心一言模型的名称,支持"ernie-3.5", "ernie-turbo", "ernie-4.0", "ernie-longtext" |
| model | str | 文心一言模型的名称,支持"ernie-3.5", "ernie-turbo", "ernie-4.0", "ernie-3.5-8k" |
| default_chat_kwargs | Dict[str, Any] | 设置调用文心一言模型的默认参数,支持`temperature`,`top_p`等,具体参考[文档](https://github.com/PaddlePaddle/ERNIE-SDK/blob/develop/docs/sdk/api_reference/chat_completion.md)|

| 方法 | 描述 |
Expand All @@ -37,7 +37,7 @@

| 属性 | 类型 | 描述 |
| ---------- | -------------| --------------------------------------------------------- |
| model | str | 文心一言模型的名称,支持"ernie-3.5", "ernie-turbo", "ernie-4.0", "ernie-longtext" |
| model | str | 文心一言模型的名称,支持"ernie-3.5", "ernie-turbo", "ernie-4.0", "ernie-3.5-8k" |
| api_type | str | 文心一言模型的后端,支持"aistudio"和"qianfan",默认是"aistudio"。 |
| access_token | Optional[str] | 文心一言模型的鉴权access token,不同后端需要使用对应的access token |
| enable_multi_step_tool_call | bool | 设置是否开启多工具规划连续调用的功能,默认为False |
Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ models = erniebot.Model.list()

print(models)
# ernie-3.5 文心大模型(ernie-3.5)
# ernie-3.5-8k 文心大模型(ernie-3.5-8k)
# ernie-lite 文心大模型(ernie-lite)
# ernie-4.0 文心大模型(ernie-4.0)
# ernie-longtext 文心大模型(ernie-longtext)
# ernie-speed 文心大模型(ernie-speed)
# ernie-speed-128k 文心大模型(ernie-speed-128k)
# ernie-tiny-8k 文心大模型(ernie-tiny-8k)
Expand Down Expand Up @@ -69,7 +69,7 @@ erniebot api image.create --model ernie-vilg-v2 --prompt "画一只驴肉火烧"

### 对话补全(Chat Completion)

ERNIE Bot提供具备对话补全能力的ernie-3.5、ernie-turbo、ernie-4.0、ernie-longtext等文心大模型
ERNIE Bot提供具备对话补全能力的ernie-3.5、ernie-turbo、ernie-4.0、ernie-3.5-8k等文心大模型

不同模型在效果、速度等方面各有千秋,大家可以根据实际场景的需求选择合适的模型。

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/api_reference/chat_completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ erniebot.ChatCompletion.create(

| 参数名 | 类型 | 必填 | 描述 |
| :--- | :--- | :--- | :--- |
| model | str || 模型名称。当前支持`"ernie-3.5"``"ernie-turbo"``"ernie-4.0"``"ernie-longtext"`|
| model | str || 模型名称。当前支持`"ernie-3.5"``"ernie-turbo"``"ernie-4.0"``"ernie-3.5-8k"`|
| messages | list[dict] || 对话上下文信息。列表中的元素个数须为奇数。详见[messages](#messages)|
| functions | list[dict] || 可触发函数的描述列表。详见[functions](#functions)。ernie-turbo模型暂不支持此参数。 |
| temperature | float || 用于调节模型输出概率分布,从而控制生成结果的随机性。<ul><li>较高的数值会使生成结果更加随机,而较低的数值会使结果更加集中和确定;</li><li>默认<code>0.95</code>,范围为<code>(0, 1.0]</code>,不能为<code>0</code>;</li><li>建议只设置此参数和<code>top_p</code>中的一个。</li></ul> |
Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ ERNIE Bot支持多个后端平台来调用文心大模型(如下表格),

| 后端 | api_type | 支持的模型 |
| :--- | :--- | :--- |
| AI Studio | aistudio | ernie-3.5,ernie-turbo,ernie-4.0,ernie-longtext,ernie-text-embedding |
| 千帆大模型平台 | qianfan | ernie-3.5,ernie-turbo,ernie-4.0,ernie-longtext,ernie-text-embedding |
| AI Studio | aistudio | ernie-3.5,ernie-turbo,ernie-4.0,ernie-3.5-8k,ernie-text-embedding |
| 千帆大模型平台 | qianfan | ernie-3.5,ernie-turbo,ernie-4.0,ernie-3.5-8k,ernie-text-embedding |
| 智能创作平台 | yinian | ernie-vilg-v2 |

## AI Studio后端的认证鉴权
Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/guides/chat_completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
| ernie-3.5 | 具备优秀的知识增强和内容生成能力,在文本创作、问答、推理和代码生成等方面表现出色。 |`erniebot.ChatCompletion.create(model="ernie-3.5", ...)` |
| ernie-turbo | 相比ernie-3.5模型具备更快的响应速度和学习能力,API调用成本更低。 | `erniebot.ChatCompletion.create(model="ernie-turbo", ...)` |
| ernie-4.0 | 文心大模型4.0版本,具备系列模型中最优的理解和生成能力。 | `erniebot.ChatCompletion.create(model="ernie-4.0", ...)` |
| ernie-longtext | 在ernie-3.5模型的基础上增强了对长对话上下文的支持,输入token数量上限为7000。 | `erniebot.ChatCompletion.create(model="ernie-longtext", ...)` |
| ernie-3.5-8k | 在ernie-3.5模型的基础上增强了对长对话上下文的支持,输入token数量上限为7000。 | `erniebot.ChatCompletion.create(model="ernie-3.5-8k", ...)` |

参阅[ChatCompletion API文档](../api_reference/chat_completion.md)了解API的完整使用方式。

Expand All @@ -60,7 +60,7 @@

### 模型的输入长度有限制吗?

文心大模型对输入的token数量有限制。对于ernie-3.5、ernie-turbo和ernie-4.0模型,输入的token数量不能超过3000;对于ernie-longtext模型,输入token数量的限制是7000。以下分别讨论单轮和多轮对话的情形:
文心大模型对输入的token数量有限制。对于ernie-3.5、ernie-turbo和ernie-4.0模型,输入的token数量不能超过3000;对于ernie-3.5-8k模型,输入token数量的限制是7000。以下分别讨论单轮和多轮对话的情形:

* 单轮对话时,输入的token数量不能超出限制。
* 多轮对话时,最后一条消息的token数量不能超出限制。此外,如果最后一条消息的token数量没有超出限制,而对话上下文(包括历史消息)的token总量超过了限制,则模型会在拼接输入时遗忘较早的历史信息,只保留满足token数限制的最近的对话上下文作为输入。
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ERNIE Bot支持的所有模型如下:
| ernie-3.5 | 文心大模型3.5版本。具备优秀的知识增强和内容生成能力,在文本创作、问答、推理和代码生成等方面表现出色。 | 对话补全,函数调用 | qianfan,aistudio | message中的content总长度、functions和system字段总内容不能超过20000个字符,且不能超过5120 tokens | 2048 |
| ernie-lite | ERNIE Lite是百度自研的轻量级大语言模型,兼顾优异的模型效果与推理性能,适合低算力AI加速卡推理使用。 | 对话补全 | qianfan,aistudio | message中的content总长度和system字段总内容不能超过11200个字符,且不能超过7168 tokens | 1024 |
| ernie-4.0 | 文心大模型4.0版本,具备目前系列模型中最优的理解和生成能力。 | 对话补全,函数调用 | qianfan,aistudio | message中的content总长度和system字段总内容不能超过20000个字符,且不能超过5120 tokens | 2048 |
| ernie-longtext | 文心大模型。在ernie-3.5模型的基础上增强了对长对话上下文的支持,输入token数量上限为7000。 | 对话补全,函数调用 | qianfan,aistudio | message中的content总长度、functions和system字段总内容不能超过20000个字符,且不能超过5120 tokens | 2048 |
| ernie-3.5-8k | 文心大模型。在ernie-3.5模型的基础上增强了对长对话上下文的支持,输入token数量上限为7000。 | 对话补全,函数调用 | qianfan,aistudio | message中的content总长度、functions和system字段总内容不能超过20000个字符,且不能超过5120 tokens | 2048 |
| ernie-speed | ERNIE Speed是百度自研高性能大语言模型,通用能力优异,适合作为基座模型进行精调,更好地处理特定场景问题,同时具备极佳的推理性能 | 对话补全 | qianfan,aistudio | message中的content总长度和system字段总内容不能超过24000个字符,且不能超过6144 tokens | 2048 |
| ernie-speed-128k | ERNIE Speed是百度自研高性能大语言模型,通用能力优异,适合作为基座模型进行精调,更好地处理特定场景问题,同时具备极佳的推理性能。 | 对话补全 | qianfan,aistudio | message中的content总长度和system字段总内容不能超过516096个字符,且不能超过126976 tokens | 4096 |
| ernie-tiny-8k | ERNIE Tiny是百度自研的超高性能大语言模型,部署与精调成本在文心系列模型中最低 | 对话补全 | qianfan,aistudio | message中的content总长度和system字段总内容不能超过24000个字符,且不能超过6144 tokens | 2048 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def get_summary(content: str) -> Union[str, None]:
"""Get summary of md files, you can also change another llm model."""
chat_message = {"role": "user", "content": f"请帮我给以下markdown文件生成摘要用于用户问文档内容时的检索匹配,不要超过400个字:\n{content}"}
summary = erniebot.ChatCompletion.create(
model="ernie-longtext",
model="ernie-3.5-8k",
messages=[chat_message],
).get_result()
return summary
Expand Down
2 changes: 1 addition & 1 deletion erniebot-agent/applications/erniebot_researcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ERNIEBot Researcher能够精心编撰内容详尽、真实可信且立场公正

主要思想是运行“planner”和“execution” agents,而planner生成问题进行研究,execution agents根据每个生成的研究问题寻求最相关的信息。最后,planner 过滤并汇总所有相关信息,并创建一份研究报告。

Agents利用ernie-4.0和ernie-longtext来完成研究任务, ernie-4.0主要用于做决策和规划,ernie-longtext主要用于撰写报告
Agents利用ernie-4.0和ernie-3.5-8k来完成研究任务, ernie-4.0主要用于做决策和规划,ernie-3.5-8k主要用于撰写报告


<div align="center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def main(query):
os.makedirs(dir_path, exist_ok=True)
target_path = f"{args.save_path}/{hashlib.sha1(query.encode()).hexdigest()}/revised"
os.makedirs(target_path, exist_ok=True)
llm_long = ERNIEBot(model="ernie-longtext")
llm_long = ERNIEBot(model="ernie-3.5-8k")
llm = ERNIEBot(model="ernie-4.0")
build_index_function, retrieval_tool = get_retriver_by_type(args.framework)
retriever_sets = get_retrievers(build_index_function, retrieval_tool)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def get_agents(retriever_sets, tool_sets, llm, llm_long, build_index_function, r


def main(query):
llm_long = ERNIEBot(model="ernie-longtext")
llm_long = ERNIEBot(model="ernie-3.5-8k")
llm = ERNIEBot(model="ernie-4.0")
build_index_function, retrieval_tool = get_retriver_by_type(args.framework)
retriever_sets = get_retrievers(build_index_function, retrieval_tool)
Expand Down
2 changes: 1 addition & 1 deletion erniebot-agent/applications/erniebot_researcher/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def generate_report(query, history=[]):
target_path = f"{args.save_path}/{hashlib.sha1(query.encode()).hexdigest()}/revised"
os.makedirs(target_path, exist_ok=True)
llm = ERNIEBot(model="ernie-4.0")
llm_long = ERNIEBot(model="ernie-longtext")
llm_long = ERNIEBot(model="ernie-3.5-8k")
build_index_function, retrieval_tool = get_retriver_by_type(args.framework)

retriever_sets = get_retrievers(build_index_function, retrieval_tool)
Expand Down
4 changes: 2 additions & 2 deletions erniebot-agent/cookbook/chat_models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"\n",
"目前市面上已经有很多大语言模型,比如OpenAI的ChatGPT、百度的文心一言等等。大语言模型通常具有大量参数,对运行机器的显存和算量有很高的要求。为了方便大家使用,这些大语言模型都有对外提供相应的调用接口。\n",
"\n",
"在`ERNIE Bot Agent`中,我们支持快速调用文心一言的多个模型,包括`ernie-3.5`、`ernie-turbo`、`ernie-4.0`和`ernie-longtext`。\n",
"在`ERNIE Bot Agent`中,我们支持快速调用文心一言的多个模型,包括`ernie-3.5`、`ernie-turbo`、`ernie-4.0`和`ernie-3.5-8k`。\n",
"\n",
"| 模型名称 | 说明 | 功能 | 输入token数量上限 |\n",
"|:--- | :--- | :--- | :--- |\n",
"| ernie-3.5 | 文心大模型3.5版本。具备优秀的知识增强和内容生成能力,在文本创作、问答、推理和代码生成等方面表现出色。 | 对话补全,函数调用 | 3000 |\n",
"| ernie-turbo | 文心大模型。相比ernie-3.5模型具备更快的响应速度和学习能力,API调用成本更低。 | 对话补全 | 3000 |\n",
"| ernie-4.0 | 文心大模型4.0版本,具备目前系列模型中最优的理解和生成能力。 | 对话补全,函数调用 | 3000 |\n",
"| ernie-longtext | 文心大模型。在ernie-3.5模型的基础上增强了对长对话上下文的支持,输入token数量上限为7000。 | 对话补全,函数调用 | 7000 |"
"| ernie-3.5-8k | 文心大模型。在ernie-3.5模型的基础上增强了对长对话上下文的支持,输入token数量上限为7000。 | 对话补全,函数调用 | 7000 |"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion erniebot-agent/src/erniebot_agent/chat_models/erniebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def __init__(
Args:
model (str): The model name. It should be "ernie-3.5", "ernie-turbo", "ernie-4.0", or
"ernie-longtext".
"ernie-3.5-8k".
api_type (str): The backend of erniebot. It should be "aistudio" or "qianfan".
Defaults to "aistudio".
access_token (Optional[str]): The access token for the backend of erniebot.
Expand Down
18 changes: 11 additions & 7 deletions erniebot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,16 @@ import erniebot
models = erniebot.Model.list()

print(models)
# ernie-3.5 文心大模型(ernie-3.5)
# ernie-turbo 文心大模型(ernie-turbo)
# ernie-4.0 文心大模型(ernie-4.0)
# ernie-longtext 文心大模型(ernie-longtext)
# ernie-text-embedding 文心百中语义模型
# ernie-vilg-v2 文心一格模型
# ernie-3.5 文心大模型(ernie-3.5)
# ernie-3.5-8k 文心大模型(ernie-3.5-8k)
# ernie-lite 文心大模型(ernie-lite)
# ernie-4.0 文心大模型(ernie-4.0)
# ernie-speed 文心大模型(ernie-speed)
# ernie-speed-128k 文心大模型(ernie-speed-128k)
# ernie-tiny-8k 文心大模型(ernie-tiny-8k)
# ernie-char-8k 文心大模型(ernie-char-8k)
# ernie-text-embedding 文心百中语义模型
# ernie-vilg-v2 文心一格模型

# Set authentication params
erniebot.api_type = "aistudio"
Expand Down Expand Up @@ -84,7 +88,7 @@ erniebot api image.create --model ernie-vilg-v2 --prompt "画一只驴肉火烧"

### 对话补全(Chat Completion)

ERNIE Bot提供具备对话补全能力的ernie-3.5、ernie-turbo、ernie-4.0、ernie-longtext等文心大模型
ERNIE Bot提供具备对话补全能力的ernie-3.5、ernie-turbo、ernie-4.0、ernie-3.5-8k等文心大模型

不同模型在效果、速度等方面各有千秋,大家可以根据实际场景的需求选择合适的模型。

Expand Down
2 changes: 1 addition & 1 deletion erniebot/examples/cookbook/00-Getting-Started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
"| ernie-3.5 | 文心大模型3.5版本。具备优秀的知识增强和内容生成能力,在文本创作、问答、推理和代码生成等方面表现出色。 | 对话补全,函数调用 | qianfan,aistudio | 3000 |\n",
"| ernie-turbo | 文心大模型。相比ernie-3.5模型具备更快的响应速度和学习能力,API调用成本更低。 | 对话补全 | qianfan,aistudio | 3000 |\n",
"| ernie-4.0 | 文心大模型4.0版本,具备目前系列模型中最优的理解和生成能力。 | 对话补全,函数调用 | qianfan,aistudio | 3000 |\n",
"| ernie-longtext | 文心大模型。在ernie-3.5模型的基础上增强了对长对话上下文的支持,输入token数量上限为7000。 | 对话补全,函数调用 | qianfan,aistudio | 7000 |\n",
"| ernie-3.5-8k | 文心大模型。在ernie-3.5模型的基础上增强了对长对话上下文的支持,输入token数量上限为7000。 | 对话补全,函数调用 | qianfan,aistudio | 7000 |\n",
"| ernie-text-embedding | 文心百中语义模型。支持计算最多384个token的文本的向量表示。 | 语义向量 | qianfan,aistudio | 384*16 |\n",
"| ernie-vilg-v2 | 文心一格模型。 | 文生图 | yinian | 200 |"
]
Expand Down
2 changes: 1 addition & 1 deletion erniebot/examples/cookbook/01-Chat-Completion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"\n",
"| 参数名 | 类型 | 必填 | 描述 |\n",
"| :--- | :--- | :------- | :---- |\n",
"| model | str | 是 | 模型名称。当前支持`'ernie-3.5'`、`'ernie-turbo'`、`'ernie-4.0'`和`'ernie-longtext'`。 |\n",
"| model | str | 是 | 模型名称。当前支持`'ernie-3.5'`、`'ernie-turbo'`、`'ernie-4.0'`和`'ernie-3.5-8k'`。 |\n",
"| messages | list[dict] | 是 | 对话上下文信息。列表中的元素个数须为奇数。|\n",
"| functions | list[dict] | 否 | 可触发函数的描述列表。ernie-turbo模型暂不支持此参数。 |\n",
"| top_p | float | 否 | 生成的token从概率和恰好达到或超过`top_p`的token集合中采样得到。 <br>(1) 影响生成文本的多样性,取值越大,生成文本的多样性越强; <br>(2) 默认`0.8`,取值范围为`[0, 1.0]`; <br>(3) 建议只设置此参数和`temperature`中的一个。 |\n",
Expand Down
2 changes: 1 addition & 1 deletion erniebot/src/erniebot/intro.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def list() -> List[Tuple[str, str]]:
("ernie-3.5", "文心大模型(ernie-3.5)"),
("ernie-turbo", "文心大模型(ernie-turbo)"),
("ernie-4.0", "文心大模型(ernie-4.0)"),
("ernie-longtext", "文心大模型(ernie-longtext)"),
("ernie-3.5-8k", "文心大模型(ernie-3.5-8k)"),
("ernie-speed", " 文心大模型(ernie-speed)"),
("ernie-speed-128k", " 文心大模型(ernie-speed-128k)"),
("ernie-tiny-8k", " 文心大模型(ernie-tiny-8k)"),
Expand Down

0 comments on commit 91b9d78

Please sign in to comment.