Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Chat-style AI messages

For richer prompts, pass a messages array with role and content fields — the same shape used by chat-completion APIs. Optionally set useKnowledgeBase: true to ground answers in your indexed documents.

When to use chat-style vs simple text

Approach
Message shape
Best for

Simple text

{ text: "..." }

Quick one-liners

Chat-style

{ messages: [{ role, content }] }

System prompts, few-shot examples, multi-role context

Chat + RAG

{ useKnowledgeBase: true, messages: [...] }

Support bots grounded in your knowledge base

Message roles

Role
Typical use

system

Persona, rules, output format

user

End-user question or input

assistant

Prior model turns (for replay or few-shot)

message: {
  useKnowledgeBase: false,
  messages: [
    { role: "system", content: "You are a helpful support agent. Be concise." },
    { role: "user", content: "How do I reset my password?" },
  ],
}

useKnowledgeBase

When true, DNotifier retrieves relevant knowledge-base chunks and injects them into the prompt before calling the model.

Index content first with addDocument. Without documents, useKnowledgeBase still works but may return generic answers.

saveHistory

Default is true. Set false for classification, routing, or workflow steps you do not want in user-visible history.

Transport

Use transport: "http" for all sendAI calls.

Language guides

Language
Guide

JavaScript / TypeScript

Dart / Flutter

Next steps

Last updated