Skip to content

Microsoft.Extensions.AI Integration

Cross-SDK comparison

See the centralized MEAI documentation for feature matrices and comparisons across all tryAGI SDKs.

The LlamaParse SDK provides AIFunction tool wrappers compatible with Microsoft.Extensions.AI. These tools can be used with any IChatClient to give AI models document parsing, extraction, and processing capabilities.

Available Tools

Method Tool Name Description
AsParseUrlTool() ParseDocumentUrl Parses a document from a URL and returns markdown. Uploads, polls for completion, and returns the result.
AsGetJobStatusTool() GetParsingJobStatus Checks the status of a parsing job by job ID.
AsGetJobResultTool() GetParsingJobResult Retrieves the parsed markdown content of a completed job.
AsSupportedExtensionsTool() GetSupportedFileExtensions Lists all file extensions supported by LlamaParse.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
using LlamaParse;
using Microsoft.Extensions.AI;

var llamaParse = new LlamaParseClient(apiKey);

// Create tools
var tools = new[]
{
    llamaParse.AsParseUrlTool(),
    llamaParse.AsGetJobStatusTool(),
    llamaParse.AsGetJobResultTool(),
    llamaParse.AsSupportedExtensionsTool(),
};

// Use with any IChatClient
var response = await chatClient.GetResponseAsync(
    "Parse this PDF and summarize it: https://example.com/doc.pdf",
    new ChatOptions { Tools = tools });

Tool Details

ParseDocumentUrl

A blocking tool that: 1. Uploads the URL for parsing 2. Polls until the job completes (configurable interval and max attempts) 3. Returns the parsed markdown content

Parameters: - url (required): The URL of the document to parse - parsingInstruction (optional): Instructions to guide the extraction

1
2
3
var tool = llamaParse.AsParseUrlTool(
    pollingIntervalMs: 2000,    // Poll every 2 seconds
    maxPollingAttempts: 60);    // Timeout after 120 seconds

GetParsingJobStatus / GetParsingJobResult

For async workflows, use these tools separately: 1. Start a parse job via the LlamaParse API 2. Use GetParsingJobStatus to check if the job is complete 3. Use GetParsingJobResult to retrieve the markdown content

GetSupportedFileExtensions

Returns a JSON array of all 130+ file formats supported by LlamaParse (PDF, DOCX, PPTX, HTML, and more).