Whatever message this page gives is out now! Go check it out!
<cfscript>
chatModel = chatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apikey,
temperature: 0.4
});
docsDir = expandPath("./docs/");
// Create RAG service with the absolute docs path
ragBot = simpleRAG(docsDir, chatModel,
{
minscore: 0.7,
maxResults: 4
});
// Ingest documents from the docs folder
ragBot.ingest();
// Ask a question
answer = ragBot.ask("How to extend Adobe subscription using prepaid card?");
writeDump(answer.message);
</cfscript>simpleRAG (the document source). inMemory = in process, not durable across restarts).simpleRAG argument)vectorStore and embeddingModel.<cfscript>
chatModel = chatmodel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: #application.apikey#,
temperature: 0.7
});
docsDir = expandPath("./docs/");
// Enterprise configuration with custom vector store and embedding model
vectorStore = vectorStore({
provider: "inMemory"
});
embeddingModel= {
"provider": "openai",
"modelName": "text-embedding-3-small",
"apiKey": "#application.apiKey#"
}
// Create RAG service: source path + model
ragBot = simpleRAG(
docsDir,chatModel,{
"vectorStore": vectorStore,
"embeddingModel": embeddingModel
}
);
// Ingest documents from the docs folder
ragBot.ingest();
// Ask a question
answer = ragBot.ask("How to extend Adobe subscription using prepaid card?");
writeDump(answer.message);
</cfscript><cfscript>
chatModel = chatModel({
provider: "openai",
modelName: "gpt-4o-mini",
apiKey: application.apikey,
temperature: 0.4
});
docsDir = expandPath("./docs/");
// Create RAG service with the absolute docs path
ragBot = simpleRAG(docsDir, chatModel,
{
minscore: 0.7,
maxResults: 4
});
// Ingest documents from the docs folder
ragBot.ingest();
// Ask a question
answer = ragBot.ask("How to extend Adobe subscription?");
writeDump(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
}
});
// Optional: keep last N turns so follow-ups ("What about Enterprise?") resolve in context
ragBot = simpleRAG(docsDir, chatModel, {
vectorStore: vectorStore,
CHATMEMORY: {
type: "messageWindowChatMemory",
maxMessages: 20
}
});
ragBot.ingest();
// Multi-turn: same service, sequential chat() calls
r1 = ragBot.chat("How do I open an Adobe support case?");
r2 = ragBot.chat("What information do I need before I start?");
r3 = ragBot.chat("Summarize the steps you just described in three bullets.");
writeOutput(r3.message);
</cfscript>ragBot = simpleRAG(docsDir, chatModel, {
vectorStore: vectorStore,
CHATMEMORY: {
type: "messageWindowChatMemory",
maxMessages: 20
}
});Parameter | Description |
type | Set to "messageWindowChatMemory" to enable sliding-window memory. |
maxMessages | Maximum number of recent messages (user + assistant turns) to keep in context. |
<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
});
// Index documents, then inspect the store or pipeline stats
ragBot.ingest();
stats = ragBot.getStatistics();
writeDump(stats);
// Example: log one line if your build exposes known keys (adjust names to match getStats() output)
// writeLog(type="Information", file="rag", text="RAG stats: " & serializeJSON(stats));
</cfscript>Field | Description |
avgSegmentsPerDocument | Average number of text segments (chunks) produced per loaded document for this ingestion run. |
documentsLoaded | Count of source documents that were loaded and processed in this run. |
initialized | Whether the RAG service (or its core components) finished initialization successfully. |
pipelineBuilt | Whether the configured ingestion or retrieval pipeline was built without a fatal configuration error. |
segmentsCreated | Total text segments created by splitting loaded documents before or independent of final store success. |
segmentsFailed | Segments that could not be fully processed through the pipeline (e.g. embed or persist failures). |
segmentsIngested | Segments successfully written into the embedding or vector store path for this run. |
status | Overall outcome of the ingestion operation (e.g. "completed" when the job finished successfully). |
timestamp | Time associated with these statistics, often epoch milliseconds when the stats snapshot was recorded. |
totalDurationMs | Elapsed time for the operation in milliseconds. |
totalTimeMs | Another elapsed time in milliseconds; may mirror totalDurationMs or reflect a slightly different measurement boundary. |
totalTimeSec | Same or equivalent duration expressed in seconds for readability. |
<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 (if your Future supports it)
/*
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>Option | Default | Description |
chunkSize | 1000 | Target maximum size of each chunk in characters. Larger chunks preserve more context but reduce retrieval precision; smaller chunks improve granularity but increase vector count and cost. |
chunkOverlap | 200 | Number of characters shared between adjacent chunks. Helps avoid cutting sentences or facts in half at boundaries. |
splitterType | recursive | Algorithm used to split text into chunks. Options: recursive, sentence, paragraph, line, word, character, regex. Pass recursive: false alongside splitterType to disable recursive cascade. |
minScore | — | Minimum similarity score (0–1). Chunks below this threshold are excluded from retrieval results. |
maxResults | 5 | Maximum number of chunks returned per query (top-K). Covers most question types without exceeding context limits. |
vectorStore | inMemory | The vector store to use. Defaults to an in-memory store (lost on restart). Pass a VectorStore object for persistent production storage. |
embeddingModel | OpenAI ada-002 | The embedding model used to convert text to vectors. Must be consistent between ingestion and query. |
CHATMEMORY | — | Chat memory configuration for multi-turn conversations. Set type to messageWindowChatMemory and provide maxMessages. |
<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 = simpleRAG(
docsDir,
chatModel,
{
vectorStore: vectorStore,
chunkSize: 500,
chunkOverlap: 50,
splitterType: "character",
recursive: false
}
);
ragService.ingest();
answer = ragService.ask("How to renew Adobe subscription?");
writeOutput(answer.message);
</cfscript>Component | Default choice | Why this default |
Document splitter | RecursiveCharacterTextSplitter, 1000 chars, 200 overlap | Balances chunk granularity with context retention. Works well for most prose documents. |
Embedding model | OpenAI text-embedding-ada-002 | Cost-effective, high quality, and compatible with most vector stores. |
Vector store | In-memory store | Zero configuration needed. Data is lost when the application restarts — suitable for development only. |
Content retriever | EmbeddingStoreContentRetriever, maxResults: 5 | Returns the 5 most relevant chunks per query. Covers most question types without exceeding context limits. |