> For the complete documentation index, see [llms.txt](https://dnotifier.gitbook.io/product-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dnotifier.gitbook.io/product-docs/reference/ai-methods.md).

# AI & RAG methods

Methods for AI prompts, session history, semantic search, and knowledge-base document management. Requires `aiEnabled` on your plan.

Use `transport: "http"` for synchronous request/response. WebSocket transport is supported but replies arrive asynchronously on `onMessage`.

## Methods

| Method                     | Server code | Category          |
| -------------------------- | ----------- | ----------------- |
| `sendAI()`                 | `300`       | AI prompt         |
| `fetchAIHistory()`         | `301`       | AI history        |
| `deleteAIHistoryMessage()` | `302`       | Delete AI message |
| `search()`                 | `303`       | Semantic search   |
| `addDocument()`            | `306`       | Knowledge base    |
| `updateDocument()`         | `307`       | Knowledge base    |
| `deleteDocument()`         | `308`       | Knowledge base    |
| `listDocuments()`          | `309`       | Knowledge base    |
| `getDocument()`            | `310`       | Knowledge base    |
| `sendWithOpenAI()`         | `300`       | **Deprecated**    |

## Session logging

When `logs: true` in the constructor, `sendAI()` reports session start, completion, and token usage to the DNotifier dashboard.

## Multi-model providers

Optional `provider` / `model` on `sendAI` (and on agents). Wire keys and endpoints in the portal first.

See [multi-model providers](/product-docs/ai/multi-models.md).

## Language pages

* [JavaScript / TypeScript](/product-docs/reference/ai-methods/javascript-typescript.md)
* [Dart / Flutter](/product-docs/reference/ai-methods/dart-flutter.md)

## Related

* [AI overview](/product-docs/ai/overview.md)
* [Multi-model providers](/product-docs/ai/multi-models.md)
* [Knowledge base overview](/product-docs/ai/knowledge-base-overview.md)
* [Session logging](/product-docs/ai/session-logging.md)
