org.llm4s.rag.transform.LLMQueryRewriter
See theLLMQueryRewriter companion object
final class LLMQueryRewriter(llmClient: LLMClient, systemPrompt: String) extends QueryTransformer
Rewrites user queries using an LLM to improve retrieval quality.
Takes vague, conversational, or poorly-formed queries and rewrites them into precise search queries optimized for semantic vector search.
Value parameters
- llmClient
-
The LLM client to use for rewriting
- systemPrompt
-
Custom system prompt (uses default if not provided)
Attributes
- Example
-
val rewriter = LLMQueryRewriter(llmClient) rewriter.transform("tell me about that config thing") // Right("RAGConfig configuration options builder pattern settings") rewriter.transform("how do I use it with postgres?") // Right("PostgreSQL pgvector integration RAG pipeline configuration") - Companion
- object
- Graph
-
- Supertypes
Members list
In this article