Whatever message this page gives is out now! Go check it out!
Requirement | simpleRAG() | agent() |
Minimal setup, zero config | Preferred | Works but verbose |
Custom document loader (URL, UDF) | No | documentLoader |
Pre-split document transformation | No | documentTransformer |
Post-split segment transformation | No | segmentTransformer |
Nested splitter config (separators, regex) | No | ingestion.documentSplitter |
Query transformation (compressing) | No | queryTransformer |
Multiple retrievers / multi-store routing | No | queryRouter |
Content aggregation with separator | No | contentAggregator |
Custom prompt template (contentInjector) | No | contentInjector |
Stage | Config key | Role |
Document Loader | ingestion.documentLoader | Reads files, URLs, or a custom UDF into document structs. |
Document Transformer | ingestion.documentTransformer | Enriches or filters documents before splitting (pre-split). |
Document Splitter | ingestion.documentSplitter | Splits each document into overlapping chunks. |
Segment Transformer | ingestion.segmentTransformer | Enriches or filters segments after splitting (post-split). |
Vector Store Ingestor | ingestion.vectorStoreIngestor | Embeds segments and writes them to the vector store. Accepts batchSize and continueOnError. |
<cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
docsDir = expandPath("./docs/");
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
recursive: true,
includePatterns: ["*.pdf"],
documentLoader: { sourceType: "filesystem" },
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Knowledge base"
}]
}
}
});
ragService.ingest();
answer = ragService.chat("How to renew Adobe subscription?");
writeOutput(answer.message);
</cfscript><cfscript>
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: "https://www.adobe.com/products/coldfusion-family.html",
documentLoader: {
sourceType: "url",
requestOptions: { connectionTimeout: 5000, readTimeout: 30000 }
},
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Knowledge base"
}]
}
}
});
ingest = ragService.ingest();
writeDump(ingest);
</cfscript><cfscript>
customLoader = function(required struct config) {
return [
{
text: "The population of India in 2024 is 1.44 billion people.",
metadata: { source: "custom-loader", id: 1 }
},
{
text: "The GDP of India in 2024 is approximately 3.94 trillion USD.",
metadata: { source: "custom-loader", id: 2 }
}
];
};
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: expandPath("./docs/"),
documentLoader: {
sourceType: "custom",
implementation: customLoader
},
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Knowledge base"
}]
}
}
});
ragService.ingest();
</cfscript>// Minimal — uses defaults
documentSplitter: {}
// Explicit chunk size and overlap
documentSplitter: { chunkSize: 500, chunkOverlap: 50 }
// Sentence splitter
documentSplitter: { splitterType: "sentence", chunkSize: 500, chunkOverlap: 50 }
// Recursive with custom separators
documentSplitter: {
splitterType: "recursive",
chunkSize: 200,
chunkOverlap: 50,
separators: [ chr(10) & chr(10), chr(10), " ", "" ]
}
// Regex splitter
documentSplitter: { splitterType: "regex", regexPattern: "\\n" }Option | Description |
vectorStore | Required. A configured VectorStore object. Must use the same embedding model as the retriever. |
batchSize | How many segments to embed and write per internal batch (e.g. 100). Higher values improve throughput but increase memory use. |
continueOnError | When true, ingestion skips or logs failed segments and continues. When false, the job stops on the first error — better for strict validation. |
vectorStoreIngestor: {
vectorStore: vectorStore,
batchSize: 100,
continueOnError: true
}<cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.2
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragBot = simpleRAG(docsDir, chatModel, { vectorStore: vectorStore });
// Non-blocking: returns immediately with a Future
future = ragBot.ingestAsync();
// Option A: block until indexing finishes
result = future.get();
// Option B: poll while doing other work
/*
while (!future.isDone()) {
// small unit of other work, or sleep
}
result = future.get();
*/
// Optional: inspect statistics after ingest
stats = ragBot.getStatistics();
writeDump(stats);
// Safe to query after get() returns successfully
answer = ragBot.ask("How to upgrade Adobe plan?");
writeOutput(answer.message);
</cfscript>Stage | Config key | Role |
Rewrite user question for retrieval | queryTransformer | e.g. "compressing" so follow-ups use chat context. |
Choose which retriever(s) to use | queryRouter | contentRetrievers list, optional type. |
Merge text from multiple retrievers | contentAggregator | type, separator. |
Format context and question for the LLM | contentInjector | promptTemplate, metadataKeys. |
queryTransformer: {
type: "compressing"
}<cfscript>
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
queryTransformer: { type: "compressing" },
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Adobe knowledge base"
}]
}
},
CHATMEMORY: { type: "messageWindowChatMemory", maxMessages: 10 }
});
ragService.ingest();
answer1 = ragService.chat("How to reactivate Adobe subscription?");
answer2 = ragService.chat("Tell me more about that.");
writeOutput(answer1.message);
writeOutput(answer2.message);
</cfscript>retrievalAugmentor: {
queryTransformer: { type: "compressing" },
contentAggregator: {
type: "default",
separator: chr(10) & "---" & chr(10)
},
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Knowledge base"
}]
}
},
CHATMEMORY: { type: "messageWindowChatMemory", maxMessages: 10 }retrievalAugmentor: {
queryRouter: {
type: "default",
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3
}]
}
}retrievalAugmentor: {
queryRouter: {
contentRetrievers: [
{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Manage auto renewal settings"
},
{
vectorStore: vectorStore,
maxResults: 2,
minScore: 0.3,
description: "Reactivate Adobe subscription"
}
]
}
}Field | Description |
vectorStore | Required. The vector store to search. |
maxResults | Cap on how many chunks to pull (top-K after similarity search). Smaller values retrieve fewer chunks (tighter context); larger values retrieve more overlapping evidence. |
minScore | Minimum similarity score [0, 1]. Chunks below it are filtered out. Values outside [0, 1] are rejected. A high threshold (e.g. 0.9) keeps only very similar chunks and may reduce or empty context. |
description | Human-readable scope; used by the router, especially with multiple retrievers. |
retrievalAugmentor: {
contentAggregator: {
type: "default",
separator: chr(10) & "====" & chr(10)
},
queryRouter: {
contentRetrievers: [
{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Economic indicators and inflation data"
},
{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Technology and ColdFusion knowledge"
}
]
}
}Property | Type | Default | Description |
promptTemplate | String | Built-in default | Mustache-style template that controls how retrieved content and the user question are assembled into the final prompt sent to the LLM. |
metadataKeys | Array of strings | [] (none) | Document metadata fields to append to each retrieved chunk. For example, ["file_name"] causes the source filename to appear next to each chunk. |
Placeholder | Replaced with |
{{contents}} | The retrieved document chunks (one block of text). |
{{userMessage}} | The user's original question. |
// Application.cfc
component {
this.name = hash(getCurrentTemplatePath());
public void function onApplicationStart() {
application.mistralKey = "YOUR_MISTRAL_API_KEY";
application.ollamaBaseUrl = "http://your-ollama-host:11434";
}
}<cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.6,
description: "Product knowledge base"
}]
}
// No contentInjector — default injection is used
}
});
ragService.ingest();
answer = ragService.chat("What is Klarna?");
writeOutput(answer.message)
</cfscript><cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
contentInjector: {
promptTemplate: "Use this context to answer:" & chr(10) &
"{{contents}}" & chr(10) & chr(10) &
"Question: {{userMessage}}"
},
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.6,
description: "Knowledge base"
}]
}
}
});
ragService.ingest();
answer = ragService.chat("How to view support cases?");
writeOutput(answer.message);
</cfscript><cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
contentInjector: {
metadataKeys: ["file_name"]
},
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.6,
description: "Knowledge base"
}]
}
}
});
ragService.ingest();
answer = ragService.chat("How to resolve payment issues?");
writeOutput(answer.message);
</cfscript><cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
contentInjector: {
metadataKeys: ["file_name", "absolute_directory_path"]
},
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Knowledge base"
}]
}
}
});
ragService.ingest();
answer = ragService.chat("What are the features of your product?");
writeOutput(answer.message);
</cfscript>Key | Description |
file_name | The filename of the source document |
absolute_directory_path | Full directory path containing the file |
absoluteFilePath | Full file path including the filename |
fileSize | File size in bytes |
<cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
contentInjector: {
promptTemplate: "Sources:" & chr(10) &
"{{contents}}" & chr(10) & chr(10) &
"Based on the sources above, answer: {{userMessage}}" & chr(10) &
"Cite the source file names.",
metadataKeys: ["file_name"]
},
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Knowledge base"
}]
}
}
});
ragService.ingest();
answer = ragService.chat("How to update TIN?");
writeOutput(answer.message);
</cfscript><cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
documentSplitter: { chunkSize: 300, chunkOverlap: 50 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
contentInjector: {
promptTemplate: "Reference:" & chr(10) &
"{{contents}}" & chr(10) & chr(10) &
"Q: {{userMessage}}"
},
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 5,
minScore: 0.3,
description: "Knowledge base"
}]
}
},
CHATMEMORY: { type: "messageWindowChatMemory", maxMessages: 20 }
});
ragService.ingest();
// Turn 1
a1 = ragService.chat("What are the system requirements?");
writeOutput("Turn 1: " & a1.message);
// Turn 2 - follow-up using prior context
a2 = ragService.chat("How to auto renew?");
writeOutput("Turn 2: " & a2.message);
// Turn 3 - completely different topic
a3 = ragService.chat("How to convert trial to paid subscription?");
writeOutput("Turn 3: " & a3.message);
</cfscript><cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
contentRetriever: {
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3
},
contentInjector: {
promptTemplate: "Context:" & chr(10) &
"{{contents}}" & chr(10) & chr(10) &
"Question: {{userMessage}}"
}
}
});
ragService.ingest();
answer = ragService.chat("What payment methods do you support?");
writeOutput(answer.message);
</cfscript><cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
contentAggregator: {
type: "default",
separator: chr(10) & "---" & chr(10)
},
contentInjector: {
promptTemplate: "Evidence:" & chr(10) &
"{{contents}}" & chr(10) & chr(10) &
"Answer this: {{userMessage}}"
},
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Knowledge base"
}]
}
}
});
ragService.ingest();
answer = ragService.chat("How to manage subscriptions?");
writeOutput(answer.message);
</cfscript><cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
documentSplitter: { chunkSize: 300, chunkOverlap: 50 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
contentInjector: {
promptTemplate: "Retrieved documents:" & chr(10) &
"{{contents}}" & chr(10) & chr(10) &
"User question: {{userMessage}}"
},
queryRouter: {
contentRetrievers: [
{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Technical documentation"
},
{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "FAQ content"
}
]
}
}
});
ragService.ingest();
answer = ragService.chat("How to integrate with third-party services?");
writeOutput(answer.message);
</cfscript><cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
queryTransformer: { type: "compressing" },
contentInjector: {
promptTemplate: "Context:" & chr(10) &
"{{contents}}" & chr(10) & chr(10) &
"Question: {{userMessage}}"
},
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Knowledge base"
}]
}
},
CHATMEMORY: { type: "messageWindowChatMemory", maxMessages: 10 }
});
ragService.ingest();
answer = ragService.chat("How to reactivate subscription?");
writeOutput(answer.message);
</cfscript><cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir,
documentSplitter: { chunkSize: 300, chunkOverlap: 50 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
queryTransformer: { type: "compressing" },
queryRouter: {
contentRetrievers: [
{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.3,
description: "Technical documentation"
},
{
vectorStore: vectorStore,
maxResults: 2,
minScore: 0.3,
description: "Release notes"
}
]
},
contentAggregator: {
type: "default",
separator: chr(10) & "---" & chr(10)
},
contentInjector: {
promptTemplate: "Sources:" & chr(10) &
"{{contents}}" & chr(10) & chr(10) &
"Answer: {{userMessage}}",
metadataKeys: ["file_name"]
}
},
CHATMEMORY: { type: "messageWindowChatMemory", maxMessages: 10 }
});
ragService.ingest();
answer = ragService.chat("I can't sign in?");
writeOutput(answer.message);
</cfscript><cfscript>
qdrantStore = VectorStore({
provider: "qdrant",
url: "http://your-qdrant-host:6334",
apiKey: "YOUR_QDRANT_API_KEY",
collectionName: "product_docs_" & dateFormat(now(), "yyyymmdd"),
metricType: "COSINE",
dimension: 384,
embeddingModel: {
provider: "ollama",
modelName: "all-minilm",
baseUrl: application.ollamaBaseUrl
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: expandPath("./Documents/product-docs.txt"),
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: qdrantStore }
},
retrievalAugmentor: {
contentInjector: {
promptTemplate: "Context:" & chr(10) &
"{{contents}}" & chr(10) & chr(10) &
"Question: {{userMessage}}"
},
queryRouter: {
contentRetrievers: [{
vectorStore: qdrantStore,
maxResults: 3,
minScore: 0.3,
description: "Product knowledge base"
}]
}
}
});
ragService.ingest();
answer = ragService.chat("What are the system requirements?");
writeOutput(answer.message);
</cfscript><cfscript>
chatModel = ChatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apiKey,
temperature: 0.7
});
docsDir = expandPath("./docs/");
vectorStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "openai",
modelName: "text-embedding-3-small",
apiKey: application.apiKey
}
});
ragService = agent({
CHATMODEL: chatModel,
ingestion: {
source: docsDir, // entire directory
documentSplitter: { chunkSize: 300, chunkOverlap: 50 },
vectorStoreIngestor: { vectorStore: vectorStore }
},
retrievalAugmentor: {
contentInjector: {
promptTemplate: "Documents:" & chr(10) &
"{{contents}}" & chr(10) & chr(10) &
"Answer: {{userMessage}}",
metadataKeys: ["file_name"]
},
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 5,
minScore: 0.2,
description: "Multi-document knowledge base"
}]
}
}
});
ragService.ingest();
answer = ragService.chat("I am not able to subscribe?");
writeOutput(answer.message);
</cfscript>// minScore: 0.99 — nothing will match; {{contents}} will be empty
contentInjector: {
promptTemplate: "Context:" & chr(10) &
"{{contents}}" & chr(10) & chr(10) &
"Answer: {{userMessage}}"
},
queryRouter: {
contentRetrievers: [{
vectorStore: vectorStore,
maxResults: 3,
minScore: 0.99, // extremely high — no matches expected
description: "KB"
}]
}// Only {{contents}} — user question is not passed to the LLM
contentInjector: {
promptTemplate: "Here is the context: {{contents}}"
}
// Only {{userMessage}} — retrieved content is not injected
contentInjector: {
promptTemplate: "Please answer: {{userMessage}}"
}// No placeholders — ColdFusion logs a warning, default injection is used as fallback
contentInjector: {
promptTemplate: "No placeholders here"
}<cfscript>
try {
chatModel = ChatModel({
PROVIDER: "mistral",
APIKEY: application.mistralKey,
MODELNAME: "mistral-small-latest",
TEMPERATURE: 0.3
});
econStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "ollama",
modelName: "all-minilm",
baseUrl: application.ollamaBaseUrl
}
});
techStore = VectorStore({
provider: "INMEMORY",
embeddingModel: {
provider: "ollama",
modelName: "all-minilm",
baseUrl: application.ollamaBaseUrl
}
});
// Step 1: Ingest domain-specific documents into separate stores
svcEcon = agent({
CHATMODEL: chatModel,
ingestion: {
source: expandPath("./Documents/test.txt"),
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: econStore }
}
});
svcEcon.ingest();
svcTech = agent({
CHATMODEL: chatModel,
ingestion: {
source: expandPath("./Documents/coldfusion.txt"),
documentSplitter: { chunkSize: 500, chunkOverlap: 100 },
vectorStoreIngestor: { vectorStore: techStore }
}
});
svcTech.ingest();
// Step 2: Query-only agent routes to the correct store
queryService = agent({
CHATMODEL: chatModel,
retrievalAugmentor: {
queryRouter: {
contentRetrievers: [
{
vectorStore: econStore,
maxResults: 3,
minScore: 0.3,
description: "Economic data including inflation rates and consumer price indices by year"
},
{
vectorStore: techStore,
maxResults: 3,
minScore: 0.3,
description: "Technology platform documentation for ColdFusion programming language"
}
]
}
}
});
// Step 3: Router sends question to the matching store
answer = queryService.chat("What is the inflation of year 1999?");
hasInflation = findNoCase("6%", answer.message) > 0;
writeOutput("PASS|routed_to_econ=" & hasInflation & "|answer_relevant=" & hasInflation);
} catch (any e) {
writeOutput("ERROR: " & e.message);
}
</cfscript>