AI口語老師服務,可以根據用戶的需求和偏好生成更加自然、流程和準確的對話內容,并根據用戶對話給出高質量的自然語言評價,為用戶提供更加個性化、貼心的對話體驗。
Hi,您好,歡迎使用有道智云AI口語老師接口服務。
本文檔主要針對需要集成HTTP API的技術開發(fā)工程師,詳細描述AI口語老師能力相關的技術內容。
如果您有與我們商務合作的需求,可以通過以下方式聯(lián)系我們:
商務郵箱: AIcloud_Business@corp.youdao.com
如果您對文檔內容有任何疑問,可以通過以下幾種方式聯(lián)系我們:
客服QQ:1906538062
AIGC產品技術交流群 :837394306
聯(lián)系郵箱: zhiyun@corp.youdao.com
溫馨提示:
調用方在集成AI口語老師API時,請遵循以下規(guī)則。
規(guī)則 | 描述 |
---|---|
傳輸方式 | HTTPS |
請求方式 | POST |
字符編碼 | 統(tǒng)一使用UTF-8 編碼 |
請求格式 | JSON |
響應格式 | JSON |
AI口語老師線上調用地址:
https://openapi.youdao.com/ai_dialog
1、服務支持10輪對話,系統(tǒng)根據對話輪次,任務完成度,主動回復客戶bye bye,并將end標志設置為結束。
2、如果對話已經結束,再請求生成對話或者推薦表達接口,系統(tǒng)可能只會返回 bye bye。
3、對話歷史系統(tǒng)和用戶content字段的總字符數限制:12000.
4、口語對話服務各接口統(tǒng)一設置 :Content-Type : application/json
5、生成簽名時,q字段的取值在對應的接口里有說明。
注意:
簽名生成方法如下:
signType=v3;
sign=sha256(應用ID+input+salt+curtime+應用密鑰);
其中,input的計算方式為:input=q前10個字符 + q長度 + q后10個字符(當q長度大于20)或 input=q字符串(當q長度小于等于20);
接口參數:
{
"appKey":"",
"salt":"", // 隨機值
"curtime":"", // 時間戳
"signType":"v3", // 僅支持v3
"sign":"", // 生成方式見demo, q取q字段
"q":"topics" // 固定值
}
{????
"code": "0",?//錯誤碼???
"msg": "SUCCESS",?//信息說明????
"data": {
"topicList": [
{
"tag": "初級",
"topics": [
{
"emoji": "??",
"name": "互相介紹",
"enName": "Introduce yourself to a friend at school"
}
]
}
]
}
}
{
"appKey":"",
"salt":"", // 隨機值
"curtime":"", // 時間戳
"signType":"v3", // 僅支持v3
"sign":"", // 生成方式見demo,q取topic字段
"topic": "Introduce yourself to a friend at school" // 用戶指定的話題關鍵詞,語種限制英文,長度限制 < 500,單詞數限制 < 100
}
{
"code": "0",
"msg": "SUCCESS",
"data": {
"taskId": "f52c2df42bc311ee9d19bebd871cbd01", // 任務id
"scene": {
"mainTask": "Introduce yourself and get to know your new friend", // 主任務:對話目標
"emoji": "??",
"subTasks": [ // 子任務列表
"1. Tell your friend your name and where you are from",
"2. Ask your friend about her hobbies and interests",
"3. Talk about your favorite subject in school",
"4. Ask your friend if she has any advice for navigating the school"
],
"botGender": "Female", // 系統(tǒng)性別, 取值范圍: Male 男性; Female 女性;
"botRole": "Friend", // 系統(tǒng)角色
"userRole": "New student", // 用戶角色
"content": "First day of school" // 場景內容
}
}
}
{
"appKey":"",
"salt":"", // 隨機值
"curtime":"", // 時間戳
"signType":"v3", // 僅支持v3
"sign":"", // 生成方式見demo, q取taskId
"taskId": "f52c2df42bc311ee9d19bebd871cbd01", // 場景生成接口返回的任務id
"scene": { // 生成場景接口返回的 scene 字段
"mainTask": "Introduce yourself and get to know your new friend",
"emoji": "??",
"subTasks": [
"1. Tell your friend your name and where you are from",
"2. Ask your friend about her hobbies and interests",
"3. Talk about your favorite subject in school",
"4. Ask your friend if she has any advice for navigating the school"
],
"botGender": "Female",
"botRole": "Friend",
"userRole": "New student",
"content": "First day of school"
},
"userLevel": "0", // 用戶等級:0表示1-3年級小學生;1表示4-6年級小學生;2表示初中學生;3表示高中學生;
"history": [ // 對話歷史,講話人字段:系統(tǒng)與用戶必須交替出現,第一句話的講話人必須是系統(tǒng),獲取系統(tǒng)說的第一句話時,history傳空數組
]
}
{
"code": "0",
"msg": "SUCCESS",
"data": {
"endCode": 0, //結束碼:0-未結束; 1-結束;
"taskId": "f52c2df42bc311ee9d19bebd871cbd01", // 任務id
"resultArr": [
{
"result": [ // 系統(tǒng)回話
"Hi there! My name is Sarah, and I'm from New York. What's your name and where are you from?"
],
"score": 0, // 對話接口不關注此字段
"achievement": [], // 對話接口不關注此字段
"index": -1 // 對話接口不關注此字段
}
]
}
}
{
"appKey":"",
"salt":"", // 隨機值
"curtime":"", // 時間戳
"signType":"v3", // 僅支持v3
"sign":"", // 生成方式見demo, q取taskId
"taskId": "f52c2df42bc311ee9d19bebd871cbd01", // 場景生成接口返回的任務id
"scene": { // 生成場景接口返回的 scene 字段
"mainTask": "Introduce yourself and get to know your new friend",
"emoji": "??",
"subTasks": [
"1. Tell your friend your name and where you are from",
"2. Ask your friend about her hobbies and interests",
"3. Talk about your favorite subject in school",
"4. Ask your friend if she has any advice for navigating the school"
],
"botGender": "Female",
"botRole": "Friend",
"userRole": "New student",
"content": "First day of school"
},
"userLevel": "0", // 用戶等級:0表示1-3年級小學生;1表示4-6年級小學生;2表示初中學生;3表示高中學生;
"history": [ // 對話歷史,講話人字段:系統(tǒng)與用戶必須交替出現
{
"speaker":"System", // 講話人:系統(tǒng),第一句話的講話人必須是系統(tǒng)
"content":"Hi there! My name is Sarah, and I'm from New York. What's your name and where are you from?" // 講話內容, 語種限制英文
},
{
"speaker":"User", // 講話人:用戶
"content":"Hello, I'm Echo, I come from China. Nice to meet you. Do you have any hobbies?" // 講話內容, 語種限制英文,單詞數限制80
}
],
"indexArr": [ // 請求系統(tǒng)生成推薦表達例句的索引(對應history數組),取值為 0 - history.length, 如果取值 = history.length,則會生成對話歷史的下一句話, 目前該數組中僅支持一個值
"1"
],
"count": "1" // 系統(tǒng)生成推薦表達例句的數量,取值 1 - 3,存在指定為3但結果不足3句的情況
}
{
"code": "0",
"msg": "SUCCESS",
"data": {
"endCode": 0, //結束碼:0-未結束; 1-結束;
"taskId": "f52c2df42bc311ee9d19bebd871cbd01", // 任務id
"resultArr": [
{
"result": [ // 系統(tǒng)生成的推薦表達例句
"Hi Sarah, my name is Echo, and I'm from China."
],
"score": 0, // 生成推薦接口不關注此字段
"achievement": [], // 生成推薦接口不關注此字段
"index": 0 // 用戶指定的會話歷史中的索引
}
]
}
}
{
"appKey":"",
"salt":"", // 隨機值
"curtime":"", // 時間戳
"signType":"v3", // 僅支持v3
"sign":"", // 生成方式見demo, q取taskId
"taskId": "f52c2df42bc311ee9d19bebd871cbd01", // 場景生成接口返回的任務id
"scene": { // 生成場景接口返回的 scene 字段
"mainTask": "Introduce yourself and get to know your new friend",
"emoji": "??",
"subTasks": [
"1. Tell your friend your name and where you are from",
"2. Ask your friend about her hobbies and interests",
"3. Talk about your favorite subject in school",
"4. Ask your friend if she has any advice for navigating the school"
],
"botGender": "Female",
"botRole": "Friend",
"userRole": "New student",
"content": "First day of school"
},
"userLevel": "0", // 用戶等級:0表示1-3年級小學生;1表示4-6年級小學生;2表示初中學生;3表示高中學生;
"history": [ // 對話歷史,講話人字段:系統(tǒng)與用戶必須交替出現
{
"speaker":"System", // 講話人:系統(tǒng),第一句話的講話人必須是系統(tǒng)
"content":"Hi there! My name is Sarah, and I'm from New York. What's your name and where are you from?" // 講話內容, 語種限制英文
},
{
"speaker":"User", // 講話人:用戶
"content":"Hello, I'm Echo, I come from China. Nice to meet you. Do you have any hobbies?" // 講話內容, 語種限制英文,單詞數限制80
"voice":"" // 選填字段:音頻的base64編碼, 如果不填,會影響最終的語音評分。音頻格式要求:采樣率16K,單聲道,wav,如格式不符,會影響評分結果。
},
{
"speaker":"System",
"content":"Yes, I love hiking and playing tennis. What about you?"
},
{
"speaker":"User",
"content":"I like singing and running, especially listening to music while running. It's one of my favorite ways to relax. I also like listening to music while reading, so I like Chinese class, how about you?"
}
]
}
{
"code": "0",
"msg": "SUCCESS",
"data": {
"history": [ // 會話歷史, 僅評價用戶的講話內容
{
"index": "1",
"speaker": "User",
"content": "Hello, I'm Echo, I come from China. Nice to meet you. Do you have any hobbies?",
"needImprove": "false", // 是否需要改進:true 表示需要; false 表示不需要
"paraphrase": null, // 潤色結果,如果content的長度 <30 或者單詞數 <3,會導致無法生成潤色結果。
"suggest": { // 系統(tǒng)建議
"grammar": null, // 語法評價
"voice": { // 語音評價
"overall": "0.000040", // 發(fā)音得分
"words": [
{
"word": "Hello",
"text": "Hello 發(fā)音不清晰, 其中 h、e 發(fā)音不準確"
},
{
"word": "I'm",
"text": "I'm 發(fā)音不清晰, 其中 a?、m 發(fā)音不準確"
}
]
}
}
},
{
"index": "3",
"speaker": "User",
"content": "I like singing and running, especially listening to music while running. It's one of my favorite ways to relax. I also like listening to music while reading, so I like Chinese class, how about you?",
"needImprove": "true",
"paraphrase": [
{
"rawSent": "I like singing and running, especially listening to music while running.", // 原句
"diffs": [ // 操作
{
"text": "I",
"operation": "EQUAL" // 不變
},
{
"text": "like",
"operation": "DELETE" // 刪除
},
{
"text": "love",
"operation": "INSERT" // 插入
},
{
"text": "singing and running, especially listening to music while running.",
"operation": "EQUAL" // 不變
}
]
},
{
"rawSent": "It's one of my favorite ways to relax.",
"diffs": null
},
{
"rawSent": "I also like listening to music while reading, so I like Chinese class, how about you?",
"diffs": [
{
"text": "I also like",
"operation": "EQUAL"
},
{
"text": "listening",
"operation": "DELETE"
},
{
"text": "to listen",
"operation": "INSERT"
},
{
"text": "to music while reading, so I like Chinese",
"operation": "EQUAL"
},
{
"text": "class,",
"operation": "DELETE"
},
{
"text": "lessons,",
"operation": "INSERT"
},
{
"text": "how about you?",
"operation": "EQUAL"
}
]
}
],
"suggest": {
"grammar": {
"advice": "語法結構豐富,語言運用自然流暢,沒有語法錯誤",
"score": "79.7"
},
"voice": null
}
}
],
"scene": { // 場景信息
"emoji": "??",
"name": "First day of school"
},
"summary": { // 報告概要
"grammarScore": "64", // 語法得分
"voiceScore": "0", // 音頻得分
"wordNum": "125", // 單詞數
"star": "3" // 任務完成評分,1表示完成主要任務,2表示完成主要任務和部分子任務,3表示完成主要任務和全部子任務
}
}
}
狀態(tài)碼 | 狀態(tài)碼含義 |
---|---|
101 | 缺少必填的參數,首先確保必填參數齊全,然后,確認參數書寫是否正確。 |
102 | 不支持的語言類型 |
103 | 翻譯文本過長 |
104 | 不支持的API類型 |
105 | 不支持的簽名類型 |
106 | 不支持的響應類型 |
107 | 不支持的傳輸加密類型 |
108 | 應用ID無效,注冊賬號,登錄后臺創(chuàng)建應用并完成綁定,可獲得應用ID和應用密鑰等信息 |
109 | batchLog格式不正確 |
110 | 無相關服務的有效應用,應用沒有綁定服務。注:某些服務的結果發(fā)音需要tts服務,需要在控制臺創(chuàng)建語音合成實例綁定應用后方能使用。 |
111 | 開發(fā)者賬號無效 |
112 | 請求服務無效 |
113 | q不能為空 |
114 | 不支持的圖片傳輸方式 |
201 | 解密失敗,可能為DES,BASE64,URLDecode的錯誤 |
202 | 簽名檢驗失敗,如果確認應用ID和應用密鑰的正確性,仍返回202,一般是編碼問題。請確保翻譯文本 q 為UTF-8編碼. |
203 | 訪問IP地址不在可訪問IP列表 |
205 | 請求的接口與應用的平臺類型不一致,確保接入方式(Android SDK、IOS SDK、API)與創(chuàng)建的應用平臺類型一致。如有疑問請參考入門指南 |
206 | 因為時間戳無效導致簽名校驗失敗 |
207 | 重放請求 |
303 | 服務異常 |
405 | 鑒權失敗 |
AIDIALOG001 | topic字段長度或單詞數超出限制 |
AIDIALOG002 | q字段長度超出限制 |
AIDIALOG003 | 不支持的userLevel字段 |
AIDIALOG004 | 不支持的count字段 |
AIDIALOG005 | indexArr字段取值無效 |
AIDIALOG006 | 不支持的speaker字段 |
AIDIALOG007 | 講話人順序異常 |
AIDIALOG008 | 不支持的語種 |
AIDIALOG009 | content字段長度或單詞數超出限制 |
AIDIALOG010 | 生成場景接口請求失敗 |
AIDIALOG011 | 生成推薦表達接口請求失敗 |
AIDIALOG012 | 生成對話接口請求失敗 |
AIDIALOG013 | history字段異常: 結構異常、超出對話輪次限制,生成報告接口該字段為空等。 |
AIDIALOG018 | 基礎服務異常 |
AIDIALOG019 | 請求中包含敏感詞 |
AIDIALOG020 | 系統(tǒng)回話中包含敏感詞 |
AIDIALOG021 | 總字符數超出限制 |
AIDIALOG022 | 系統(tǒng)無結果 |
AIDIALOG023 | scene字段異常 |
AIDIALOG024 | 不支持的bot取值(scene中的字段) |