You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Azure C#文档智能SDK中设置预建布局模型返回Markdown

解决C# SDK调用prebuilt-layout模型输出Markdown格式的问题
  • 先检查你的Azure.AI.FormRecognizer NuGet包版本,旧版本SDK未包含OutputContentFormat配置项,需升级到最新稳定版。
  • 升级完成后,AnalyzeDocumentOptions类会新增OutputContentFormat属性,通过ContentFormat.Markdown枚举值即可指定输出格式为Markdown。

示例代码:

using Azure.AI.FormRecognizer.DocumentAnalysis;

// 初始化客户端(注意新版本命名空间)
var client = new DocumentAnalysisClient(new Uri("你的端点地址"), new AzureKeyCredential("你的API密钥"));

var analyzeOptions = new AnalyzeDocumentOptions
{
    OutputContentFormat = ContentFormat.Markdown
};

AnalyzeDocumentOperation operation = await client.AnalyzeDocumentFromUriAsync(WaitUntil.Completed, "prebuilt-layout", fileUri, analyzeOptions);

// 获取生成的Markdown内容
var analysisResult = await operation.WaitForCompletionAsync();
string markdownContent = analysisResult.Value.Content;
  • 若升级后仍看不到该属性,确认是否引用了正确的命名空间Azure.AI.FormRecognizer.DocumentAnalysis——新版本SDK调整了命名空间结构,不再使用旧版Azure.AI.FormRecognizer下的相关类。

内容的提问来源于stack exchange,提问作者Ray Suelzer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 16:50:54