erniemodel

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

Package erniemodel 百度文心AI大模型

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetResult

func GetResult(token string, model int, txt string, min_dec_len, seq_len int, task_prompt ...string) (result string, err error)

创建任务

token:GetToken函数获取,

model:请求类型

txt:用户输入文本

min_dec_len:最小生成长度[1, seq_len]

seq_len:最大生成长度[1, 1000]

seq_len决定生成时间:生成512需要16.3s,生成256需要8.1s,生成128需要4.1s

task_prompt:任务类型(非必需)

model:写作文: 1; 写文案: 2; 写摘要: 3; 对对联: 4; 自由问答: 5; 写小说: 6; 补全文本: 7; 自定义: 8;

task_prompt只支持以下: PARAGRAPH:引导模型生成一段文章; SENT:引导模型生成一句话; ENTITY:引导模型生成词组; Summarization:摘要; MT:翻译; Text2Annotation:抽取; Correction:纠错; QA_MRC:阅读理解; Dialogue:对话; QA_Closed_book: 闭卷问答; QA_Multi_Choice:多选问答; QuestionGeneration:问题生成; Paraphrasing:复述; NLI:文本蕴含识别; SemanticMatching:匹配; Text2SQL:文本描述转SQL;TextClassification:文本分类; SentimentClassification:情感分析; zuowen:写作文; adtext:写文案; couplet:对对联; novel:写小说; cloze:文

func GetToken

func GetToken(clientID, clientSecret string) (token string, err error)

获取当天的token

申请账号链接:https://wenxin.baidu.com/moduleApi/key

clientID为API key,clientSecret为Secret key

token有效时间为24小时

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL