|
@ -1,20 +1,20 @@ |
|
|
# 文心一言 |
|
|
|
|
|
|
|
|
# Ernie Bot 文心一言 |
|
|
|
|
|
|
|
|
*author: Jael* |
|
|
*author: Jael* |
|
|
|
|
|
|
|
|
<br /> |
|
|
<br /> |
|
|
|
|
|
|
|
|
## Description |
|
|
|
|
|
|
|
|
## Description 描述 |
|
|
|
|
|
|
|
|
A LLM operator generates answer given prompt in messages using a large language model or service. |
|
|
A LLM operator generates answer given prompt in messages using a large language model or service. |
|
|
This operator is implemented with Ernie Bot from [Baidu](https://cloud.baidu.com/wenxin.html). |
|
|
This operator is implemented with Ernie Bot from [Baidu](https://cloud.baidu.com/wenxin.html). |
|
|
Please note you will need [Ernie API key & Secret key](https://ai.baidu.com/ai-doc/REFERENCE/Lkru0zoz4) to access the service. |
|
|
Please note you will need [Ernie API key & Secret key](https://ai.baidu.com/ai-doc/REFERENCE/Lkru0zoz4) to access the service. |
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
|
LLM 算子使用大语言模型或服务,为输入的问题或提示生成答案。LLM/Ernie 利用了来自百度的[文心一言](https://cloud.baidu.com/wenxin.html)。请注意,您需要[文心一言服务的 API Key 和 Secret Key](https://ai.baidu.com/ai-doc/REFERENCE/Lkru0zoz4)才能访问该服务。 |
|
|
|
|
|
|
|
|
## Code Example |
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
|
Use the default model to continue the conversation from given messages. |
|
|
|
|
|
|
|
|
## Code Example 代码示例 |
|
|
|
|
|
|
|
|
*Write a pipeline with explicit inputs/outputs name specifications:* |
|
|
*Write a pipeline with explicit inputs/outputs name specifications:* |
|
|
|
|
|
|
|
@ -24,7 +24,7 @@ from towhee import pipe, ops |
|
|
p = ( |
|
|
p = ( |
|
|
pipe.input('messages') |
|
|
pipe.input('messages') |
|
|
.map('messages', 'answer', ops.LLM.Ernie(api_key=ERNIE_API_KEY, secret_key=ERNIE_SECRET_KEY)) |
|
|
.map('messages', 'answer', ops.LLM.Ernie(api_key=ERNIE_API_KEY, secret_key=ERNIE_SECRET_KEY)) |
|
|
.output('messages', 'answer') |
|
|
|
|
|
|
|
|
.output('answer') |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
messages=[ |
|
|
messages=[ |
|
@ -36,7 +36,7 @@ answer = p(messages).get()[0] |
|
|
|
|
|
|
|
|
<br /> |
|
|
<br /> |
|
|
|
|
|
|
|
|
## Factory Constructor |
|
|
|
|
|
|
|
|
## Factory Constructor 接口说明 |
|
|
|
|
|
|
|
|
Create the operator via the following factory method: |
|
|
Create the operator via the following factory method: |
|
|
|
|
|
|
|
@ -59,7 +59,7 @@ Other OpenAI parameters such as temperature, etc. |
|
|
|
|
|
|
|
|
<br /> |
|
|
<br /> |
|
|
|
|
|
|
|
|
## Interface |
|
|
|
|
|
|
|
|
## Interface 使用说明 |
|
|
|
|
|
|
|
|
The operator takes a piece of text in string as input. |
|
|
The operator takes a piece of text in string as input. |
|
|
It returns answer in json. |
|
|
It returns answer in json. |
|
|