GenericRandomErrorPlugin

失败请求,其中包含模拟错误的文件中随机选择的错误。

命令提示符的屏幕截图,其中开发人员代理模拟了配置文件中定义的 OpenAI API 请求的错误之一。

插件实例定义

{
  "name": "GenericRandomErrorPlugin",
  "enabled": true,
  "pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
  "configSection": "genericRandomErrorPlugin",
  "urlsToWatch": [
    "https://api.openai.com/*"
  ]
}

配置示例

{
  "genericRandomErrorPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.27.0/genericrandomerrorplugin.schema.json",
    "errorsFile": "errors.json"
  }
}

配置属性

财产 描述 违约
errorsFile 包含错误响应的文件的路径。 无默认值
rate 失败的请求百分比,并出现随机错误。 介于 0 和 100 之间的值。 50
retryAfterInSeconds 重试请求之前等待的秒数。 包含在动态限制的 Retry-After 响应标头中。 5

命令行选项

名称 描述 违约
-f, --failure-rate <failure rate> 失败的请求百分比,并出现随机错误。 介于 0 和 100 之间的值。 50

后续步骤