Table of Contents

Class DefaultContextBuilder

Namespace
Mythosia.AI.Rag
Assembly
Mythosia.AI.Rag.dll

Default implementation of IContextBuilder that formats search results into a numbered reference block suitable for LLM prompts.

public class DefaultContextBuilder : IContextBuilder
Inheritance
DefaultContextBuilder
Implements
Inherited Members

Properties

Header

Header text prepended to the context block.

public string Header { get; set; }

Property Value

string

IncludeScores

Whether to include similarity scores in the context.

public bool IncludeScores { get; set; }

Property Value

bool

IncludeSource

Whether to include source metadata in the context.

public bool IncludeSource { get; set; }

Property Value

bool

QueryPrefix

Footer text appended after context, before the query.

public string QueryPrefix { get; set; }

Property Value

string

Methods

BuildContext(string, IReadOnlyList<VectorSearchResult>)

Builds a context string from the user query and retrieved search results. The returned string is typically prepended to the LLM prompt as reference material.

public string BuildContext(string query, IReadOnlyList<VectorSearchResult> searchResults)

Parameters

query string

The original user query.

searchResults IReadOnlyList<VectorSearchResult>

The top-K search results from the vector store.

Returns

string

A formatted context string for the LLM.