← All extraction demos

Permit Desk

Pull the ID, issuing office, and approved activities from a one-page PDF. The sample omits the emergency phone number.

Model scaledown/extract

Source

One-page North Ridge Expedition Permit NR-P-2048, issued by High Basin Ranger Office for trail surveying, water sampling, and wildlife photography.
Open PDF ↗ Download PDF ↓

Fields to extract

permit_id text
The alphanumeric expedition permit identifier.
issuing_office text
The name of the office listed as the issuing office.
approved_activities list · text
Individual activities listed under Approved Activities.
emergency_phone text
The emergency contact phone number, if printed on the permit.
View C# example
using ExtractionsDotNet;

using var client = OpenRouterExtractionsClient.FromEnvironment();

var response = await client.ExtractAsync(new ExtractionRequest("scaledown/extract", // a PDF-capable model
    new Dictionary<string, ExtractionField>
    {
        ["permit_id"] = new TextField { Instructions = "The alphanumeric expedition permit identifier." },
        ["issuing_office"] = new TextField { Instructions = "The name of the office listed as the issuing office." },
        ["approved_activities"] = new ListField(ListItemType.Text),
        ["emergency_phone"] = new TextField { Instructions = "The emergency contact phone number, if printed on the permit." }
    })
{
    Assets = new Dictionary<string, ExtractionAsset>
    {
        ["expedition-permit"] = new(ExtractionAssetFormat.Pdf, await File.ReadAllBytesAsync("north-ridge-permit.pdf"))
    }
});

Console.WriteLine($"{response.GetText("permit_id").Value} from {response.GetText("issuing_office").Value}");

// A field the document lacks comes back with a null Value; Guess may still hold the model's best attempt.
var phone = response.GetText("emergency_phone");
Console.WriteLine(phone.Value is null ? $"No emergency phone printed (guess: {phone.Guess ?? "none"})" : phone.Value);