Table of Contents

Property Metadata

Namespace
LMKit.Retrieval
Assembly
LM-Kit.NET.dll

Metadata

Gets the complete metadata collection associated with this document reference.

public MetadataCollection Metadata { get; }

Property Value

MetadataCollection

Examples

// Access custom metadata from query results
var result = await docRag.QueryPartitionsAsync(question, partitions, conversation);

foreach (var reference in result.SourceReferences)
{
    Console.WriteLine($"Document: {reference.Name}, Page {reference.PageNumber}");
    Console.WriteLine($"  ID: {reference.Id}");
    Console.WriteLine($"  Source: {reference.SourceUri}");

    // Access custom metadata
    if (reference.Metadata.TryGet("author", out var authorMeta))
    {
        Console.WriteLine($"  Author: {authorMeta.Value}");
    }

    if (reference.Metadata.TryGet("department", out var deptMeta))
    {
        Console.WriteLine($"  Department: {deptMeta.Value}");
    }
}

Remarks

This collection includes both standard document metadata and any custom metadata specified via CustomMetadata during import.

Standard metadata keys include:

  • Document ID (accessed via Id)
  • Document name (accessed via Name)
  • Page number (accessed via PageNumber)
  • Source URI (accessed via SourceUri)

Use this property to access custom metadata fields added during document import, such as author, category, version, or any domain-specific attributes.