Table of Contents

Property Id

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

Id

Gets or sets the unique identifier for the document.

public string Id { get; set; }

Property Value

string

The unique document identifier.

Examples

// Using a meaningful ID for lifecycle management
var metadata = new DocumentMetadata(attachment, id: "contract-12345");
await docRag.ImportDocumentAsync(attachment, metadata, "contracts");

// Later, when the contract is updated, delete and re-import
await docRag.DeleteDocumentAsync("contract-12345", "contracts");
var updatedAttachment = Attachment.FromFile("contract-12345-v2.pdf");
var updatedMetadata = new DocumentMetadata(updatedAttachment, id: "contract-12345");
await docRag.ImportDocumentAsync(updatedAttachment, updatedMetadata, "contracts");

Remarks

This identifier uniquely distinguishes the document within the RAG system. By default, a new Guid string is generated during construction.

Specifying an explicit ID is recommended when you need to manage the document lifecycle (delete or update). Use the same ID with DeleteDocument(string, string, CancellationToken) or DeleteDocumentAsync(string, string, CancellationToken) to remove all sections associated with this document.

Consider using meaningful IDs that correlate with external systems (e.g., database records, content management systems, or file paths) for easier document management.