Table of Contents

Method ContextualizeAsync

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

ContextualizeAsync(string, ChatHistory, LM, QueryContextualizationOptions, CancellationToken)

Reformulates a follow-up question into a self-contained query using the recent conversation history.

public static Task<string> ContextualizeAsync(string question, ChatHistory chatHistory, LM model, QueryContextualizationOptions options = null, CancellationToken cancellationToken = default)

Parameters

question string

The follow-up question to contextualize.

chatHistory ChatHistory

The conversation history to draw context from. When null or empty, the question is returned unchanged.

model LM

The language model used for reformulation. Must not be null.

options QueryContextualizationOptions

Configuration controlling history depth and token budget. Defaults are used when null.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<string>

The reformulated self-contained query, or the original question if contextualization is not needed or fails.

Exceptions

ArgumentNullException

Thrown when model is null.

Share