使用语音转文本功能提交口述文本
如果有使用语音服务的语音转文本功能转录的对话,请使用以下示例:
curl -i -X POST https://your-language-endpoint-here/language/analyze-conversations/jobs?api-version=2024-05-01 \
-H "Content-Type: application/json" \
-H "Ocp-Apim-Subscription-Key: your-key-here" \
-d \
'
{
"displayName": "Analyze conversations from xxx",
"analysisInput": {
"conversations": [
{
"id": "23611680-c4eb-4705-adef-4aa1c17507b5",
"language": "en",
"modality": "transcript",
"conversationItems": [
{
"participantId": "agent_1",
"id": "8074caf7-97e8-4492-ace3-d284821adacd",
"text": "Good morning.",
"lexical": "good morning",
"itn": "good morning",
"maskedItn": "good morning",
"audioTimings": [
{
"word": "good",
"offset": 11700000,
"duration": 2100000
},
{
"word": "morning",
"offset": 13900000,
"duration": 3100000
}
]
},
{
"participantId": "agent_1",
"id": "0d67d52b-693f-4e34-9881-754a14eec887",
"text": "Can I have your name?",
"lexical": "can i have your name",
"itn": "can i have your name",
"maskedItn": "can i have your name",
"audioTimings": [
{
"word": "can",
"offset": 44200000,
"duration": 2200000
},
{
"word": "i",
"offset": 46500000,
"duration": 800000
},
{
"word": "have",
"offset": 47400000,
"duration": 1500000
},
{
"word": "your",
"offset": 49000000,
"duration": 1500000
},
{
"word": "name",
"offset": 50600000,
"duration": 2100000
}
]
},
{
"participantId": "customer_1",
"id": "08684a7a-5433-4658-a3f1-c6114fcfed51",
"text": "Sure that is John Doe.",
"lexical": "sure that is john doe",
"itn": "sure that is john doe",
"maskedItn": "sure that is john doe",
"audioTimings": [
{
"word": "sure",
"offset": 5400000,
"duration": 6300000
},
{
"word": "that",
"offset": 13600000,
"duration": 2300000
},
{
"word": "is",
"offset": 16000000,
"duration": 1300000
},
{
"word": "john",
"offset": 17400000,
"duration": 2500000
},
{
"word": "doe",
"offset": 20000000,
"duration": 2700000
}
]
}
]
}
]
},
"tasks": [
{
"taskName": "analyze 1",
"kind": "ConversationalPIITask",
"parameters": {
"modelVersion": "2023-04-15-preview",
"redactionSource": "text",
"includeAudioRedaction": true,
"piiCategories": [
"all"
]
}
}
]
}
`
提交文本聊天
如果有源自文本的对话,请使用以下示例。 例如,通过基于文本的聊天客户端进行的对话。
curl -i -X POST https://your-language-endpoint-here/language/analyze-conversations/jobs?api-version=2024-05-01 \
-H "Content-Type: application/json" \
-H "Ocp-Apim-Subscription-Key: your-key-here" \
-d \
'
{
"displayName": "Analyze conversations from xxx",
"analysisInput": {
"conversations": [
{
"id": "23611680-c4eb-4705-adef-4aa1c17507b5",
"language": "en",
"modality": "text",
"conversationItems": [
{
"participantId": "agent_1",
"id": "8074caf7-97e8-4492-ace3-d284821adacd",
"text": "Good morning."
},
{
"participantId": "agent_1",
"id": "0d67d52b-693f-4e34-9881-754a14eec887",
"text": "Can I have your name?"
},
{
"participantId": "customer_1",
"id": "08684a7a-5433-4658-a3f1-c6114fcfed51",
"text": "Sure that is John Doe."
}
]
}
]
},
"tasks": [
{
"taskName": "analyze 1",
"kind": "ConversationalPIITask",
"parameters": {
"modelVersion": "2023-04-15-preview"
}
}
]
}
`
获取结果
从响应头获取 operation-location
。 值将如下 URL 所示:
https://your-language-endpoint/language/analyze-conversations/jobs/12345678-1234-1234-1234-12345678
要获取请求的结果,请使用以下 cURL 命令。 请务必将 my-job-id
替换为从之前的 operation-location
响应头中收到的数值 ID 值:
curl -X GET https://your-language-endpoint/language/analyze-conversations/jobs/my-job-id \
-H "Content-Type: application/json" \
-H "Ocp-Apim-Subscription-Key: your-key-here"