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

Azure Document Intelligence:AnalyzeDocumentAsync无返回文档问题咨询

问题原因及解决方案
  • 核心问题:调用了不同的预构建模型
    你的代码里两个分析调用使用了不同的模型:

    • 第一个调用用的是prebuilt-invoice(预构建发票模型),这个模型专门针对发票类文档提取结构化数据,所以会返回包含发票信息的Documents集合,result.Documents.Count为1是预期结果。
    • 第二个调用用的是prebuilt-layout(布局分析模型),这个模型的作用是提取文档的布局元素(比如文本块、表格位置、图像区域等),它不会生成Documents集合,所以result2.Documents.Count为0是该模型的正常行为,并非文件流传输问题。
  • 解决方案
    若要分析本地发票文件,只需将第二个调用的模型参数改为prebuilt-invoice,和第一个调用保持一致,同时建议用Using语句管理文件流,自动释放资源:

    Dim filePath = "c:\users\myname\desktop\testfile_xy.pdf" 
    Using stream = New IO.FileStream(filePath, IO.FileMode.Open)
        Dim operation2 As AnalyzeDocumentOperation = Await client.AnalyzeDocumentAsync(WaitUntil.Completed, "prebuilt-invoice", stream)
        Dim result2 As AnalyzeResult = operation2.Value
        Debug.Print(result2.Documents.Count) ' 此时会返回1
    End Using
    

内容的提问来源于stack exchange,提问作者Marcel Walser

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 13:59:30