How do I set the Azure c# document intelligence prebuilt-layout model to return markdown

45 Views Asked by At

I am trying to run the prebuild-layout model using the C# SDK. I do not see anywhere I can set the outputFormat to markdown in the SDK.

From the docs:

Output to markdown format The Layout API can output the extracted text in markdown format. Use the > > outputContentFormat=markdown to specify the output format in markdown. The markdown > content is output as part of the content section.

I don't see anywhere in the SDK that allows me to the outputContentFormat, either int he client or the AnalzyeDocumentOperation options.

      AnalyzeDocumentOperation operation = await client.AnalyzeDocumentFromUriAsync(WaitUntil.Completed, "prebuilt-layout", fileUri, new AnalyzeDocumentOptions { 
          // NO option for markdown
      });
1

There are 1 best solutions below

0
Ray Suelzer On

The Markdown format is only available using the pre-release version of Azure.AI.DocumentIntelligence not Azure.AI.FormRecongizer. You need to selet "include prelease" in the nuget package manager to find the library.

Uri uriSource = new Uri("<uriSource>");

var content = new AnalyzeDocumentContent()
{
    UrlSource = uriSource
};

Operation<AnalyzeResult> operation = await client.AnalyzeDocumentAsync(WaitUntil.Completed, "prebuilt-layout", content, outputContentFormat: ContentFormat.Markdown);
AnalyzeResult result = operation.Value;

Console.WriteLine(result.Content);