[错误]: 在严格/扁平架构的引导 JSON 后端上, create_community_reports 失败(嵌套的 response_format)
作者: JulioCesarBehenckChaves创建于 2026年9月22日更新于 2026年9月22日
`CommunityReportsExtractor.__call__` 传递 `response_format=CommunityReportResponse` 给 `LLMCompletion.completion_async`,其中 `CommunityReportResponse.findings` 类型为 `list[FindingModel]` - 一个嵌套的 Pydantic `BaseModel`。 Pydantic 的 `model_json_schema()` (以及 litellm 的 `type_to_response_format_param`,它从中构建实际的 `{"type": "json_schema", ...}` 线路负载) 总是将嵌套的 `BaseModel` 因子化为一个顶级 `$defs` 条目,通过 `$ref` 进行引用。 没有内置的强制全嵌入选项。 许多 OpenAI-"严格"-模式兼容的引导式 JSON 后端仅实现 JSON 结构的平面子集,并直接拒绝包含 `$defs`/`$ref` 的任何结构。 具体来说,我对 Databricks AI Gateway 服务的开放权重模型(`gpt-oss-20b`)遇到了这种情况:
内容来源: microsoft/graphrag