修訂原則 (僅限 2024-11-15-preview 版)
在 2024-11-15-preview 版中,您可以定義 redactionPolicy
參數,以反映在回應中修訂檔時要使用的修訂原則。 原則欄位支援 3 種原則類型:
noMask
characterMask
(預設值)
entityMask
原則 noMask
可讓用戶傳回沒有 欄位的 redactedText
回應。
此原則 characterMask
允許 redactedText
使用字元來遮罩 ,並保留原始文字的長度和位移。 這是現有的行為。
另外還有一個選擇性字段, redactionCharacter
您可以在其中輸入要用於修訂 characterMask
原則的字元
此原則 entityMask
可讓您使用偵測到的實體類型來遮罩偵測到的 PII 實體文字
如果您想要變更修訂原則,請使用下列範例。
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": "1",
"text": "Good morning."
},
{
"participantId": "agent_1",
"id": "2",
"text": "Can I have your name?"
},
{
"participantId": "customer_1",
"id": "3",
"text": "Sure that is John Doe."
}
]
}
]
},
"tasks": [
{
"taskName": "analyze 1",
"kind": "ConversationalPIITask",
"parameters": {
"modelVersion": "2023-04-15-preview",
“redactionCharacter”
"redactionPolicy": {
"policyKind": "characterMask",
//characterMask|entityMask|noMask
"redactionCharacter": "*"
}
}
}
]
}
`
使用語音轉換文字提交文字記錄
如果您使用語音服務的語音轉換文字功能將交談轉換成文字記錄,請使用下列範例:
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
回應標頭收到的數字識別碼數值:
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"