我是 APIM 的新手,所以我只打开了现有的 APIM 并尝试添加策略。我遵循了一些片段,所以显然我错过了一些简单但对我来说很复杂的东西。我现在只想尝试只获取 id,但最终我只想要 2 个属性:
{
"id": "chatcmpl-7twCOMGznD52ANyKiuDiRpXwBavT4",
"content": "The size of a horse can vary greatly depending on the breed, age, and individual horse. On average, horses typically stand between 14 to 17 hands high at the withers, which is equivalent to 56 to 68 inches (142 to 173 cm) in height at the shoulder. However, there are smaller horse breeds that can be as short as 8 to 10 hands (32 to 40 inches) and larger draft horse breeds that can reach heights of 18 hands (72 inches) or more."
}
回复通常是这样的:
{
"id": "chatcmpl-7twCOMGznD52ANyKiuDiRpXwBavT4",
"object": "chat.completion",
"created": 1693566112,
"model": "gpt-3.5-turbo-0613",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The size of a horse can vary greatly depending on the breed, age, and individual horse. On average, horses typically stand between 14 to 17 hands high at the withers, which is equivalent to 56 to 68 inches (142 to 173 cm) in height at the shoulder. However, there are smaller horse breeds that can be as short as 8 to 10 hands (32 to 40 inches) and larger draft horse breeds that can reach heights of 18 hands (72 inches) or more."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 107,
"total_tokens": 121
}
}
我试图将其添加到我的出站处理中,但是,我收到内部服务器错误 500。当我在不修改策略的情况下发送时,我得到了结果。
<outbound>
<base />
<set-body template="liquid">{
"id": {{body.id}}
}</set-body>
</outbound>
我的第 3 方 API 是 openai.com,它使用 br 压缩,APIM 策略不支持该压缩 https://learn.microsoft.com/en-us/answers/questions/158061/apim-brotli-compression 。我向 Accept-Encoding: * 请求添加了一个标头,该标头有效。请参阅此处的文档:https://github.com/MicrosoftDocs/azure-docs/issues/95956