Class DefaultContextBuilder
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
IncludeScores
Whether to include similarity scores in the context.
public bool IncludeScores { get; set; }
Property Value
IncludeSource
Whether to include source metadata in the context.
public bool IncludeSource { get; set; }
Property Value
QueryPrefix
Footer text appended after context, before the query.
public string QueryPrefix { get; set; }
Property Value
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
querystringThe original user query.
searchResultsIReadOnlyList<VectorSearchResult>The top-K search results from the vector store.
Returns
- string
A formatted context string for the LLM.